Skip to content

feat: add npm-package-bundler-guard persona#15

Open
khaliqgant wants to merge 2 commits intomainfrom
feat/npm-package-bundler-guard-persona
Open

feat: add npm-package-bundler-guard persona#15
khaliqgant wants to merge 2 commits intomainfrom
feat/npm-package-bundler-guard-persona

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Apr 16, 2026

Summary

Adds a new persona that catches npm package misconfigurations that break bundlers (Turbopack, webpack, esbuild).

Born from repeated deploy failures where:

  • exports pointed to raw .ts source files — Turbopack can't handle .ts from node_modules
  • files only included src, not dist — published packages had no compiled output
  • Barrel re-exports pulled in heavy transitive deps (e.g. @relayfile/adapter-coreSchemaAdapter) that couldn't resolve outside the monorepo
  • CI only ran tsc --noEmit, missing bundler resolution failures that only surface during next build

The persona audits package.json configs and flags:

  • Blocker: exports → .ts, missing dist in files, file: deps, barrel chains with unresolvable deps
  • Suggestion: missing ./path-mapper subpath exports for zero-dep modules, missing bundler build CI step

Test plan

  • Persona JSON is valid and follows the existing schema
  • Workload router picks it up for npm-package-compat intent

🤖 Generated with Claude Code


Open with Devin

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>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

devin-ai-integration[bot]

This comment was marked as resolved.

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>
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment on lines +82 to 85
"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."
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json defining 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.

Comment on lines +121 to 125
},
'npm-package-compat': {
tier: 'best-value',
rationale: 'mechanical package.json audits'
}
Copy link

Copilot AI Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new intent/persona is introduced (npm-package-compatnpm-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).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants