Repository navigation
test(api): checkpoint -> abort -> resume end to end (M4-E2E-14) - #365
Conversation
Store-backed fixture with a real router and a fake agent child process (the test binary re-executed) that posts a checkpoint and exits non-zero. The run is reconciled through the production lifecycle, the next fenced run reads the checkpoint by context and revision, replays are idempotent, changed/stale writes are refused and the old credential cannot write. The test backend now delegates both checkpoint calls to the Store when one is attached. Regression-For: c60f267 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Queued — the merge queue status continues in this comment ↓. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a90468ad29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fn checkpoint(key: &str, expected: i64, remaining: &str) -> String { | ||
| json!({"idempotencyKey":key,"expectedRevision":expected,"completed":[],"remaining":[remaining],"failedApproaches":[],"evidenceIds":[]}).to_string() |
There was a problem hiding this comment.
Exercise missing evidence through the real HTTP path
This helper hard-codes evidenceIds to an empty list, so the new end-to-end test never exercises the missing-evidence rejection required by .pa/continuous_acceptance_matrix.md:24. The existing store and error-mapping unit tests cannot detect an integration regression between the HTTP route and real store; send a nonexistent evidence ID here and verify a 409 response plus an unchanged revision before treating M4-E2E-14 as runtime evidence.
AGENTS.md reference: AGENTS.md:L16-L18
Useful? React with 👍 / 👎.
| assert_ne!(status, 200); | ||
| assert_ne!( |
There was a problem hiding this comment.
Require the stale credential's authorization status
When the old credential reaches an unexpected backend failure, both stale-access checks still pass for any status other than 200, including 500, so this test can report run/fence enforcement without observing the intended authorization refusal. The route contract maps stale ownership to 403; assert that response explicitly for both read and write so this acceptance test detects broken error mapping rather than merely detecting lack of success.
AGENTS.md reference: AGENTS.md:L16-L18
Useful? React with 👍 / 👎.
| sqlx::query( | ||
| "UPDATE continuous_tasks SET claim_owner='worker-b', claim_fence=2 WHERE id='task-1'", | ||
| ) |
There was a problem hiding this comment.
Resume through the real retry and claim lifecycle
In the abort-and-resume scenario, this direct SQL update bypasses both checkpoint_continuous_task(..., Some("retry"), ...), which verifies the failed run and releases ownership, and claim_continuous_task, which advances the fence while enforcing attempt, deadline, capacity, assignment, and dependency rules. Consequently the test still passes if production can never release or reclaim an aborted task, so it does not provide the end-to-end continuation evidence described by docs/PLAN.md:159; use the production retry and claim APIs instead of manufacturing the second claim.
AGENTS.md reference: AGENTS.md:L16-L18
Useful? React with 👍 / 👎.
Test-First: src-tauri/src/api/tests/continuous_e2e_tests.rs::checkpoint_survives_agent_abort_and_is_resumed_by_the_next_run
Regression-For: 459fe3e
|
@Mergifyio queue |
Merge Queue Status
This pull request spent 14 minutes 43 seconds in the queue, including 13 minutes 36 seconds running CI. Required conditions to merge
|
Ein echter HTTP-Test belegt jetzt, dass ein Agent einen Checkpoint speichern, abbrechen und ein neuer Lauf den Stand fortsetzen kann. Die Prüfung fand zusätzlich einen offenen SQLite-Pool, der auf Windows das Testverzeichnis sperrte; dieser Fehler ist red-first behoben. Zwei unabhängige Reviewer anderer Anbieter haben den Kandidaten geprüft, und es bleibt kein hoher Befund offen.
Report
What changed
src-tauri/src/api/tests/continuous_e2e_tests.rs: a store-backed fixture with the real loopback router and a fake agent child process. The child posts a checkpoint and exits non-zero; the parent reconciles the run, reclaims the task with a new owner/fence, and verifies context/revision reads, continuation, replay idempotency, changed/stale conflicts, missing revision, and rejection of the old credential.src-tauri/src/api.rs.0a9684593ae65bb4e8ba1d94d615ac3789cd9eda(190 diff lines, within the 300-line package limit).Evidence
cargo test --manifest-path src-tauri/Cargo.toml --bin projecta api::tests::continuous_e2e_tests::checkpoint_survives_agent_abort_and_is_resumed_by_the_next_run -- --exact --nocaptureat459fe3e-> exit 1, pool-open assertion failed and Windows reportedos error 32while removing the temp directory.0a96845-> exit 0, 1 passed, no temp-directory cleanup error.bash scripts/ci/red-first.sh --plan-> exit 0 (count=3,specs=1).bash scripts/ci/gates.sh lane prepushon Windows at0a96845-> exit 0: 1,808 Rust tests passed (17 skipped), 475 frontend tests passed, 516 HQ/script tests passed; clippy, architecture-drift, secret scan, formatting, typecheck and lint passed.PA_PREPUSH=light-> exit 0;git ls-remotematched local and remote0a9684593ae65bb4e8ba1d94d615ac3789cd9eda.gh pr checks 365 --watch-> exit 0:gates (linux),gates (windows),red-first, CodeQL analyses, and GitGuardian passed on the final candidate.mainCI run37231654445-> completed successfully before queueing.Architecture drift
block_oncalls follow the existing test-adapter pattern atsrc-tauri/src/api.rs:2987andsrc-tauri/src/api.rs:3070; no new production IPC, event, error, lock, SQL-owner, or frontend-state pattern was introduced.node scripts/ci/architecture-drift.mjs checkpassed in both precommit and prepush.Review disposition
a90468ad29067d34b228b69c3f20ca678aaa37c2, final delta through0a9684593ae65bb4e8ba1d94d615ac3789cd9eda.src-tauri/src/api/tests/continuous_e2e_tests.rs:34. The new server-backed test retained a Store pool, and Windows visibly failed to remove its temp directory (os error 32) although the test reported green. Red proof commit459fe3e; fixed by explicitly closing both pools with test-only Store lifecycle helpers in commit0a96845.glm-5.2:cloud, reportedglm-5.2; candidatea90468ad29067d34b228b69c3f20ca678aaa37c2; transport statusok.src-tauri/src/api.rs:3013.tauri::async_runtime::block_onis already the FakeBackend test-adapter pattern atsrc-tauri/src/api.rs:2987andsrc-tauri/src/api.rs:3070; the real router test executes it successfully. Moving sync trait dispatch or adding a second adapter pattern is outside this test package and unsupported by a failure.src-tauri/src/api/tests/continuous_e2e_tests.rs:18.std::process::exitis the deliberate abort simulation. The child creates no owned TempDir or database; the actual parent-side cleanup defect was separately observed and fixed as C1.src-tauri/src/api/tests/continuous_e2e_tests.rs:49. The interpolated values are generated fixed fixture data, not untrusted input, and the SQL exists only in a test. Production SQL ownership remains unchanged and the architecture-drift gate passes.NICHT ABGEDECKT
#[cfg(unix)]tests or Linux clippy arms (KNOWN_ISSUES KI-7); the Linux half must come from CI/WSL2.record_development_process_exitor a real provider process.Open points
@Mergifyio queue.