Repository navigation
refactor(core): consolidate coercion, hashing, and env readers - #1391
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 3, 2026, 10:28 PM ET / September 4, 2026, 02:28 UTC. ClawSweeper reviewWhat this changesThe branch replaces duplicated validation, SHA-256, environment-reading, and regex-escaping helpers with shared modules across ClawSweeper’s review and repair code. Merge readiness✅ Ready for maintainer review Keep this PR open for normal maintainer landing: the prior proof blocker is resolved by exact-head production command-chain evidence, and this remains a meaningful unmerged internal refactor with no actionable correctness or security finding. Priority: P3 Review scores
Verification
How this fits togetherClawSweeper review and repair entrypoints parse untrusted data and environment settings, create decisions and artifacts, then publish or apply automation outcomes. This refactor centralizes low-level validation and hashing behavior used along those paths. flowchart LR
A[GitHub data and environment] --> B[Review and repair entrypoints]
B --> C[Shared validation and hashing helpers]
C --> D[Decision and artifact processing]
D --> E[Publication and apply outcomes]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Land the consolidated helpers with the existing exact-head command-chain proof and preserve the distinct validation contracts that were intentionally left local. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and the supplied exact-head harness reports the after-change production command chain succeeding. Is this the best way to solve the issue? Yes. Reusing narrowly equivalent shared helpers while retaining intentionally distinct contracts is the maintainable way to reduce duplicated implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b3d726c36b69. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
c2c0be6 to
738beb5
Compare
|
@clawsweeper re-review Current-head real behavior proof from the automerge e2e harness (run 33827474822) is now cited in the PR body, covering the repair entrypoints that consume the consolidated modules. Head unchanged. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Landing: CI green on exact head 738beb5 (rebased onto main), fresh ClawSweeper review reports no findings and no before-merge items; real behavior proof from the automerge e2e harness (run 33827474822) is cited in the body. Behavior-neutral consolidation of 55 helper copies, production -181 LOC. |
What Problem This Solves
Value guards, hashes, environment reads, and regex escaping were repeated across the review and repair lanes. This change consolidates 55 local helper implementations while preserving their accepted inputs, fallback values, whitespace handling, and error messages.
Why This Change Was Made
value-coerce.tsowns the matching record, scalar-validation, and error-text contracts.content-hash.tsreplaces all nine local SHA-256 wrappers,required-env.tsreplaces the three matching trimming readers, and the string-only regex escaping copies use the existing text module. The repair compiler allowlist includes the shared modules.The inventory covered all 149 declarations of the 25 requested names under
src/**. Different integer, timestamp, string, array, and loosely typed contracts remain separate. NoparseArgscopy matchesrepair/lib.ts: the main parser rewrites flag names and the other repair parsers have distinct option schemas. Source-loaded admission, ETag, telemetry, and coverage-manifest modules stay self-contained so direct TypeScript consumers keep working without compiler or workflow changes.User Impact
Behavior-neutral; no runtime contract, config, or workflow change. No dependency or environment-variable additions.
Evidence
The
pr-behavior-proofcontract for this behavior-neutral refactor is the fullpnpm run checkrun plus the targeted suites, as specified by the work order.pnpm run build:all,pnpm run format, the test commands below, andpnpm run check./tmp/deslop-helpers-check.log,/tmp/deslop-helpers-focused.log,/tmp/deslop-helpers-equivalence.log, and/tmp/autoreview-deslop-helpers.md; exhaustive declaration inventory at/tmp/deslop-helpers-inventory.md.Independent Codex review: scoped-clean at P1, with no accepted/actionable findings. Review base pinned to the branch merge base (
72041f31e1d34cff19f50da4b23c4a22a78c828a) afterorigin/mainadvanced during validation; this keeps unrelated upstream work out of the local candidate review.OpenClaw Bay not affected: no dashboard changes.
src/**)Update after ClawSweeper review (head 738beb5, rebased onto main; unchanged content)
Real behavior proof (production command-chain harness, current head): the documented automerge e2e harness (
docs/repair/automerge-e2e.md,--scenario all) ran on this exact head in CI: https://github.com/openclaw/clawsweeper/actions/runs/33827474822 (jobproduction automerge flow, success, all scenarios across both fixtures). It runs the compiled repair entrypoints that consume the consolidated modules (validate-job,run-worker,review-results,execute-fix-artifact, report-only publication,apply-result,post-flight, and the comment router), so the sharedvalue-coerce,content-hash, andrequired-envmodules are exercised on real Git, real compiled CLIs, and real artifact handoff. GitHub and Codex are the harness's simulators. Review-lane entrypoints (clawsweeper-runtime, structural cache, decision packets) are covered by the fullpnpm run checksuite on this head plus the 1,192-case equivalence comparison recorded above.Rebase note: the only conflict with
mainwas the import block insrc/github-etag-read-broker.tsafter the ETag body cap landed; resolved by keepingGITHUB_ETAG_CACHE_MAX_BODY_BYTESand importingsha256fromcontent-hash. Fullpnpm run checkre-run locally on the rebased head passed (one unrelatedtarget-validationfixture timed out once under machine load and passed on rerun; that test is untouched by this PR).