Skip to content

refactor(test): consolidate script declaration contracts#100992

Merged
RomneyDa merged 1 commit into
mainfrom
refactor/script-declaration-contracts
Jul 6, 2026
Merged

refactor(test): consolidate script declaration contracts#100992
RomneyDa merged 1 commit into
mainfrom
refactor/script-declaration-contracts

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Jul 6, 2026

Copy link
Copy Markdown
Member

Related: #100977

What Problem This Solves

Script tests currently maintain shadow interfaces for internal .mjs helpers because the adjacent .d.mts companions omit live exports. Those parallel contracts drift independently, require unsafe casts, and make script/test changes harder to review safely.

Why This Change Was Made

Make the four affected script declaration companions the canonical owners for every live export used by TypeScript consumers. Tests now import those contracts directly, the stale ambient ci-changed-scope declaration is removed, and shared Vitest config reuses the scheduling module's exported types. Runtime implementations and behavior are unchanged.

User Impact

No user-visible behavior changes. Maintainers get one authoritative script contract per module, fewer unsafe casts, and compile-time detection when script exports and TypeScript consumers diverge.

Evidence

  • Blacksmith Testbox tbx_01kww0qbaeqcj0p2442c84dj68: focused script validation passed 314 tests total across src/scripts/test-projects.test.ts, src/scripts/docs-link-audit.test.ts, src/scripts/ci-changed-scope.test.ts, test/scripts/test-projects.test.ts, and test/scripts/vitest-local-scheduling.test.ts.
  • Blacksmith Testbox tbx_01kww0qbaeqcj0p2442c84dj68: env OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 corepack pnpm check:changed passed all selected typecheck, lint, and guard lanes.
  • Blacksmith Testbox tbx_01kww0qbaeqcj0p2442c84dj68: corepack pnpm exec oxfmt --check --threads=1 passed for all eight changed files.
  • .agents/skills/autoreview/scripts/autoreview --mode local --prompt-file tmp/review-context.md --stream-engine-output: clean after resolving one accepted helper-input typing finding.
  • git diff --check: passed.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: M maintainer Maintainer-authored PR labels Jul 6, 2026
@RomneyDa

RomneyDa commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@RomneyDa

RomneyDa commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 12:46 PM ET / 16:46 UTC.

Summary
The PR expands script .d.mts declaration companions, removes the stale ambient ci-changed-scope declaration, and updates script tests plus shared Vitest config to import the canonical script contracts directly.

PR surface: Source -16, Tests -170, Other +152. Total -34 across 8 files.

Reproducibility: not applicable. as a bug reproduction: this PR is an internal cleanup. Source inspection does show current main still has the duplicated test-local script interfaces that the PR removes.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #100977
Summary: This PR is the script-declaration implementation slice for the Wave 1 internal type-contract umbrella; sibling open PRs cover the plugin-registry and gateway-client slices.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦞 diamond lobster
Proof: 🌊 off-meta tidepool
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Next step before merge

  • No automated repair is needed; this protected maintainer PR just needs ordinary maintainer review and merge sequencing with the Wave 1 umbrella.

Security
Cleared: The diff changes internal declarations and tests only, with no dependency, workflow, secrets, lockfile, package, or runtime code-execution surface introduced.

Review details

Best possible solution:

Land this PR after normal maintainer review if the exact-head checks remain green, keeping the adjacent .d.mts companions as the canonical TypeScript contracts for these internal script modules.

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

Not applicable as a bug reproduction: this PR is an internal cleanup. Source inspection does show current main still has the duplicated test-local script interfaces that the PR removes.

Is this the best way to solve the issue?

Yes. The PR uses the narrowest maintainable owner boundary by moving TypeScript consumers to the adjacent script declaration companions instead of preserving casts, central ambient declarations, or another parallel type layer.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P3: This is a low-risk internal test/script maintainability refactor with no user-facing behavior change.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored internal test/script refactor; the external contributor real-behavior proof gate does not apply, and the PR body includes Testbox/check validation.

Label justifications:

  • P3: This is a low-risk internal test/script maintainability refactor with no user-facing behavior change.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Maintainer-authored internal test/script refactor; the external contributor real-behavior proof gate does not apply, and the PR body includes Testbox/check validation.
Evidence reviewed

PR surface:

Source -16, Tests -170, Other +152. Total -34 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 16 -16
Tests 4 10 180 -170
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 164 12 +152
Total 8 174 208 -34

What I checked:

  • Repository policy read: Read root AGENTS.md fully plus scoped scripts/AGENTS.md and test/AGENTS.md; the applicable guidance favors canonical contracts, bounded refactors, wrapper-aware script changes, and no findings for policy-only concerns without concrete behavior risk. (AGENTS.md:1, 6b99fd9a94ce)
  • Current-main duplication: Current main has test-local shadow interfaces around test-projects.test-support.mjs imports, matching the PR's stated cleanup target. (src/scripts/test-projects.test.ts:8, 6b99fd9a94ce)
  • PR declaration contract: At the PR head, scripts/test-projects.test-support.d.mts declares the additional live exports consumed by the tests, including full-suite planning, concurrency, cache-path, retry, lock, and failed-shard helpers. (scripts/test-projects.test-support.d.mts:44, 6f480b0f05ac)
  • Runtime export check: The unchanged implementation exports the functions added to the declaration companion, so the PR is moving the contract to the adjacent declaration rather than adding runtime behavior. (scripts/test-projects.test-support.mjs:4125, 6b99fd9a94ce)
  • Related umbrella: The related maintainer issue remains open and tracks this PR as one slice of the Wave 1 internal type-contract consolidation; sibling open PRs cover plugin registry and gateway client slices.
  • Validation and status: Live PR metadata shows the PR is mergeable/clean and the body reports focused Testbox validation, changed checks, oxfmt, autoreview, and git diff --check; status rollup showed relevant CI/check lanes succeeding at the reviewed head. (6f480b0f05ac)

Likely related people:

  • RomneyDa: RomneyDa authored the Wave 1 umbrella issue and this script-contract implementation slice, and also owns the sibling implementation PRs found for the same umbrella. (role: active implementation owner; confidence: high; commits: 6f480b0f05ac, 38c1139308b1, 9629dafc5767; files: scripts/ci-changed-scope.d.mts, scripts/docs-link-audit.d.mts, scripts/test-projects.test-support.d.mts)
  • shakkernerd: GitHub commit metadata and blame tie the current-main script declaration companions to commit ece23c4d3dfa, making this person useful context for the current declaration surface. (role: current declaration companion introducer; confidence: medium; commits: ece23c4d3dfa; files: scripts/ci-changed-scope.d.mts, scripts/docs-link-audit.d.mts, scripts/test-projects.test-support.d.mts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 6, 2026
@RomneyDa
RomneyDa merged commit d2e6ccf into main Jul 6, 2026
143 of 148 checks passed
@RomneyDa
RomneyDa deleted the refactor/script-declaration-contracts branch July 6, 2026 17:26
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 7, 2026
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: M 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