Skip to content

fix(qa): prevent stale evidence after failed suite cleanup - #120632

Closed
vincentkoc wants to merge 2 commits into
mainfrom
fix/qa-evidence-lifecycle-rebuild-20260808
Closed

vincentkoc wants to merge 2 commits into
mainfrom
fix/qa-evidence-lifecycle-rebuild-20260808

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves a problem where QA suite runs could leave stale or prematurely published qa-evidence.json after planning, execution, profile scorecard finalization, or runner cleanup failed. Concurrent runs targeting the same output directory could also overwrite one another's evidence.

This is a clean replacement for the earlier draft. It does not cherry-pick or derive from the stale implementation, and the earlier draft remains open until this replacement eventually lands.

Why This Change Was Made

QA evidence publication now has one internal lifecycle owner. It acquires a fail-fast lock keyed by the resolved output directory, invalidates stale canonical evidence, gives runners an invocation-unique staged target, holds ownership through retries and cleanup, attaches profile scorecards before publication, atomically renames staged evidence into place, and applies explicit discard/publish/release error precedence.

Reports and summaries remain direct diagnostic writes. Only canonical evidence is transactional, and no lifecycle controls were added to QaSuiteRunParams or public API barrels.

User Impact

Operators can trust canonical QA evidence to represent a fully successful suite lifecycle. Failed planning, execution, cleanup, or profile finalization leaves canonical evidence absent; successful runs publish once after cleanup; same-output contention fails before mutation while different output directories remain concurrent.

Evidence

  • Exact branch base: 7ecdef6e2ed4c5d8007ac9a65c952b3af4eb0798
  • Exact signed head: 7b25193235756dd01b5e4e0700c2394489b99cef
  • Current origin/main: e6353d85ef3ac52ed33b1ed454c4c7f9ce88cc73
  • Current-main overlap: none in the owned QA evidence lifecycle paths; no rebase performed for unrelated drift
  • Merge-tree: clean, tree bfd58873f07251600b998fbe30e1ead53a7772f0
  • Checkpointed broader evidence before the final correction: 224 focused tests passed; workflow guards 107 passed / 2 skipped
  • Final required three-file run: 56 tests collected, 54 passed, 2 failed only because macOS canonicalized /var to /private/var in lock-path assertions
  • Targeted rerun after canonicalizing the two test temp roots: 7/7 passed; all three requested focused files are green
  • Targeted formatting and git diff --check: passed
  • Independent Sol autoreview (gpt-5.6-sol, high): clean, no actionable findings, correctness confidence 0.96
  • Follow-up commit LOC: production +274/-250 (net +24); tests +615/-273 (net +342); workflow +2/-2
  • Full PR LOC: production +445/-307 (net +138); tests +962/-131 (net +831); workflow +2/-2
  • Commit attestation: att_01KZHKR0YS93604CQRXSGWAETB
  • PR attestation: att_01KZHKT4PRNBG3RQRRY58Y8ND7

No hosted CI, heavy QA profile, merge, issue close, or Punchcard finish was run for this checkpoint.

Provenance

PR #120012 is intentionally not closed by this draft and should remain open until a replacement lands.

Punchcard-Session: amber-workshop-workshop-36

Punchcard-Session: amber-workshop-workshop-36
@vincentkoc vincentkoc self-assigned this Aug 8, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 8, 2026
@clawsweeper

clawsweeper Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 15, 2026, 3:32 PM ET / 19:32 UTC.

ClawSweeper review

What this changes

The PR stages canonical QA evidence under an output-directory lock and publishes it only after planning, suite execution, cleanup, and profile-scorecard preparation succeed.

Merge readiness

⛔ Blocked by patch quality or review findings - 8 items remain

Keep this protected maintainer PR open for human review: its lifecycle approach is coherent, but it reverses current direct-suite artifact semantics and bypasses the established secure atomic writer.

