Repository navigation
refactor(plugins): derive private config types from schemas - #130414
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:03 PM ET / August 27, 2026, 00:03 UTC. ClawSweeper reviewWhat this changesThis PR derives Diffs’ private config input from its Zod schema, removes redundant parsed-value casts in OpenShell and MXC, and makes a Linux file-transfer binding test deterministic. Merge readinessKeep open. Current main still contains the duplicated private config types and casts, while this member-authored, maintainer-labeled PR removes them without changing the resolved runtime shapes; exact-head hosted checks are still incomplete. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherBundled plugins validate operator configuration with schemas before resolving the values consumed by their runtime hooks. The file-transfer node worker binds a directory as its working directory before it enumerates entries, and the accompanying test verifies that a symlink retarget cannot redirect that enumeration. flowchart LR
A[Plugin configuration] --> B[Plugin schema]
B --> C[Validated configuration]
C --> D[Resolved plugin settings]
D --> E[Plugin runtime]
F[Approved directory] --> G[Bound directory worker]
G --> H[Directory entries]
I[Symlink retarget test] --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -57, Tests +5, Other -2. Total -54 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the schema-owned private typing and deterministic binding regression coverage, then merge after the current head passes its required hosted checks. Do we have a high-confidence way to reproduce the issue? Not applicable to the central private-type cleanup. The accompanying Linux test race has a source-backed deterministic replacement and supplied hosted-run evidence, but this read-only checkout has no installed dependencies to rerun it locally. Is this the best way to solve the issue? Yes. Deriving private input types from the existing schema and using parsed values directly removes duplicated declarations without adding a public configuration or compatibility surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cb1d892b3d9a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Replace race-prone child-cwd polling with a synchronous fixture retarget after the real chdir, preserving the full worker and security assertions. Shrink the assertion-safety baseline for the three casts removed by the schema cleanup.
1ece994 to
7e280b0
Compare
|
Merged via squash.
|
…#130414) * refactor(plugins): derive private config types from schemas * test(ci): make directory binding proof deterministic Replace race-prone child-cwd polling with a synchronous fixture retarget after the real chdir, preserving the full worker and security assertions. Shrink the assertion-safety baseline for the three casts removed by the schema cleanup.
What Problem This Solves
Maintainer-requested cleanup of duplicate private configuration types in the Diffs, OpenShell, and MXC plugins. Hand-maintained input shapes repeat information already owned by the runtime schemas, while assertions hide the schemas' inferred result types.
Why This Change Was Made
Diffs derives its private input shape from the existing Zod schema. OpenShell and MXC use their already-validated parse results directly and delete the unused private type copies. Runtime schema definitions, defaults, legacy aliases, normalization, permissions, manifests, and exported resolved types are unchanged. The assertion-safety baseline shrinks by exactly the three removed casts.
The first hosted CI run also exposed a pre-existing timing-dependent file-transfer test. Its parent process tried to observe a short-lived child's working directory through 200 polling attempts and 5,000 padding files. The assertion failed before the test retargeted the symlink; it did not observe an unsafe directory listing. The repaired test preserves the entire real worker program, prefixes a child-local wrapper that performs the real
chdirand then retargets the fixture symlink synchronously, and checks the actual retarget plus the approved-only listing. All canonical-path, inode, enumeration, and metadata checks still execute unchanged. The child is joined and cleaned up before fixture removal.Test provenance: the polling-based regression was introduced in #129762, authored and merged by @joshavant on August 26, 2026 (
424521a3d3924c943f441da1b799f3563450662f). The regression's security invariant is retained; only its race-prone scheduling is replaced.The separate Windows packaging failure was already fixed by #130387. This branch was rebased onto a main revision containing that fix; no duplicate packaging repair is included.
Production: +4/-61, net -57 lines. Test-only CI repair: +35/-30, net +5. Assertion baseline: +1/-3, net -2, excluded from production. No generated, lockfile, dependency, or documentation changes. Exported input types in other plugins were explicitly excluded because stricter consumer compiler settings could make their optional-property contract observable.
User Impact
No user-visible or public API change. Operators retain the exact same accepted configuration, errors, defaults, and security settings. This is AI-assisted internal maintenance.
Evidence
strictandexactOptionalPropertyTypesenabled. Declaration sizes are 1,144 / 645 / 726 bytes respectively; emission diagnostics are zero.tbx_01m106s7cymkmzcevn49bhc1xf, wrapper terminal exit 0. Six focused files passed all 88 assertions, including both Linux-only directory-binding cases and directory-fetch/invocation-policy siblings.02a60e0d871480b7c9db87cb59eec5583e2ec3ce, candidate treeb12a89187f9a7b241ba47861f30d3f5470293144, full five-file patch SHA-25609b1690fc0dc475ea145217c87b952b74b714c1286779e691dc604ca310f1b46. The canonical complete dependency fingerprint matched the hydrated install, all workspace package source trees matched, and all 772 actual Vitest workspace/SDK aliases resolved into the owned candidate. The temporary remote worktree was removed and the lease stopped after success.git diff --checkpass.7e280b0d1264d420f0bb01f4eb39670356406802preserves the reviewed full candidate tree exactly. A separate authenticated read-only Codex review of that published head also finished successfully with no findings (confidence 0.98), covering the complete five-file patch, 26 whole context files, and both actual Linux proof datasets. Source identity remained unchanged after review exit.7e280b0d1264d420f0bb01f4eb39670356406802, including both Windows test lanes, all three changed-plugin configuration lanes, assertion-baseline ratchets, production/test types, lint, dependencies, package boundaries, andopenclaw/ci-gate.Focused command:
OPENCLAW_VITEST_MAX_WORKERS=3 node scripts/run-vitest.mjs extensions/diffs/src/config.test.ts extensions/openshell/src/config.test.ts extensions/mxc/test/config.test.ts extensions/file-transfer/src/node-host/dir-list.test.ts extensions/file-transfer/src/node-host/dir-fetch.test.ts extensions/file-transfer/src/shared/node-invoke-policy.dir-list.test.ts. Ratchet command:node --import tsx scripts/check-assertion-safety-ratchet.mts --base 02a60e0d871480b7c9db87cb59eec5583e2ec3ce.ClawSweeper's earlier replay showed all 33 + 18 + 8 configuration tests passing, but its output matcher incorrectly expected one aggregate
59 passedline. The repository wrapper prints per-shard totals and a final shard summary. No test output was rewritten to satisfy that matcher. Its rank-up request to investigate the failed Windows and changed-extension jobs is addressed by the canonical Windows fix and deterministic test repair above; the new exact-head normal CI must still be green before native preparation and merge.Local shared dependency drift previously prevented full declaration preparation; no local dependency reconciliation was performed. Clean installed hosted lint/type gates remain required. No new live-provider behavior or package boundary is introduced, and emitted runtime code and public declarations are unchanged.
Latest ClawSweeper review (August 27, 00:03 UTC) reviewed this exact head and found no actionable patch or security findings; its rank-up request to finish exact-head hosted CI is now satisfied by the successful run above. Its newer live replay printed all 73 assertions passing across four files and a final successful three-shard summary in 31.93 seconds, but its terminal harness had a 30-second wait and expected an individual test name not printed by the normal reporter. The independent 88-assertion Linux run and exact-head hosted CI provide completed proof; no output, timeout, or assertion was altered for that replay. Its generic stored-data warning points only to test-fixture serialization in
dir-list.test.ts: no production persistence, schema, migration, or upgrade contract changed.