chore(release): adopt Knowledge 6.1.9 and gate edge-unsafe static imports - #650
Closed
drewstone wants to merge 1 commit into
Closed
chore(release): adopt Knowledge 6.1.9 and gate edge-unsafe static imports#650drewstone wants to merge 1 commit into
drewstone wants to merge 1 commit into
Conversation
…orts `@tangle-network/agent-knowledge` is pinned at an EXACT version here and re-exported from the root barrel, so its 6.1.9 fix reaches nobody until this package republishes against it. 6.1.8 statically imported `proper-lockfile`, which pulls in `graceful-fs`, which patches Node's `fs` at module scope (`fs.close = ...`). workerd exposes those as getter-only accessors, so the assignment threw while Cloudflare ran startup validation on upload: Uncaught TypeError: Cannot set property close of #<Object> which has only a getter [code: 10021] The whole Worker is rejected. Because the root barrel is the documented home of `runToolLoop` / `streamToolLoop`, every Cloudflare product that imported the tool loop from this package was undeployable — confirmed by uploading a Worker whose only import is that barrel. `verify:package` now scans the INSTALLED `@tangle-network` tree and fails on any static import of a module that patches a Node builtin. The defect was one package away and this repo's CI could not see it: `wrangler deploy --dry-run` bundles without executing module scope, so it is structurally blind to the class. The matcher covers bound imports, bare side-effect imports, re-exports, and `require`, excludes dynamic `import()`, and self-tests those five forms before trusting a clean scan. The root barrel keeps `export * from './knowledge'`. With 6.1.9 the knowledge subtree has no module-scope side effect left, so a consumer importing only the tool loop now tree-shakes it out entirely — measured zero agent-knowledge symbols and a 782.38 kB -> 738.91 kB Worker bundle. Removing the re-export is a breaking change that buys nothing measurable.
Contributor
Author
|
Superseded by the Runtime 0.109.0 release branch. The final shipped-code scan from 2fcbed9 is integrated there unchanged, while Eval moves to 0.135.1 and Knowledge to 6.1.10. Keeping this 0.108.2 cohort would publish an outdated dependency set immediately before the intentional ./kernel release. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every Cloudflare Worker importing this package's root barrel was undeployable
graceful-fs@4.2.11patches Node'sfsat module scope. workerd exposesnode:fs'sclose/closeSyncas getter-only accessors, so the assignment throws while Cloudflare runs startup validation on upload, and the entire Worker is rejected — no request frames, nothing the app can catch:Every edge in the chain is a static top-level import:
The root barrel is the documented home of
runToolLoop/streamToolLoop, which is what a product's chat turn imports — so any Worker on0.108+importing it could not deploy. It already took one product's production deploys down.Changes
Adopt Knowledge 6.1.9 (catalog + cohort SHA). The exact pin means agent-knowledge#97 reaches nobody until this package republishes; that is the whole reason this PR exists.
verify:packagenow gates the class. It scans the INSTALLED@tangle-networktree and fails on any static import of a module that patches a Node builtin. This belongs here and not only in the package that tripped it — the defect was one package away, and this repo's CI had no way to see it. The matcher covers bound imports, bare side-effect imports (import 'proper-lockfile'), re-exports, andrequire, excludes dynamicimport(), and self-tests those five forms before trusting a clean scan.The root re-export stays — a deliberate semver call
The obvious second fix is dropping
export * from './knowledge'from the root entry, since a dedicated./knowledgesubpath already exists. I measured it instead of assuming, and it does not earn a breaking change:var import_proper_lockfile = __toESM(require_proper_lockfile())) — a bundler must keep that. With 6.1.9 the side effect is gone, and a consumer importing only the tool loop tree-shakes the subsystem out entirely: zerohashKnowledgeBase/KnowledgeIndexSchema/withKnowledgeMutation/runKnowledgeImprovementJobsymbols in the built Worker, bundle 782.38 kB -> 738.91 kB.export * from './knowledge'andsrc/candidate-execution/knowledge.ts'shashKnowledgeBase. Removing the first leaves the second.src/,tests/,docs/,scripts/verify-package-exports.mjs) or agent-knowledge's own docs. Zero external consumers — but it is still a public API removal, so it belongs in a deliberate major, not smuggled into a P0 deploy fix.Proof — the guard fails on the real regression
Same tree, only the Knowledge pin differs.
With
agent-knowledge@6.1.8(the pin before this PR):With
agent-knowledge@6.1.9:Proof — the real Worker upload
A minimal Worker whose only import is this package's root barrel, built with
@cloudflare/vite-pluginand uploaded withwrangler versions upload(same startup validation as a deploy, zero traffic).Before, on Knowledge 6.1.8:
After, on Knowledge 6.1.9:
Verification
pnpm lint— clean (502 files)pnpm typecheck— clean (src + examples)pnpm test—1856 passed | 6 skipped (1862)pnpm verify:package— passes, including the new gatelockfileModule ??= import("proper-lockfile")in runtime.js, no static import