Priority: P2
Reviewed head: 7b25193235756dd01b5e4e0700c2394489b99cef
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has focused lifecycle coverage but conflicts with current artifact compatibility and permission guarantees.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate; its focused lifecycle tests remain supplemental validation.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate; its focused lifecycle tests remain supplemental validation.
Evidence reviewed 5 items PR lifecycle broadens invalidation: The new lifecycle deletes canonical evidence before its callback and stages replacement evidence with raw filesystem writes; both public suite entrypoints wrap all normal evidence-writing runs in this lifecycle.
Current artifact contract: Current main publishes artifacts through the security runtime with mode 0600, preservation of an existing file mode, and synchronized atomic replacement.
Current regression coverage: Current main explicitly tests that both standard and unified publication failures preserve the prior canonical evidence artifact, and separately asserts 0600 artifact permissions.
Findings 1 actionable finding [P1] Preserve the established atomic artifact contract
Security Needs attention Artifact permissions regress to the process umask: Raw fs.writeFile creates staged canonical evidence without the current explicit 0600 mode before it is renamed into place, weakening the established artifact confidentiality boundary.

How this fits together

QA Lab writes qa-evidence.json for suite and profile runs, which release and maturity automation consume as canonical run evidence. The changed lifecycle sits between QA command entrypoints and artifact publication, while runners produce evidence and diagnostic reports.

flowchart LR
  A[QA profile or suite command] --> B[Evidence lifecycle]
  B --> C[Output directory lock]
  C --> D[Suite runners and cleanup]
  D --> E[Staged evidence]
  E --> F[Canonical evidence]
  D --> G[Reports and summaries]
Loading

Decision needed

Question Recommendation
Should failed direct QA-suite publication retain the current prior-artifact contract while profile runs invalidate stale evidence before planning? Scope invalidation to profile runs: Retain current direct-suite atomic preservation and apply stale-evidence invalidation only where profile evidence has the stronger freshness requirement.

Why: Current main deliberately preserves direct-suite artifacts on atomic-write failure, while this PR intentionally applies the opposite rule to all suite entrypoints; selecting one behavior is a maintainer-owned compatibility decision.

Before merge

  • Preserve the established atomic artifact contract (P1) - This deletes the prior evidence before every normal suite run and replaces it with raw staged writes. Since the wrapper now covers direct flow and unified suites, an I/O or cleanup failure loses a previously valid canonical artifact and bypasses main's 0600/synchronized atomic writer; keep profile-specific invalidation in the profile owner and retain the established artifact publisher for direct suites.
  • Resolve security concern: Artifact permissions regress to the process umask - Raw fs.writeFile creates staged canonical evidence without the current explicit 0600 mode before it is renamed into place, weakening the established artifact confidentiality boundary.
  • Resolve merge risk (P1) - The PR makes absence-after-failure the rule for direct qa suite and flow runs, while current main deliberately preserves prior artifacts when atomic publication fails.
  • Resolve merge risk (P1) - The bug-fix branch adds net production code; the lifecycle should be consolidated around the chosen artifact contract before accepting that growth.
  • Complete next step (P2) - A maintainer must choose the direct-suite compatibility policy before a mechanical repair can safely proceed.
  • Improve patch quality - Reconcile direct-suite preservation with profile freshness through a maintainer decision.
  • Improve patch quality - Restore secure atomic artifact publication and add regression coverage for the selected semantics.

Findings

  • [P1] Preserve the established atomic artifact contract — extensions/qa-lab/src/suite-evidence-lifecycle.ts:42-46
  • [medium] Artifact permissions regress to the process umask — extensions/qa-lab/src/suite-evidence-lifecycle.ts:44
Agent review details

Security

Needs attention: The new staged publication bypasses the current 0600 security-runtime artifact writer.

PR surface

Source +208, Tests +761, Config 0. Total +969 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 8 515 307 +208
Tests 8 892 131 +761
Docs 0 0 0 0
Config 1 2 2 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 1409 440 +969

Review metrics

Metric Value Why it matters
Production versus test delta production +445/-307 (net +138); tests +962/-131 (net +831) The production growth introduces a shared lifecycle boundary, but it must not carry forward duplicated or incompatible artifact-publication paths.

Stored data model

Persistent data-model change detected: database schema: extensions/qa-lab/src/suite-evidence-lifecycle.process-fixture.ts, database schema: extensions/qa-lab/src/suite-evidence-lifecycle.test.ts, serialized state: extensions/qa-lab/src/cli.runtime.test.ts, serialized state: extensions/qa-lab/src/suite-evidence-lifecycle.process-fixture.ts, serialized state: extensions/qa-lab/src/suite-evidence-lifecycle.ts, serialized state: extensions/qa-lab/src/suite-launch.runtime.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Restore profile-only invalidation (recommended)
    Preserve the direct-suite atomic writer and its existing-artifact behavior, then make profile freshness a narrowly owned lifecycle rule.
  2. Approve the broader semantic change
    Maintainers may intentionally replace direct-suite artifact preservation only after documenting and testing the new automation contract.

