Skip to content

test(tasks): preserve authoritative reply SLA mutation response - #1648

Draft
seonghobae wants to merge 5 commits into
autoresearch/frontend-sec-bumpfrom
autoresearch/tasks-first-wins-20260910
Draft

test(tasks): preserve authoritative reply SLA mutation response#1648
seonghobae wants to merge 5 commits into
autoresearch/frontend-sec-bumpfrom
autoresearch/tasks-first-wins-20260910

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Current authority — 2026-09-10

  • canonical frontend dependency-security parent: #1623@17a7618eda2b212b691f08fa936e042b34258fc9
  • rejected generated head: 429bc8c7cbaa8d9ef88a820b5ecefbc73da0e0d4
  • first source correction on protected tree: a438a5d9fdb903e48e8a675c624de91d720c2f60
  • initial response-authority regression: aa0aa733cc591e5b46376bbb6293d16efebe5530
  • ordinary fix(deps): patch frontend audit security floors #1623 adoption: 4b063f4d6dc4ffdafb8d76d81fdf8ddf951e75a3
  • exact head: 8ad819786c6c2a99e0a158d2192054eb8189b2f4
  • lifecycle: Draft / corrected task-response contract / security owner adopted / fresh post-retarget CI and independent review required
  • fresh compare over fix(deps): patch frontend audit security floors #1623: ahead 5 / behind 0, exactly one effective file: frontend/src/components/TasksLayout.test.tsx (+56/-0).

Finding validation

The original proposal treated a repeated task id in POST /api/tasks/reply-sla-escalations as a duplicate whose first local value should win. That contract is incorrect for this endpoint.

The canonical backend service intentionally mutates an existing non-done reply-SLA task when it is escalated: it refreshes the title from the current email subject, changes status to blocked, priority to urgent, updates thread identity and timestamp, commits, refreshes persisted task rows, and returns those rows in ReplySlaEscalationResponse.tasks. A matching id in that mutation response is therefore newer server authority, not an untrusted duplicate to suppress.

The generated 429bc8c... production change would have kept the stale row already loaded by GET /api/tasks and discarded those legitimate server-side updates, making the board disagree with persistence immediately after the customer triggered escalation.

Repair and owner topology

a438a5d... preserved the rejected generated head as first-parent provenance while adopting the exact protected tree; the incorrect first-wins production mutation was removed without force-push or destructive history rewriting. aa0aa733... salvaged the useful scenario as a regression that requires same-id escalation results to replace stale local state.

The direct-develop candidate then inherited the known frontend dependency-security failure owned by #1623. That is not a Tasks response-merge defect. Ordinary two-parent 4b063f4d... adopts current #1623 as the canonical dependency/security parent; 8ad81978... restores only the response-authority regression. No #1623 dependency, lockfile, or security-test source is copied into this lane.

The exact test loads an existing reply_sla task, exercises the real escalation action, returns the same opaque task id with refreshed title/status/priority/timestamp and created: 0, and requires the UI to replace the stale title with the mutation response. TasksLayout.tsx has no effective delta here; response-wins behavior remains canonical product code.

Evidence provenance

All workflow evidence admitted while this PR still targeted develop is predecessor evidence after the base retarget, even when the head ancestry contains the same test. In particular, the direct-develop Security Scan failure is inherited dependency-owner evidence, and the Application CI/Bandit/Semgrep success seen on earlier heads does not transfer to this current (base SHA, head SHA) identity.

Keep Draft until #1623 is protected-integrated or canonical stacked verification produces a qualifying post-retarget exact-base/head receipt, zero valid unresolved findings remain, and a qualifying post-last-push independent review exists. No self-approval, force-push, destructive rebase, dummy requeue, stale-evidence transfer, source-owner duplication, or gate weakening.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9c32a2da-3c9c-40a0-a063-102a2ed1fbd2

📥 Commits

Reviewing files that changed from the base of the PR and between 17a7618 and 8ad8197.

