Repository navigation
refactor: own stringOrUndefined helpers in value-coerce - #1782
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR consolidates two string-validation helpers in the shared value-coercion module and removes their dependency-injection wiring. Review scores
ProductKind: Refactor · Worth it: Yes Merge readiness✅ Ready for maintainer review Keep open: this useful, behavior-preserving cleanup remains absent from current main. No actionable patch defect was found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherClawSweeper interprets GitHub metadata while preparing reviews, checking freshness, and publishing results. These helpers preserve the different whitespace rules used by runtime processing and the review cache. flowchart TD
A[GitHub metadata] --> B[Shared string helpers]
B --> C[Runtime rejects blank strings]
B --> D[Review cache accepts any string]
C --> E[Review preparation and freshness checks]
D --> F[Cache identity]
E --> G[Review results]
F --> G
Technical reviewBest possible solution: Keep one shared implementation for each distinct string contract while preserving every consumer's existing whitespace behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR proposes a refactor rather than repairing a reported runtime failure. Is this the best way to solve the issue? Yes: direct imports from the established shared owner remove redundant wiring while preserving both distinct contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cf34fa9269dc. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)Reviewed October 9, 2026, 2:45 AM ET / 06:45 UTC (Revision 4). |
da72174 to
5d8f848
Compare
|
@clawsweeper re-review |
5d8f848 to
97f43d0
Compare
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
97f43d0 to
7db6ecd
Compare
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
7db6ecd to
2cec5fd
Compare
|
🦞👀 Re-review progress:
|
What
src/value-coerce.tsnow owns two string helpers:stringOrUndefined(value): the string, orundefinedwhen the value is not a string.nonBlankStringOrUndefined(value): the string, unchanged, when it has non-whitespace text; elseundefined.nonBlankStringOrUndefined.review-structural-cache.tsimports the plainstringOrUndefinedand drops its local copy. Behavior stays the same at every call site.stringOrUndefinedis removed from every dependency interface andPicklist (6*-dependencies.tsfiles, theapply-source-freshnessPick, and 6 localcreate*dependency types), every consumer destructure, all 12 wiring lines inclawsweeper-runtime.ts, and the runtime local definition.stringOrUndefinedare removed.test/primary-body-fixture.tsimports the plain helper fromdist/value-coerce.jsfor itspullHeadShaFromContextstub.Naming: the maintainer plan suggested
trimmedStringOrUndefinedfor the runtime variant. That helper does not trim its result. It only rejects blank strings and returns the value as it is (callers such as?.trim().toLowerCase()still trim themselves).trimmedStringOrUndefinedwould suggest a trimmed return value, so this PR usesnonBlankStringOrUndefined.Why
SlopHelpers report, finding 1:
stringOrUndefinedhad two definitions with different behavior.clawsweeper-runtime.tsreturnedundefinedfor" ", andreview-structural-cache.tsreturned" ". The runtime one was a pure function that went through 13 dependency types and 12 runtime wiring lines, so it was a seam with nothing to vary. One owner, with an explicit name for each behavior, removes the divergence and the plumbing.Proof
pnpm run check: static checks,build:all,lint, and changed-coverage passed. Full coverage run: 6947 pass, 1 fail. The failure wastest/repair/command-proof-consumer.test.ts"compiled Telegram consumer …", which hit its 180 s timeout under full-suite load. Alone on this branch it passes in 15 s. It is repair-lane code with nostringOrUndefinedreference.node scripts/e2e/review-pinned-base.mjspasses both scenarios.scripts/e2e/ci-comment-read-budget.mjsruns insidetest/context.test.tsand passes.stringOrUndefined-family definitions in src/test/scripts: 3 (2 divergent in src + 1 test copy) → 2, both invalue-coerce.ts(plain +nonBlankvariant)stringOrUndefined: (value: unknown) …plus| "stringOrUndefined"): 13 → 0stringOrUndefined,inclawsweeper-runtime.ts): 12 → 0\bstringOrUndefined\btokens in src: 168 → 36 (all inreview-structural-cache.tsandvalue-coerce.ts)render-comments.mjswith main dist (552822607) and branch dist over 21 saved real reports in 16 directories (prompt-rest,prompt-lean,prompt-dumpand theircodex/subdirectories,async-proof/{base,branch},retire-proof/166090, and/tmp/rules-slice/{reports,reports-leased,run-144991,run-144991/codex,run-167362,run-167362/codex,run-167362/codex/proof-scratch/167362}). All 16 outputs are byte-identical (same sha256), with 0 render failures.Codex review dispositions
codex review --base main: no findings. Codex reported that the shared helpers keep both original behaviors and that callers and interfaces are consistent.Merge Danger
docs/proof/*/run-proof.mjsscripts still pass astringOrUndefinedstub. They are frozen proof records, so they are not changed. The extra property has no effect. Parallel PRs that edit the same dependency interfaces orclawsweeper-runtime.tscan get one-line, adjacent-line conflicts.