Conversation
Encodes hard-won lessons from repeated Turbopack deploy failures caused by misconfigured npm package exports (raw .ts in exports, missing dist in files, barrel re-export chains pulling unresolvable transitive deps). Catches: exports → .ts source, missing dist in files, file: deps, barrel chains with heavy deps, missing subpath exports for zero-dep utility modules, and missing bundler build steps in CI. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ddc6d700c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -0,0 +1,25 @@ | |||
| { | |||
| "id": "npm-package-bundler-guard", | |||
| "intent": "npm-package-compat", | |||
There was a problem hiding this comment.
Register new persona intent in router wiring
Adding this intent in JSON alone does not make the persona usable: there are no other references to npm-package-compat/npm-package-bundler-guard in the repo, packages/workload-router/scripts/generate-personas.mjs only emits personas present in exportNameMap (this id is missing there, so generation skips it), and packages/workload-router/src/index.ts does not include this intent in PERSONA_INTENTS or personaCatalog. In practice, resolvePersona can never select this persona, so this commit is a functional no-op.
Useful? React with 👍 / 👎.
Encodes hard-won lessons from repeated Turbopack deploy failures caused by misconfigured npm package exports (raw .ts in exports, missing dist in files, barrel re-export chains pulling unresolvable transitive deps). Registers the persona across all four integration points: - personas/npm-package-bundler-guard.json (definition) - generate-personas.mjs exportNameMap - PERSONA_INTENTS + personaCatalog in index.ts - default routing profile (best-value tier) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| "npm-package-compat": { | ||
| "tier": "best-value", | ||
| "rationale": "Package.json audits are mostly mechanical checks against known rules; best-value provides sufficient reasoning for catching misconfigurations." | ||
| } |
There was a problem hiding this comment.
🟡 Routing profile JSON schema not updated for new intent, causing validation failure with additionalProperties: false
The default.json routing profile references packages/workload-router/routing-profiles/schema.json via $schema, and that schema sets "additionalProperties": false on the intents object. The new npm-package-compat intent was added to default.json:82-85 but the schema's properties and required arrays at schema.json:13-28 were not updated. Any JSON schema validator (or IDE using the $schema reference) will reject default.json because npm-package-compat is an unrecognized property. This is a pre-existing gap (several earlier intents like sage-slack-egress-migration, capability-discovery, etc. are also missing from the schema), but this PR extends it.
Prompt for agents
The routing profile JSON schema at packages/workload-router/routing-profiles/schema.json has additionalProperties: false on the intents object but is missing entries for npm-package-compat (added in this PR) as well as several previously-added intents (sage-slack-egress-migration, sage-proactive-rewire, cloud-slack-proxy-guard, sage-cloud-e2e-conduction, capability-discovery). Update the schema's required array (line 13) and properties block (lines 14-28) to include all intents currently listed in PERSONA_INTENTS in packages/workload-router/src/index.ts. Each new intent needs a $ref to #/definitions/rule entry in properties, and its name added to the required array.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Pull request overview
Adds a new npm-package-bundler-guard persona and wires it into the workload router under the npm-package-compat intent to flag npm package configurations that commonly break bundlers.
Changes:
- Adds
personas/npm-package-bundler-guard.jsondefining the new persona and tiered runtime config. - Wires the new persona into the workload-router intent catalog, default routing profile, and persona generation script.
- Updates routing profile tests/fixtures to include the new intent.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| personas/npm-package-bundler-guard.json | Introduces the new persona definition and prompts for bundler/package.json compatibility auditing. |
| packages/workload-router/src/index.ts | Registers the new npm-package-compat intent and maps it to the generated persona spec. |
| packages/workload-router/src/index.test.ts | Updates the custom routing profile fixture to include the new intent. |
| packages/workload-router/src/generated/personas.ts | Adds the generated npmPackageBundlerGuard export used by the router. |
| packages/workload-router/scripts/generate-personas.mjs | Wires the new persona filename/id to an export name so it is included in generation output. |
| packages/workload-router/routing-profiles/default.json | Adds a default tier/rationale for the new npm-package-compat intent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
| 'npm-package-compat': { | ||
| tier: 'best-value', | ||
| rationale: 'mechanical package.json audits' | ||
| } |
There was a problem hiding this comment.
A new intent/persona is introduced (npm-package-compat → npm-package-bundler-guard), but the tests never assert that resolvePersona('npm-package-compat') (or personaCatalog['npm-package-compat']) resolves to the expected persona/runtime from the default routing profile. Add a focused assertion to ensure this wiring doesn’t regress (e.g., personaId, tier, harness).
Summary
Adds a new persona that catches npm package misconfigurations that break bundlers (Turbopack, webpack, esbuild).
Born from repeated deploy failures where:
exportspointed to raw.tssource files — Turbopack can't handle.tsfromnode_modulesfilesonly includedsrc, notdist— published packages had no compiled output@relayfile/adapter-core→SchemaAdapter) that couldn't resolve outside the monorepotsc --noEmit, missing bundler resolution failures that only surface duringnext buildThe persona audits
package.jsonconfigs and flags:file:deps, barrel chains with unresolvable deps./path-mappersubpath exports for zero-dep modules, missing bundler build CI stepTest plan
npm-package-compatintent🤖 Generated with Claude Code