📒 Files selected for processing (1)
  • frontend/src/components/TasksLayout.test.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae seonghobae changed the title fix(tasks): preserve first task on duplicate ids test(tasks): preserve authoritative reply SLA mutation response Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact protected base 042b0c70531b229af3acbd0421a2f23098d848b3 → head aa0aa733cc591e5b46376bbb6293d16efebe5530. The effective delta is exactly one file, frontend/src/components/TasksLayout.test.tsx. Please validate that the regression matches the backend command semantics: reply-SLA escalation mutates existing tasks and the returned same-id row is authoritative newer state. The rejected predecessor first-wins production change is no longer effective.

Copy link
Copy Markdown
Contributor Author

@codex review

Review exact protected base 042b0c70531b229af3acbd0421a2f23098d848b3 → head aa0aa733cc591e5b46376bbb6293d16efebe5530. Effective delta: only frontend/src/components/TasksLayout.test.tsx. Verify the test protects response-wins semantics for the reply-SLA mutation endpoint and does not encode the rejected stale-first-wins hypothesis.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="042b0c70531b229af3acbd0421a2f23098d848b3"
head="aa0aa733cc591e5b46376bbb6293d16efebe5530"

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
printf '%s\n' '--- ancestry and effective files ---'
git merge-base --is-ancestor "$base" "$head"
git diff --name-status "$base" "$head"
printf '%s\n' '--- exact test diff ---'
git diff --unified=80 "$base" "$head" -- frontend/src/components/TasksLayout.test.tsx

printf '%s\n' '--- locate candidate implementation files ---'
fd -a -t f 'TasksLayout\.(tsx|test\.tsx)$|task.*\.(py|ts|tsx)$' . | sed -n '1,240p'

printf '%s\n' '--- component structural outline ---'
ast-grep outline frontend/src/components/TasksLayout.tsx --items all 2>/dev/null || true

printf '%s\n' '--- endpoint and response merge references ---'
rg -n -C 5 -P 'reply-sla-escalations|ReplySlaEscalationResponse|reply_sla|setTasks\s*\(|new Map' \
  --glob '*.{py,ts,tsx}' . \
  -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' | sed -n '1,520p'

Length of output: 46379


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- TasksLayout types, fetch, escalation, and task map ---'
rg -n -C 12 -P 'ReplySlaEscalationResponse|reply-sla-escalations|setTasks\s*\(|new Map|response\.tasks|escalation' \
  frontend/src/components/TasksLayout.tsx | sed -n '1,460p'

printf '%s\n' '--- TasksLayout test harness and added test ---'
sed -n '1,240p' frontend/src/components/TasksLayout.test.tsx

printf '%s\n' '--- backend mutation, commit/refresh, and returned entries ---'
sed -n '70,330p' backend/services/reply_sla_escalation_service.py

printf '%s\n' '--- backend API response conversion ---'
sed -n '45,175p' backend/api/tasks.py

printf '%s\n' '--- backend regression coverage for existing reply-SLA tasks ---'
rg -n -C 12 -P 'existing|update|blocked|urgent|created.*0|reply.sla' backend/tests/test_tasks_api.py | sed -n '1,560p'

printf '%s\n' '--- exact head file metadata ---'
git show --no-patch --format=fuller aa0aa733cc591e5b46376bbb6293d16efebe5530
git diff --check 042b0c70531b229af3acbd0421a2f23098d848b3 aa0aa733cc591e5b46376bbb6293d16efebe5530

Length of output: 45267


@seonghobae Reviewed the exact base 042b0c70531b229af3acbd0421a2f23098d848b3 to head aa0aa733cc591e5b46376bbb6293d16efebe5530.

I found no valid findings.

The delta changes only frontend/src/components/TasksLayout.test.tsx.

The regression loads an existing reply_sla task. It then returns a row with the same opaque ID and created: 0. The response row has the refreshed title, blocked status, urgent priority, and newer timestamp.

