Skip to content

feat(records): read-only dry run for the review_record backfill - #1841

Merged
obviyus merged 2 commits into
mainfrom
review-record-backfill
Oct 9, 2026
Merged

obviyus merged 2 commits into
mainfrom
review-record-backfill

Conversation

@obviyus

@obviyus obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

S2a of the approved review-record plan (row 2): a read-only dry run that shows what the backfill would do for every stored report. Nothing here writes to records.

  • node dist/clawsweeper.js backfill-review-records --records-dir records/<slug> --output <json> (src/review-record-backfill.ts). For each items/*.md and closed/*.md it reports exactly one of these statuses:
    • typed: the report already has a valid review_record line.
    • invalid_record: the report has a review_record line that does not read back.
    • unparseable: the typed decision cannot be made, or it would not read back. The reason is reported.
    • lossless or lossy: the decision was made from the report's front matter and sections, re-rendered with the shipped markdownFor, and compared with the stored report on every decision front-matter key (about 80) and every decision section. The comparison skips the action-only Close Comment section and the Action taken: line. JSON values are compared by value, not by key order. A lossy report lists the fields that differ, with short samples that start at the first differing character. This catches the silent fallbacks in the report readers (audit Finding 4) instead of storing them.
  • The output JSON has the totals, the count for each status, the count for each differing field, the count for each reason, up to 20 example paths per status, and up to 3 samples per field.
  • .github/workflows/review-record-backfill.yml: workflow_dispatch only, permissions: contents: read. Its steps: build, hydrate records only (no git state, no blobs), run the command for each slug, upload review-record-backfill as an artifact.
  • review-record.ts: reviewRecordProblem(decision, subject) is now exported, and reviewRecordFrontMatterLine takes a ReviewRecord, so a backfilled line can carry "origin":"backfill".

The converter reuses the existing report readers, which are the last users the design keeps. It corrects three reader quirks that the re-render check found on real reports:

  • ["none"] lists in Vision Fit and in PR rating next steps;
  • evidence sha that the reader takes from the file-link URL, kept only where the report prints a - sha: line;
  • local_checkout_access when its source is unknown.

The module is deleted with the readers in S7.

Why

Audit agent://SlopDataModel/report, Findings 1 and 4. Approved plan: S2 is split into S2a (dry run) and S2b (writes, only after a go on the dry-run counts). This PR is S2a; it gives the counts.

Proof

Shipped CLI, on sample reports: the saved real reviews in ~/Developer/.agents/handoffs/clawsweeper-review-quality and the S1 proof outputs.

{"total":9,"counts":{"typed":1,"invalid_record":0,"unparseable":2,"lossless":1,"lossy":5}}
lossless  items/167817.md         today's real review of openclaw#167817 with its record line removed
typed     items/167817-typed.md   the same report as written by S1
lossy     items/167298-*.md (3), closed/166090.md, closed/167054.md
differences: "## Testing Review": 5, real_behavior_proof_status/_evidence_kind/_needs_contributor_action: 1, "## Real Behavior Proof": 1
  Testing Review, stored:   "Proof path: shipped_entry_point\n\nAdded test files: 3\n\nMissing E2E:…"
                  rendered: "Proof path: shipped_entry_point\n\nMissing E2E:…"   (field removed from the schema since)
  real_behavior_proof_status, stored: "insufficient"   rendered: "not_applicable"
    (closed/167054: reportRealBehaviorProof replaces the stored proof for maintainer- or bot-authored PRs.
     The dry run shows this reader fallback instead of storing it.)
unparseable closed/330-*, closed/348-*: "report has no AGENTS.md policy status" (synthetic test-fixture reports)
  • For #167817, the decision rebuilt from the legacy report equals the decision that S1 stored. It differs only in fixedPullRequest (absent there, null here), which renders the same.

  • The source files did not change after the run.

  • Tests (test/review-record-backfill.test.ts):

    • model, failed and oversized decisions written by markdownFor without the record line come back lossless with origin: backfill, and their decision equals the original apart from the empty optional fields, the published owners, and the close comment of a kept-open report;
    • a report with the old Testing Review line is lossy and names only ## Testing Review;
    • typed, invalid and unparseable reports;
    • the CLI on a records directory gives the counts and writes nothing.

    build:all, lint, format:check, the workflow invariant tests and the touched tests pass. The full suite runs in CI.

Codex dispositions

codex review --base origin/main: "No actionable defects were found." Nothing to fix.

Merge Danger

  • Door: two-way. It adds a command and a dispatch-only workflow, and changes no stored data.
  • Blast radius: none until someone dispatches the workflow. The workflow then reads canonical records with CLAWSWEEPER_WEBHOOK_SECRET and uploads one JSON artifact. Before S2b may write, it must hash reports without the review_record line, so that a backfill does not change implementation-intake keys. That change is a separate small PR with a failing-first test.

@obviyus
obviyus requested a review from a team as a code owner October 9, 2026 20:18
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Adds a command and manual workflow that preview converting stored review reports into structured decisions, reporting conversion losses without changing the reports.

Example: An operator classifies nine saved review reports.

  • Before: The base branch has no backfill classification command.
  • After: The command reports 1 typed, 2 unparseable, 1 lossless, and 5 lossy reports, with the differing fields.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful, focused migration tooling with meaningful shipped-CLI evidence and no identified correctness blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body records the shipped backfill-review-records CLI exercising the new classifier on saved real reports and identifying both lossless reconstruction and specific reader losses while preserving source files. The current follow-up changes only workflow hydration; its record-only path was inspected. No persisted format is changed, and OpenClaw Bay's data contract is unaffected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes
User problem: Operators cannot see which historical review reports would lose information during conversion to structured decisions.
Reason: The prior merged format work records the approved migration direction. A read-only classification stage provides useful evidence before any bulk write.

Merge readiness

✅ Ready for maintainer review

This PR remains useful, distinct work and is ready for maintainer consideration; no actionable patch defects were found.

Priority: P2
Reviewed head: 07172a1a9b47af5c24fe5c47c2037642bbee4a4a

Before merge

None.

Findings

None.

Agent review details

How this fits together

ClawSweeper stores review reports in its canonical Worker store. This tool reads local copies of those reports, reconstructs their decisions with existing readers, and produces a JSON summary for evaluating a later migration.

flowchart TD
  A[Manual workflow] --> B[Read canonical reports]
  B --> C[Local report copies]
  C --> D[Validate existing structured record]
  D --> E[Reconstruct legacy decision]
  E --> F[Render and compare decision fields]
  D --> G[Classification summary]
  F --> G
Loading

Technical review

Best possible solution:

Keep the dry-run stage separate from record writes and use its results to evaluate the later migration.

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

Not applicable: this PR adds a migration preview capability; its recorded CLI run demonstrates classification on saved reports.

Is this the best way to solve the issue?

Yes: reconstructing with the existing readers and comparing through the shipped renderer exposes conversion loss without introducing a competing report format.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e6419367a4d4.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced classifier: The classifier distinguishes existing valid records, invalid records, reconstruction failures, and rendering differences; the command reads report files and writes only its requested JSON summary. (src/review-record-backfill.ts:374, 07172a1a9b47)
  • Read-only workflow correction: The latest commit replaces setup-state with direct hydration using --skip-git-state and --skip-state-blobs, avoiding the state-writer coordinator; the secret is scoped to the hydration step. (.github/workflows/review-record-backfill.yml:33, 07172a1a9b47)
  • Real CLI results: The complete PR body records the shipped CLI classifying saved real reports: total 9, typed 1, unparseable 2, lossless 1, lossy 5. It shows removed Testing Review content and a proof-reader fallback as observable differences, and states the source reports remained unchanged. Captured body identity: c1b98b10d7611875f523292f7e4565e892e908b8a2b147e47932d54d69b89bad. The terminal evidence covers classification; it does not demonstrate a hosted workflow dispatch.
  • Existing format and owner direction: feat(records): store the typed decision as a review_record front-matter line #1838 documents the approved structured-record format, strict round-trip validation, and backfill origin. This PR preserves those contracts and implements the planned dry-run stage. (src/review-record.ts:25, 410f120f8b9a)
  • Current main and adjacent work: Current main has no classifier module or backfill workflow. fix(repair): hash reports without the review_record line for implementation intake #1842 merged the separate intake-hash prerequisite; its helper extraction does not replace this classifier. (src/review-record.ts, e6419367a4d4)
  • Focused regression coverage: The added tests cover reconstructed model, failed, and oversized decisions, legacy content loss, malformed records, and the shipped command's counts and preservation of source report bytes. These tests were inspected, not executed during this read-only review. (test/review-record-backfill.test.ts:86, 07172a1a9b47)

Likely related people:

  • Ayaan Zaidi: Raw commit 410f120 adds src/review-record.ts:25 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 410f120f8b9a; files: src/review-record.ts)

Review metrics

Metric Value Why it matters
Code growth Production +507 lines; tests +176 lines; workflow +57 lines The temporary conversion code reuses existing readers and rendering, with removal explicitly planned after migration.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded operator tool for evaluating a planned record migration, with no automatic production writes.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-09T20:21:07.021Z sha ebf5928 :: needs maintainer review before merge. :: none

Reviewed October 9, 2026, 5:16 PM ET / 21:16 UTC (Revision 2).

@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

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

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant