Skip to content

refactor: compact database-first legacy store analyzer - #117347

Merged
steipete merged 1 commit into
mainfrom
codex/goal100k-database-guard-compact-0801-2d45
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/goal100k-database-guard-compact-0801-2d45

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The database-first legacy-store guard had grown two overlapping abstract interpreters for the same wrapper, scope, and path-flow rules. That duplication made security-sensitive cleanup difficult to reason about and kept more than 3,000 lines of parallel policy alive.

Why This Change Was Made

This consolidates wrapper execution into the guard's canonical lexical/branch fact engine and removes the duplicate wrapper-only interpreter. The unified evaluator preserves captured lexical environments, parameter/default/destructuring behavior, computed properties, callable/object facts, branch effects, and statically resolvable spread/transparent argument forwarding. Bounded candidate sets widen conservatively instead of discarding dangerous facts.

Architectural owner: scripts/check-database-first-legacy-stores.mjs. Removed path: the duplicate wrapper summary/interpreter stack. No config, schema, runtime storage, protocol, dependency, or public API changes.

User Impact

No runtime user-visible behavior changes. Maintainers get one smaller canonical guard implementation with stronger adversarial coverage and the same diagnostics across the current runtime corpus.

Production LOC: +797/-3860, net -3063. Tests: +412.

Evidence

  • Exact reviewed head: 16cbea99dc0c06f3433bf1874c7d5031622ac49e.
  • Focused guard suite on that head: 535/535 passed.
  • Exact old/new differential on that head: 12,790 runtime files, 0 diagnostic differences, 0 crashes, 0 violations.
  • Standalone local guard: passed.
  • Blacksmith Testbox database-first guard: passed (tbx_01kyyc4q57ze19adphjtk4yvfv, run).
  • Blacksmith Testbox changed gate: passed (tbx_01kyyc7zc5xs1tn8nyzrf9b369, run); includes formatting, test-root typecheck, script lint, declaration contracts, and tooling guards.
  • Independent xhigh security review: unconditional clear across computed keys, nested maps, spread/transparent forwarding, defaults, candidate caps, scope lifecycle, and safe controls.
  • Fresh gpt-5.6-sol xhigh autoreview over the 218,960-byte local patch: clean, no accepted/actionable findings.
  • git diff --check and node --check scripts/check-database-first-legacy-stores.mjs: passed.

Current Main Integration

The touched-path intersection between this branch and current main is empty for both changed files. Per repository policy, moving-main drift without touched-path overlap is advisory rather than a reason to rewrite a conflict-free reviewed head. A refresh was therefore intentionally skipped: it would invalidate the exact reviewed SHA without changing this patch. Ready-state hosted CI validates the GitHub merge result against current main; the focused suite and 12,790-file diagnostic differential above remain attached to the exact reviewed head.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@steipete
steipete marked this pull request as ready for review August 1, 2026 10:21
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 6:58 AM ET / 10:58 UTC.

ClawSweeper review

What this changes

This PR replaces the database-first legacy-store analyzer’s duplicate wrapper-only interpreter with its canonical lexical fact evaluator and adds regression coverage for computed properties, argument forwarding, bounded facts, and parameter defaults.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No concrete patch defect was found in this focused guard refactor, and its supplied terminal/Testbox evidence is appropriate for static-analysis behavior. Keep this PR open for human merge handling: it carries the protected maintainer label, while the supplied CI digest includes an unexplained failed compact shard that could not be inspected because GitHub networking was unavailable. Likely related people: joshavant (current-main guard originator; medium confidence).

Priority: P3
Reviewed head: 16cbea99dc0c06f3433bf1874c7d5031622ac49e
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is focused and well evidenced; the protected-label decision and unexplained supplied CI failure remain for maintainer handling.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body provides suitable after-change terminal evidence for an internal analyzer: focused guard results, a 12,790-file zero-diagnostic differential, a standalone guard run, and hosted Testbox checks.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides suitable after-change terminal evidence for an internal analyzer: focused guard results, a 12,790-file zero-diagnostic differential, a standalone guard run, and hosted Testbox checks.
Evidence reviewed 6 items Current-main integration: Neither changed path drifted from the PR merge base to current main, so the behind-main state is unrelated to this refactor’s two files.
Guard integration: The analyzer is part of check:architecture, has its own package command, runs from the standard check runner, and is scheduled by changed-file lane selection.
Patch and regression scope: The one-commit branch changes only the analyzer and its direct suite; it preserves the exported guard APIs and adds 412 focused test lines beginning with computed-property wrapper cases.
Findings None None.
Security None None.

How this fits together

The database-first legacy-store analyzer is a static repository guard that scans OpenClaw runtime source for forbidden legacy file-store behavior. It turns lexical and wrapper-call facts into diagnostics consumed by repository checks that enforce SQLite-first state ownership.

flowchart LR
  A[Runtime source files] --> B[Legacy-store analyzer]
  B --> C[Lexical and branch facts]
  C --> D[Wrapper call evaluation]
  D --> E[Diagnostics]
  E --> F[Repository guard checks]
Loading

Decision needed

Question Recommendation
After the failed compact CI shard is explained or rerun against the clean merge result, should this protected analyzer refactor merge? Verify then merge: Inspect or rerun the failed compact shard on the merge result and merge once it passes or is shown unrelated to the analyzer changes.

Why: The maintainer label reserves the final action for a human, and unavailable GitHub logs prevent the review from safely classifying the supplied failed shard.

Before merge

  • Resolve merge risk (P1) - The supplied check digest reports checks-node-compact-small-2 and openclaw/ci-gate as failed; the failure log was unavailable, so merge should wait for confirmation that it is unrelated or for a successful rerun on the merge result.
  • Resolve merge risk (P1) - The protected maintainer label requires explicit human handling even though no code-review finding was established.
Agent review details

Security

None.

PR surface

Tests +412, Other -3063. Total -2651 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 412 0 +412
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 797 3860 -3063
Total 2 1209 3860 -2651

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: test/scripts/check-database-first-legacy-stores.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate the required guard check (recommended)
    Inspect or rerun the failed compact CI shard before merge because a regression in this static guard could weaken database-first enforcement.
  2. Accept the existing differential evidence
    A maintainer may accept the supplied zero-diagnostic differential after confirming the failed shard is unrelated to this analyzer refactor.

Technical review

Best possible solution:

Keep one canonical lexical evaluator, verify the failed compact CI result on the clean merge result, then merge if that check passes or is confirmed unrelated to this refactor.

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

Yes, at source level: the focused guard suite and the PR’s stated whole-corpus diagnostic differential give a direct verification path, although this read-only review did not execute them.

Is this the best way to solve the issue?

Yes, provisionally: eliminating the duplicate wrapper-only interpreter in favor of the existing lexical evaluator is the narrower maintainable ownership boundary, and the new cases cover the added propagation rules.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is an internal repository-guard refactor with no claimed runtime user-visible behavior change.
  • merge-risk: 🚨 other: A false-negative regression in this analyzer could weaken the repository’s database-first storage-policy enforcement.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides suitable after-change terminal evidence for an internal analyzer: focused guard results, a 12,790-file zero-diagnostic differential, a standalone guard run, and hosted Testbox checks.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides suitable after-change terminal evidence for an internal analyzer: focused guard results, a 12,790-file zero-diagnostic differential, a standalone guard run, and hosted Testbox checks.

Evidence

What I checked:

Likely related people:

  • joshavant: The locally available current-main history and blame identify this contributor as the source author for the active analyzer entry point and its test harness. (role: recent area contributor; confidence: medium; commits: 97f8f25f0b9a; files: scripts/check-database-first-legacy-stores.mjs, test/scripts/check-database-first-legacy-stores.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Inspect or rerun checks-node-compact-small-2 on the clean merge result.
  • Make the final protected-label merge decision after that CI result is understood.

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 (1 earlier review cycle)
  • reviewed 2026-08-01T10:21:35.891Z sha 16cbea9 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 142ad75 into main Aug 1, 2026
289 of 306 checks passed
@steipete
steipete deleted the codex/goal100k-database-guard-compact-0801-2d45 branch August 1, 2026 12:07
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL 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