TasksLayout.tsx initializes its map from current rows. It then applies each ReplySlaEscalationResponse.tasks row with mergedTasks.set(task.id, task). The response row therefore replaces the stale row for the same ID.

The backend updates non-done reply-SLA tasks and returns the mutation result in ReplySlaEscalationResponse.tasks. The regression matches this command-response contract.

I did not execute the test suite. The sandbox does not permit repository code execution.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae changed the base branch from develop to autoresearch/frontend-sec-bump September 10, 2026 13:51

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Superseding the direct-develop request after canonical owner restack: review exact base 17a7618eda2b212b691f08fa936e042b34258fc9 → head 8ad819786c6c2a99e0a158d2192054eb8189b2f4. Effective delta is exactly one test file. Validate that the same-id reply-SLA mutation response is authoritative newer state and the test does not encode the rejected first-wins hypothesis. Treat all pre-retarget CI/reviews as stale for this base identity.

Copy link
Copy Markdown
Contributor Author

@codex review

Review current exact base 17a7618eda2b212b691f08fa936e042b34258fc9 → head 8ad819786c6c2a99e0a158d2192054eb8189b2f4. Effective delta is only frontend/src/components/TasksLayout.test.tsx. Verify response-wins semantics against the backend reply-SLA mutation contract and treat all pre-retarget evidence as stale.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base="17a7618eda2b212b691f08fa936e042b34258fc9"
head="8ad819786c6c2a99e0a158d2192054eb8189b2f4"

git cat-file -e "${base}^{commit}"
git cat-file -e "${head}^{commit}"
git merge-base --is-ancestor "$base" "$head"

printf '%s\n' '--- exact comparison ---'
git diff --name-status "$base" "$head"
git diff --check "$base" "$head"
git diff --unified=100 "$base" "$head" -- frontend/src/components/TasksLayout.test.tsx

printf '%s\n' '--- relevant frontend structure ---'
ast-grep outline frontend/src/components/TasksLayout.tsx --items all
ast-grep outline frontend/src/components/TasksLayout.test.tsx --items all

printf '%s\n' '--- frontend escalation request and response merge ---'
rg -n -C 14 -P 'reply-sla-escalations|ReplySlaEscalationResponse|mergedTasks|setTasks\s*\(|response\.tasks' \
  frontend/src/components/TasksLayout.tsx

printf '%s\n' '--- test scenario context ---'
rg -n -C 30 -P 'reply_sla|reply-sla-escalations|created\s*:\s*0|blocked|urgent|stale|refreshed' \
  frontend/src/components/TasksLayout.test.tsx

printf '%s\n' '--- backend candidate files ---'
fd -a -t f 'reply_sla_escalation_service\.py|tasks\.py' backend
printf '%s\n' '--- backend mutation and API response ---'
rg -n -C 14 -P 'ReplySlaEscalationResponse|reply_sla|blocked|urgent|refresh|commit|tasks=' \
  backend/services/reply_sla_escalation_service.py backend/api/tasks.py

Length of output: 47479


@seonghobae Reviewed exact base 17a7618eda2b212b691f08fa936e042b34258fc9 to head 8ad819786c6c2a99e0a158d2192054eb8189b2f4.

I found no valid findings.

The effective delta changes only frontend/src/components/TasksLayout.test.tsx.

The new test starts with an existing reply_sla task. The escalation response returns the same task ID with created: 0, a refreshed title, blocked status, urgent priority, and a newer timestamp.

TasksLayout.tsx merges response tasks with:

mergedTasks.set(task.id, task)

This operation replaces the stale local row with the same-id response row.

The test requires the refreshed title and rejects the stale title. It therefore protects response-wins behavior. It does not encode the rejected first-wins hypothesis.

The backend updates a non-done existing reply-SLA task, commits the change, and returns the task through ReplySlaEscalationResponse.tasks. The regression matches this command-response contract.

I treated all pre-retarget CI and review evidence as stale. I did not execute repository tests because the sandbox does not allow repository code execution.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant