Skip to content

refactor(hooks): consolidate validated npm archive installs - #138267

Merged
steipete merged 1 commit into
mainfrom
codex/deslop-npm-archive
Sep 4, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/deslop-npm-archive

Conversation

@steipete

@steipete steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The hook npm installer still passed through two generic archive adapters left behind after plugin installation moved to its managed npm path. The extra layers duplicated result handling and exposed unused helpers through the plugin install runtime.

Why This Change Was Made

Move the archive flow into its sole validated entry point, remove the unused adapters and runtime exports, and consolidate their tests. The existing workspace owner still finishes cleanup before the caller receives decorated results. Domain failures retain their identity and codes, and successful results retain transaction symbols and npm resolution metadata.

User Impact

No intended behavior change. Hook installation and update retain registry validation, prerelease policy, integrity checks, dry-run behavior, rollback, and temporary-workspace cleanup. Plugin managed installation, public APIs, configuration, and persistent stores are unchanged.

Evidence

  • 55 existing baseline tests and 415 final tests across 11 affected and sibling files pass.
  • Thirteen before/after capture scenarios are byte-identical, including result identity, transaction symbols, policy refusal, thrown errors, and cleanup ordering.
  • Seven actual npm/hook flows against a synthetic loopback registry match before and after, with 23 real HTTP requests per phase: install, update with rollback, dry run, integrity refusal, explicit beta, implicit prerelease refusal, and invalid-hook cleanup. Only generated temporary directory names were normalized.
  • Full changed checks and the full build pass, including declarations, 90 plugin dist trees, 53 native control-plane loads, 149 SDK exports, and UI. Independent Codex review is clean. The final rebase is patch-identical and retains the tested source and test blobs.
  • Production +115/-208, net −93; tests +327/-388, net −61; one obsolete assertion-baseline entry removed. No new dependency or compatibility layer.

Native proof used synthetic packages, an isolated npm cache/config, and a local registry; no operator state or real credentials were used.

@clawsweeper

clawsweeper Bot commented Sep 4, 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 size: XL maintainer Maintainer-authored PR labels Sep 4, 2026
@steipete
steipete marked this pull request as ready for review September 4, 2026 12:58
@steipete steipete self-assigned this Sep 4, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 4, 2026, 9:07 AM ET / 13:07 UTC.

ClawSweeper review

What this changes

The PR inlines validated npm archive installation into its sole entry point, removes the obsolete adapter module and private runtime exports, and consolidates coverage.

Merge readiness

✅ Ready for maintainer review

Keep open. No introduced correctness defect was found: the refactor preserves validation, packing, prerelease, integrity, result, and cleanup ordering while current main still retains the two adapter layers it removes.

Priority: P3
Reviewed head: 4d82488fc0de7cead26eb61c28db6e5910ba1a68

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative refactor with retained owner-boundary coverage and no actionable introduced defect found.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable under the trusted-member exemption. The PR body also describes after-fix synthetic loopback-registry hook flows, while direct source review confirms the exercised production owner remains the hook npm-install entry point.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable under the trusted-member exemption. The PR body also describes after-fix synthetic loopback-registry hook flows, while direct source review confirms the exercised production owner remains the hook npm-install entry point.
Evidence reviewed 6 items Introduced canonical flow: The introduced entry point performs the same validation, packing, prerelease, integrity, installer, and result-finalization sequence formerly split across the deleted adapter module.
Production caller and security gates: The sole production caller sends hook npm installs through the refactored entry point; archive packing remains owned by the existing helper, which invokes npm pack with --ignore-scripts.
No remaining adapter consumers: A repository-wide reference search found no remaining imports or uses of the deleted adapter exports; the retained hook runtime imports the canonical entry point directly.
Findings None None.
Security None None.

How this fits together

Hook installation validates a registry npm spec, packs it into a temporary archive, applies prerelease and integrity checks, then hands it to the hook installer. The resulting install outcome and resolution metadata feed hook installation or update after workspace cleanup.

flowchart LR
  A[Hook npm request] --> B[Registry spec validation]
  B --> C[Pack temporary archive]
  C --> D[Prerelease and integrity gates]
  D --> E[Hook archive installer]
  E --> F[Install result and metadata]
  E --> G[Temporary workspace cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -93, Tests -61, Other -1. Total -155 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 115 208 -93
Tests 2 327 388 -61
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 6 442 597 -155

Review metrics

Metric Value Why it matters
Production versus test LOC production +115/-208 (net -93); tests +327/-388 (net -61); baseline -1 The consolidation is net-negative in both production and test code while retaining focused coverage at the surviving owner boundary.

Technical review

Best possible solution:

Land the single canonical validated archive-install flow once ordinary exact-head checks complete; retain the direct hook caller and its cleanup-order coverage.

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

Not applicable: this PR refactors the existing archive-install path rather than reporting a user-facing defect.

Is this the best way to solve the issue?

Yes. Moving the duplicated flow into its sole validated entry point leaves one canonical owner and removes unused runtime exports without changing the hook caller’s contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a behavior-neutral internal cleanup with no user-facing capability or configuration change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable under the trusted-member exemption. The PR body also describes after-fix synthetic loopback-registry hook flows, while direct source review confirms the exercised production owner remains the hook npm-install entry point.

Label justifications:

  • P3: This is a behavior-neutral internal cleanup with no user-facing capability or configuration change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable under the trusted-member exemption. The PR body also describes after-fix synthetic loopback-registry hook flows, while direct source review confirms the exercised production owner remains the hook npm-install entry point.

Evidence

What I checked:

  • Introduced canonical flow: The introduced entry point performs the same validation, packing, prerelease, integrity, installer, and result-finalization sequence formerly split across the deleted adapter module. (src/infra/install-from-npm-spec.ts:56, 4d82488fc0de)
  • Production caller and security gates: The sole production caller sends hook npm installs through the refactored entry point; archive packing remains owned by the existing helper, which invokes npm pack with --ignore-scripts. (src/hooks/install.ts:740, 4d82488fc0de)
  • No remaining adapter consumers: A repository-wide reference search found no remaining imports or uses of the deleted adapter exports; the retained hook runtime imports the canonical entry point directly. (src/hooks/install.runtime.ts:5, 4d82488fc0de)
  • Current-main necessity: Current main still imports and calls the two adapter exports from the separate npm-pack-install module, so the submitted cleanup is not already implemented or superseded. (src/infra/install-from-npm-spec.ts:2, a220f55bbbe1)
  • Focused behavioral coverage: The consolidated tests cover invalid specs, pack failure, prerelease rejection, integrity acceptance/refusal, installer failures, parameter forwarding, and cleanup before exposing success, failure, or thrown outcomes. (src/infra/install-from-npm-spec.test.ts:86, 4d82488fc0de)
  • Feature-history routing: Available local history identifies the original shared hooks/plugins archive-flow refactor and repeated subsequent maintenance in this area; used for routing only because line-level historical blobs were unavailable locally. (src/infra/npm-pack-install.ts, 07888bee3484)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 28d8ebc into main Sep 4, 2026
249 checks passed
@steipete
steipete deleted the codex/deslop-npm-archive branch September 4, 2026 13:28
@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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