Skip to content

refactor(scripts): remove test-only extension package boundary helper - #129171

Merged
steipete merged 2 commits into
mainfrom
codex/cleanup20k-extension-boundary-contract-20260825
Aug 25, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/cleanup20k-extension-boundary-contract-20260825

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The plugin package-boundary checks maintained a separate 363-line executable mirror of the actual checked-in TypeScript alias configuration even though no runtime, build, package script, release workflow, or shipped command ever consumed that mirror. Its only consumer was one contract test, so adding or changing a real plugin alias required keeping an obsolete second owner synchronized.

Why This Change Was Made

Delete the unused executable mirror completely and make the existing architecture contract verify the real configuration owners directly. The test now derives private SDK aliases from the live SDK entrypoint registry, ACP declarations from the real package exports, and every xAI override from the actual shared alias map. It independently pins all eight security-sensitive omitted aliases and rejects normalized path traversal outside each declaration's originally declared safe root. It retains all exact include/exclude rules, per-plugin inheritance and SDK dependencies, xAI omissions/stubs, private-memory SDK exports, and core-isolation checks. No production replacement, public contract, release command, or package-boundary CI guard is added or changed.

User Impact

No user-visible behavior changes. Maintainers get one canonical package-boundary configuration instead of a second executable copy that existed solely for a test. Net production change: -363 lines; retained contract-test change: +95 lines, including explicit declaration-root traversal security coverage.

Evidence

  • Complete owner and caller audit proved the deleted module had exactly one test consumer and zero runtime, package, workflow, or release consumers, including historical stable-tag/package checks.
  • OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/private/tmp/openclaw-cleanup20k-lane1-vitest-cache node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package-project-boundaries.test.ts test/scripts/check-extension-package-tsc-boundary.test.ts test/scripts/prepare-extension-package-boundary-artifacts.test.ts — 49 tests passed across all three actual contract, typecheck-owner, and artifact-owner suites.
  • Concrete pre-fix red/post-fix green regression proves ../dist/../src/gateway/auth.ts and equivalent packages/extensions escapes are rejected while real declaration targets remain valid.
  • node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint — actual hosted-CI fingerprint command succeeds.
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/plugins/contracts/extension-package-project-boundaries.test.ts — clean.
  • Exact-file formatting, whitespace validation, and changed-lane routing all pass.
  • Independent pre-edit and final owner-boundary reviews accepted the change with no findings; fresh authenticated structured autoreview and full-diff secret scan both passed.
  • Hosted exact-head CI and repository-native clean-environment preparation are required before landing.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L maintainer Maintainer-authored PR labels Aug 25, 2026
@steipete
steipete marked this pull request as ready for review August 25, 2026 09:00
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 25, 2026, 5:26 AM ET / 09:26 UTC.

ClawSweeper review

What this changes

The PR deletes a test-only extension package-boundary helper and rewrites its contract test to read the live TypeScript path configuration.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open: the prior P2 remains. The replacement test accepts any contained alias and no longer enforces the complete approved alias inventory that the deleted helper supplied.

Priority: P3
Reviewed head: 94c4586de36e9448ab5b2893100e4d359b45a94a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The refactor removes redundant test-only code, but an existing boundary-contract blocker remains.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal test refactor is exempt from the external-contributor real-behavior-proof gate.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal test refactor is exempt from the external-contributor real-behavior-proof gate.
Evidence reviewed 5 items Incomplete replacement contract: The changed loop only requires each configured target to remain under dist, packages, or extensions; it does not reject a newly added but unsupported contained alias.
Removed inventory owner: The removed helper contained the complete EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS inventory, whereas the new test derives only selected private SDK and ACP entries before using generic containment.
Prior finding remains unresolved: The latest ClawSweeper review identified this same gap; the follow-up commit adds normalized traversal rejection but leaves the broad contained-target acceptance in place.
Findings 1 actionable finding [P2] Restore complete alias inventory enforcement
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package-project-boundaries.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package-project-boundaries.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129171-sWfRoS/target$ node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package
-project-boundaries.test.ts
[test] starting test/vitest/vitest.contracts-plugin.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129171-sWfRoS/target

node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package-project-boundaries.test.ts
 ✓  contracts-plugin  src/plugins/contracts/extension-package-project-boundaries.test.ts (9 tests) 70ms

 Test Files  1 passed (1)
      Tests  9 passed (9)
   Start at  09:26:53
   Duration  480ms (transform 192ms, setup 60ms, import 46ms, tests 70ms, environment 0ms)

[test] passed 1 Vitest shard in 998ms
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129171-sWfRoS/target$ node scripts/run-vitest.mjs --configLoader runner src/plugins/contracts/extension-package
-project-boundaries.test.ts
[test] starting test/vitest/vitest.contracts-plugin.config.ts
































Assertions:

  • PASS expect_output: Test Files

How this fits together

Extension package-boundary checks restrict which declaration surfaces bundled plugins can compile against. Shared alias configuration feeds extension TypeScript projects and CI’s package-boundary compiler check.

flowchart LR
  A[Package metadata] --> C[Boundary contract test]
  B[Shared alias configuration] --> C
  C --> D[Extension TypeScript projects]
  C --> E[Allowed declarations]
  C --> F[Rejected boundary escapes]
  F --> G[CI compiler check]
Loading

Before merge

  • Restore complete alias inventory enforcement (P2) - The new loop at lines 204-209 accepts any alias whose target stays under one of three roots. The deleted helper compared the shared map with a complete boundary inventory, so an unsupported internal declaration alias can now be added and resolved by extension compilation without failing this contract. Derive the full map from authoritative metadata or retain an owner-owned expected inventory.

Findings

  • [P2] Restore complete alias inventory enforcement — src/plugins/contracts/extension-package-project-boundaries.test.ts:204-208
Agent review details

Security

None.

PR surface

Tests +95, Other -363. Total -268 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 130 35 +95
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 363 -363
Total 2 130 398 -268

Review metrics

Metric Value Why it matters
Production versus test LOC production 0; test-support -363; tests +130/-35 (net +95) The deleted executable helper was test-only, so the replacement test must preserve the full contract rather than only root containment.

Stored data model

Persistent data-model change detected: serialized state: scripts/lib/extension-package-boundary.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain a complete owner-derived allowed alias inventory and add a regression proving an undeclared but contained alias fails while every declared alias remains valid.

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

Yes, source-reproducible: an extra alias rooted under ../dist satisfies the changed generic containment loop, despite not being in the former approved inventory.

Is this the best way to solve the issue?

No: normalized traversal rejection is useful, but it does not restore the exact alias-inventory protection removed with the helper.

Full review comments:

  • [P2] Restore complete alias inventory enforcement — src/plugins/contracts/extension-package-project-boundaries.test.ts:204-208
    The new loop at lines 204-209 accepts any alias whose target stays under one of three roots. The deleted helper compared the shared map with a complete boundary inventory, so an unsupported internal declaration alias can now be added and resolved by extension compilation without failing this contract. Derive the full map from authoritative metadata or retain an owner-owned expected inventory.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is internal package-boundary test maintenance with no direct user-visible behavior change.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored internal test refactor is exempt from the external-contributor real-behavior-proof gate.

Label justifications:

  • P3: This is internal package-boundary test maintenance with no direct user-visible behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored internal test refactor is exempt from the external-contributor real-behavior-proof gate.

Evidence

What I checked:

Likely related people:

  • steipete: Has 43 commits in the boundary-test history, including the shared-boundary refactor and the current follow-up. (role: recent boundary owner; confidence: high; commits: 568ea29d2e04, 2229122077e9, 94c4586de36e; files: src/plugins/contracts/extension-package-project-boundaries.test.ts, scripts/lib/extension-package-boundary.ts)
  • Vincent Koc: Contributed 13 commits to the contract-test history and authored earlier boundary inventory and filesystem-safety work. (role: historical boundary-test contributor; confidence: high; commits: 1604b4a3040c, 29732c1459a9, 72581fbb48ff; files: src/plugins/contracts/extension-package-project-boundaries.test.ts, scripts/lib/extension-package-boundary.ts)

Rank-up moves

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

  • Restore complete allowed-alias enforcement and show an undeclared contained alias fails.
  • Rerun the focused boundary-contract test and exact-head CI after the repair.

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-25T08:54:58.186Z sha 342ef60 :: found issues before merge. :: [P2] Preserve complete shared-alias boundary enforcement

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@steipete
steipete merged commit 2907a16 into main Aug 25, 2026
242 checks passed
@steipete
steipete deleted the codex/cleanup20k-extension-boundary-contract-20260825 branch August 25, 2026 10:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…openclaw#129171)

* refactor(scripts): remove test-only extension package boundary helper

* test(plugins): preserve exact extension boundary containment
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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: L status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant