Skip to content

fix: support JavaScript Express guards#87

Merged
ejntaylor merged 2 commits into
mainfrom
agent/support-javascript-express-guards
Jul 15, 2026
Merged

fix: support JavaScript Express guards#87
ejntaylor merged 2 commits into
mainfrom
agent/support-javascript-express-guards

Conversation

@ejntaylor

Copy link
Copy Markdown
Contributor

What changed

  • generate runtime guards that match Express entry files: guard.ts, guard.js, or guard.cjs
  • preserve required file extensions for directly executed ESM and CommonJS applications
  • register the parsed-body Express guard after express.json() and before routes
  • leave the application source untouched and report not-wired when the required body-parser anchor is absent
  • verify the generated JavaScript and CommonJS syntax with Node

Why

Bolt commonly generates a plain ESM server.js. The existing Express adapter always scaffolded guard.ts, inserted an extensionless import, and registered raw-stream middleware before express.json(). That shape could not run under Node and could consume the request before Express parsed {text}.

Impact

The Express todo application used by the Patchstack virtual-patching walkthrough can now be wired by patchstack-connect protect without manual middleware. TypeScript and CommonJS Express projects retain module-format-correct output.

Validation

  • npm run typecheck
  • npm test — 41 files, 473 tests passed
  • npm run build
  • exact Bolt ESM server.js fixture, CommonJS fixture, idempotency, middleware ordering, missing-parser fallback, and Node syntax checks

Dependency

This PR is stacked on #86 because the JavaScript guard also consumes the shared site-UUID baking added there. Merge #86 first, then retarget this PR to main.

@coderbuds

coderbuds Bot commented Jul 15, 2026

Copy link
Copy Markdown

Adds Express guard support and production-backed demo with extensive tests.

🎯 Quality: 100% Elite · 📦 Size: Large — consider splitting if possible

📈 This month: Your 235th PR — above team average · Averaging Excellent

See how your team is trending →

@ejntaylor ejntaylor marked this pull request as ready for review July 15, 2026 18:34
@ejntaylor

Copy link
Copy Markdown
Contributor Author

/review

Base automatically changed from agent/bake-site-uuid-into-guards to main July 15, 2026 18:59
@ejntaylor ejntaylor force-pushed the agent/support-javascript-express-guards branch from 84007ab to 5960b5e Compare July 15, 2026 20:27
* feat: add production virtual patch demo

* feat: add guided virtual patch demo
@ejntaylor ejntaylor force-pushed the agent/support-javascript-express-guards branch from 5960b5e to 5acf761 Compare July 15, 2026 20:30
@ejntaylor ejntaylor merged commit 9ccb288 into main Jul 15, 2026
4 checks passed
@ejntaylor ejntaylor deleted the agent/support-javascript-express-guards branch July 15, 2026 20:31
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.

3 participants