Technical review

Best possible solution:

Keep stale-evidence invalidation at the profile lifecycle owner, preserve direct-suite atomic artifact semantics, and retain the existing secure artifact writer for every published file.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: current-main tests establish the direct-suite preservation and 0600 contracts, while the PR lifecycle deletes that artifact before every normal suite run.

Is this the best way to solve the issue?

No: the all-entrypoint lifecycle reverses a recent direct-suite compatibility and security contract; profile-scoped invalidation is the safer owner-boundary fix unless maintainers intentionally choose new global semantics.

Full review comments:

  • [P1] Preserve the established atomic artifact contract — extensions/qa-lab/src/suite-evidence-lifecycle.ts:42-46
    This deletes the prior evidence before every normal suite run and replaces it with raw staged writes. Since the wrapper now covers direct flow and unified suites, an I/O or cleanup failure loses a previously valid canonical artifact and bypasses main's 0600/synchronized atomic writer; keep profile-specific invalidation in the profile owner and retain the established artifact publisher for direct suites.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ab5b8b9a02c8.

Labels

Label justifications:

  • P2: This is a bounded internal QA reliability change, but its artifact semantics affect automated evidence consumers.
  • merge-risk: 🚨 compatibility: Existing direct QA-suite runs currently preserve a prior canonical artifact on atomic-write failure, which this PR removes.
  • merge-risk: 🚨 automation: QA profile and maturity workflows consume the canonical evidence file whose failure-time behavior changes here.
  • merge-risk: 🚨 security-boundary: Raw staged writes bypass the current 0600, synchronized security-runtime artifact writer.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is not subject to the external-contributor proof gate; its focused lifecycle tests remain supplemental validation.

Evidence

Security concerns:

  • [medium] Artifact permissions regress to the process umask — extensions/qa-lab/src/suite-evidence-lifecycle.ts:44
    Raw fs.writeFile creates staged canonical evidence without the current explicit 0600 mode before it is renamed into place, weakening the established artifact confidentiality boundary.
    Confidence: 0.96

What I checked:

Likely related people:

  • steipete: Authored the current-main commit that introduced atomic QA artifact replacement and preservation on write failure. (role: current atomic artifact contract author; confidence: high; commits: fea6d96378cb; files: extensions/qa-lab/src/suite-artifacts.ts, extensions/qa-lab/src/suite-launch.runtime.test.ts)
  • vincentkoc: Authored the merged QA execution-attestation work and this lifecycle replacement proposal. (role: recent QA evidence lifecycle contributor; confidence: high; commits: 7dcb1ad5ceeb, 7b2519323575; files: extensions/qa-lab/src/suite-launch.runtime.ts, extensions/qa-lab/src/suite-run.runtime.ts)
  • RomneyDa: Authored the merged unified QA evidence and profile-scorecard work that defines the consumer-facing artifact flow. (role: canonical profile-evidence contributor; confidence: medium; commits: e8db9c3bc0df, 3d38c9a6335b; files: extensions/qa-lab/src/cli.runtime.ts, extensions/qa-lab/src/suite-launch.runtime.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-08T17:39:59.998Z sha ba4ef91 :: found issues before merge. :: [P1] Honor the explicit no-evidence-file mode | [P2] Canonicalize lifecycle test roots
  • reviewed 2026-08-08T21:46:46.884Z sha 7b25193 :: needs maintainer review before merge. :: none

Punchcard-Session: amber-workshop-workshop-36
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 8, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

Closing as broadly superseded by #126407, merged as db533799d592879ee34572693841efa1c2478861, and #122580, merged as fea6d96378cb4933e4ea012ab1650a8fb6b34728.

Those canonical owners now invalidate suite generations before execution, publish canonical evidence only after terminal cleanup, and replace artifacts atomically with 0600 permissions. This historical branch bypasses that writer and would regress the current lifecycle.

The narrower remaining planning-before-invalidation defect is already owned by #120012. Reconstruct and prove that current-main repair there rather than reviving this branch.

@vincentkoc vincentkoc closed this Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant