Skip to content

fix: avoid persistence warnings for test fixtures - #1257

Merged
steipete merged 1 commit into
mainfrom
fix/persistence-classifier-130585
Aug 27, 2026
Merged

steipete merged 1 commit into
mainfrom
fix/persistence-classifier-130585

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

Maintainers can edit this same-repository branch.

Related: openclaw/openclaw#130585 — diagnostic-only OpenGrep repair, already merged and unchanged by this PR.

What Problem This Solves

Fixes an issue where maintainers reviewing test-only setup would receive a persistent-data-model warning and a migration-proof requirement even though no runtime persistence contract changed.

The review of the OpenGrep diagnostic repair classified test/scripts/run-opengrep.test.ts as serialized state. That real two-file patch changes only missing-tool installation guidance (+1/-3) and adds a subprocess regression (+31/-0). The maintainer disposition identifies the warning as inapplicable.

Why This Change Was Made

The generic persistence detector matched the test fixture's writeFile(...) call without first excluding test/support paths. The producer now reuses the existing SQLite classifier's production-path predicate before both semantic detection and missing/truncated-patch handling, while preserving semantic documentation checks.

Current and previous filenames are filtered independently: moving production persistence code into a test or fixture path still retains the original production-side evidence. This changes the classification owner, not the renderer or upgrade-proof gate. It introduces no new regex family, dependency, config, schema, migration, or test-only production seam.

User Impact

Test, fixture, and example setup no longer creates a persistence warning merely by writing temporary data. Actual production serialization, schemas, migrations/backfills, cache/vector/durable storage, semantic documentation changes, and conservative incomplete-evidence warnings retain their existing behavior.

The already-landed OpenGrep fix is not modified. The original review's separate terminal-completion discrepancy is not changed or labeled a proven reporter defect here.

OpenClaw Bay Impact

No Bay changes are needed. Publication fields, queue/lifecycle behavior, and observer API contracts are unchanged; future review records carry corrected values in the existing data-model fields.

Documentation Impact

Updated the active implementation reference docs/pr-review-comments.md to explain production/test scope, rename handling, conservative unknown warnings, and the distinction between a review signal and proof of a changed persistence contract. Its owning source remains src/clawsweeper-change-detection.ts and the report renderer; review this paragraph when those detection or rendering contracts change.

Evidence

  • Frozen the exact GitHub file patches from OpenClaw head 7415491d399e97288a1e5c58eea8273a0d3e12e0, and verified them against the head-parent diff. The permanent fixture retains both complete patches and their additions/deletions.
  • Reproduced the exact false-positive surface with the original reviewer source a2641b27c403012451cf307d03fb699933fef6a5 and the current-main baseline. The production renderer emitted the original warning sentence.
  • Regression red proof before the source edit: 25 tests passed and 9 failed for the intended test-scope classifications. Green proof afterward: node --test test/pr-surface-policy.test.ts passed all 34 tests.
  • Coverage protects the real diff, colocated tests, missing/truncated test-support patches, mixed production/test diffs, both rename directions, removed serialization, semantic docs, and truncated file-list uncertainty. Existing config, SQLite, production persistence, and upgrade-proof tests remain green.
  • pnpm run build:all, formatting, docs checks, all lint lanes, and focused coverage passed. Fresh isolated Codex reviews before commit and on the rebased committed branch both returned no findings (P0 scope; patch is correct). On the committed head, all three builds, formatting and docs checks, all 34 focused tests, and the production classifier/renderer replay passed again.
  • The initial local pnpm run check ran 3,767 tests: 3,710 passed, 48 failed, and 9 skipped. The failures were independently reproduced from an extracted, rebuilt unchanged baseline and are separate from this patch: 42 failures from abbreviated fetch refspecs pruning origin/main with fetch.prune=true, and 6 from an unprepared pinned pnpm runtime in a fresh offline validation profile. These have separate active repairs; this PR does not disable pruning, enable network access in containment, or weaken their assertions. Current-main hosted CI is green; exact-head hosted CI must also be green before merge.
  • Production LOC: +4/-1 (net +3); tests/fixture: +131/-1 (net +130); docs: +7/-0. The production growth applies an existing ownership predicate rather than adding another classifier policy.

Real Behavior Proof

Verified ClawSweeper head: b45a0380ccfe72d9dd9091c6bada26bea9871cf5, rebased onto f211e21fb89d00777ac07cc13c358f9f7b02a939. All four task-file blobs are unchanged from the accepted precommit patch.

Claim: The actual reviewed two-file diagnostic/test diff must not produce a persistent-data-model warning, while real production persistence and incomplete-evidence signals remain intact.

Exercised surface: Captured GitHub pullFiles payload → compiled production dataModelChangeFromContext → report frontmatter → production renderReviewCommentFromReport. No publisher, apply, repair, or GitHub mutation path is used.

Scenario and environment: Exact OpenClaw PR 130585 head above; isolated ClawSweeper checkout on macOS, repository-pinned pnpm 11.10.0. Initial proof ran on Node 24.19.0; the committed-head rebuild, 34 focused tests, and production replay passed on Node 26.7.0. This is a controlled replay of real review input, not a mocked classifier or a claim of deployed/live model review.

Commands: pnpm run build:all; direct Node invocation of the compiled classifier and comment renderer using test/fixtures/persistence-classifier-130585.json; node --test test/pr-surface-policy.test.ts.

The classifier portion is independently reproducible from the checked-in real payload after building:

node --input-type=module <<'JS'
import fs from 'node:fs';
import { dataModelChangeFromContext } from './dist/clawsweeper-change-detection.js';
const { pullFiles } = JSON.parse(fs.readFileSync('test/fixtures/persistence-classifier-130585.json', 'utf8'));
console.log(dataModelChangeFromContext('openclaw/openclaw', {
  issue: {}, comments: [], timeline: [], pullFiles,
  counts: { comments: 0, timeline: 0, pullFilesTruncated: false },
}));
JS

Observed before:

{"change":true,"surfaces":["serialized state: test/scripts/run-opengrep.test.ts"]}

The rendered comment contained: Persistent data-model change detected: serialized state: test/scripts/run-opengrep.test.ts. Confirm migration or upgrade compatibility proof before merge.

Observed after:

{"change":false,"surfaces":[]}

The rendered comment has no stored-data warning. Companion production and rename scenarios retain their expected warnings.

Limits: No deployment is part of this PR. The original terminal-proof artifact records a completion-observation timeout and both output assertions as not_run; its passing test summary does not prove outer-process exit. Missing original pane/PID/exit telemetry prevents assigning that separate discrepancy to the reporter or wrapper, so neither is changed here.

Reuse the existing production-path scope for persistence detection so test fixture writes do not request migration proof. Preserve production, rename, semantic documentation, and unknown-evidence detection.

Includes the diagnostic-only diff from openclaw/openclaw#130585 as regression evidence; the already-landed OpenGrep fix is unchanged.
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 27, 2026 04:50
@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 27, 2026
@clawsweeper

clawsweeper Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 27, 2026, 12:53 AM ET / 04:53 UTC.

ClawSweeper review

What this changes

The PR limits persistent-data-model detection to production and semantic documentation paths so test and fixture writes do not trigger migration-proof warnings.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for landing: the narrow classifier fix is correct and is not yet on current main.

Priority: P2
Reviewed head: b45a0380ccfe72d9dd9091c6bada26bea9871cf5

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrow policy correction with captured-input runtime proof, focused boundary coverage, and no actionable defect found.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.
Evidence reviewed 5 items Scoped detector implementation: Both current and previous filenames are filtered through production or documentation path predicates before unknown-patch and persistence analysis, retaining evidence for production-to-test renames.
Regression coverage: Focused tests cover the captured OpenGrep PR payload, rendered warning absence, test/fixture exclusions, rename directions, production persistence, semantic docs, and truncated file-list fallback.
Documentation matches behavior: The updated reference accurately states that warnings apply to production or semantic documentation changes and that production-side rename evidence is retained.
Findings None None.
Security None None.

Live Verification

Command: pnpm run build:all

Result: PASS (completed)

$ pnpm run build && pnpm run build:repair && pnpm run build:dashboard
$ tsc -p tsconfig.json
$ tsc -p tsconfig.repair.json
$ tsc -p tsconfig.dashboard.json
✔ config surface reports force human review instead of automerge pass (3.326315ms)
✔ config surface reports preserve security-sensitive markers (0.995906ms)
✔ config surface detector finds schema and plugin manifest additions (1.57158ms)
✔ config surface detector ignores non-semantic docs wording (0.312289ms)
✔ config surface detector finds removed schema keys (0.277606ms)
✔ config surface detector finds schema assembly changes (0.214402ms)
✔ config surface detector fails closed for schema continuation changes (0.354432ms)
✔ config surface detector fails closed for missing patches (0.26641ms)
✔ config surface detector fails closed for truncated file patches (0.327522ms)
✔ config surface detector fails closed for renamed config surface files (0.337296ms)
✔ config surface detector fails closed for truncated pull files (0.20655ms)
✔ tooling diagnostic and subprocess regression do not produce a stored-data warning (16.848935ms)
✔ data model detector scopes colocated test serialization (1.412541ms)
✔ data model detector scopes test setup with a missing patch (0.099599ms)
✔ data model detector scopes fixture with a truncated patch (0.096385ms)
✔ data model detector scopes example storage setup (0.130686ms)
✔ data model detector scopes test to production rename with a missing patch (0.149965ms)
✔ data model detector scopes production to test rename with serialization removed (0.474463ms)
✔ data model detector scopes production to fixture rename with a missing patch (0.077867ms)
✔ data model detector scopes truncated file list containing only test setup (0.062003ms)
✔ data model detector finds production persistence and semantic docs changes in mixed diffs (1.381404ms)
✔ data model detector ignores query-only and non-semantic docs changes (0.721744ms)
✔ SQLite schema detector finds production table changes and ignores non-schema SQL (1.135736ms)
✔ SQLite schema warning is visible for table changes and absent otherwise (5.072008ms)
✔ data model detector flags path-hinted persisted field declarations (0.583576ms)
✔ data model detector fails closed for missing and truncated likely-surface patches (0.21997ms)
✔ data model reports force human review without migration proof (6.943428ms)
✔ data model warnings escape marker-like surface filenames (1.91113ms)
✔ data model reports can pass when migration proof is recorded (2.183159ms)
✔ data model reports can pass when no migration is required and compatibility is verified (2.367165ms)
✔ data model reports reject explicitly negative migration proof (1.669427ms)
✔ data model reports reject requested future migration proof (3.037683ms)
✔ data model reports reject planned migration tests as proof (1.719342ms)
✔ data model reports reject hypothetical compatibility proof (1.805602ms)
ℹ tests 34
ℹ suites 0
ℹ pass 34
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 328.196791

Assertions:

  • PASS expect_output: tooling diagnostic and subprocess regression do not produce a stored-data warning
  • PASS expect_output: data model detector scopes production to test rename with serialization removed

How this fits together

ClawSweeper turns GitHub PR file metadata and patches into review signals and a maintainer comment. This detector decides whether a PR receives a stored-data warning that requests upgrade evidence.

flowchart LR
A[GitHub PR files] --> B[Change detector]
B --> C{Production or docs path?}
C -->|Yes| D[Persistence analysis]
C -->|No| E[Ignore test support path]
D --> F[Review report fields]
E --> F
F --> G[Maintainer comment]
Loading

Before merge

  • Complete next step (P2) - No contributor-facing repair is identified; this is ready for normal maintainer landing review once the exact-head check completes.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Change mix production +4/-1; tests/fixture +131/-1; docs +7/-0 The small policy adjustment has focused boundary coverage and matching documentation.

Technical review

Best possible solution:

Land the production-path scoping rule with its captured-payload regression coverage so persistence warnings stay reserved for meaningful production or documentation changes.

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

Yes. The PR body records the prior warning and after-fix absence using the captured PR-file payload through the compiled production detector and renderer, and the fixture is checked in.

Is this the best way to solve the issue?

Yes. Reusing the established production-path predicate is the narrowest shared boundary for excluding test support paths while retaining production rename and incomplete-evidence handling.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The PR fixes a limited review-classification false positive without changing runtime user data or persistence behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.

Label justifications:

  • P2: The PR fixes a limited review-classification false positive without changing runtime user data or persistence behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix compiled production-detector and renderer output for the captured GitHub payload, including the prior false warning, the corrected absence, and retained companion signals.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-head blame attributes the affected detector scope change to this commit, and file history also records earlier detector work. (role: recent detector contributor; confidence: high; commits: b45a0380ccfe, e87fb1f74b48; files: src/clawsweeper-change-detection.ts)
  • Patrick Erichsen: The immediately preceding main-history feature commit introduced the SQLite/data-model warning area this PR narrows. (role: introduced adjacent data-model warning surface; confidence: medium; commits: a8b2debb75fd; files: src/clawsweeper-change-detection.ts, test/pr-surface-policy.test.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.

@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready review for exact head b45a0380ccfe72d9dd9091c6bada26bea9871cf5. I have read the published ClawSweeper review; its remaining normal maintainer-review/exact-head-check step is complete, with no contributor-facing changes requested.

The source repair, real captured-input replay, and regression coverage are verified. pnpm run build:all, node --test test/pr-surface-policy.test.ts (34/34), pnpm run format:check, pnpm run check:docs, and the compiled classifier/comment-renderer replay passed on the committed head. Fresh isolated Codex reviews before commit and on the rebased branch found no actionable findings within their P0 scope.

Exact-head CI is green, including the full pnpm check, sparse repair build smoke, and Windows launcher lane. CodeQL is green. The current ClawSweeper review and independent terminal verification found no code/security findings or rank-up actions, judged the proof sufficient, and successfully rebuilt and ran all 34 focused tests with both output assertions satisfied. Its artifact was downloaded and verified against every manifest hash.

The earlier local full-check failures remain disclosed in the PR body and independently reproduced on unchanged baseline source. The Git-pruning refspec and offline-pnpm repairs remain separate; this PR neither weakens their checks nor disables containment. Production remains +4/-1; no OpenGrep source, persistence contract, or proof-rendering behavior is changed.

One history clarification: the general persistence heuristic originated in the stored-data warning feature, commit f41ed1bc4a40. The recent SQLite warning work added the adjacent production-path predicate; it did not introduce this older generic-classifier false positive.

@steipete
steipete merged commit ff813ac into main Aug 27, 2026
18 checks passed
@steipete
steipete deleted the fix/persistence-classifier-130585 branch August 27, 2026 05:13
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: 🦞 diamond lobster Very strong PR readiness with only minor 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