chore(1.4.1): ops polish — health version, cache stampede, input length guards - #22
Merged
Merged
Conversation
… guards - /api/health returns version from package.json - promise-coalescing pendingFetches map prevents CENR cache stampede - MAX_PARAM_LENGTH guards on lookup/trace params; MAX_TRACE_IPS top-level - User-Agent includes app version - package.json 1.4.1, author, engines >=20; add .nvmrc - docs: CONTRIBUTING distance.js, .env.example ALLOWED_ORIGINS, OpenAPI 1.4.1, CHANGELOG/TODO
There was a problem hiding this comment.
Pull request overview
Ops-focused 1.4.1 polish that improves operability and robustness of the API by surfacing the running app version, reducing duplicate upstream fetches under load, and hardening request parameter handling.
Changes:
- Adds
versionto/api/health(sourced frompackage.json) and updates OpenAPI + tests accordingly. - Implements cache-stampede protection for Zscaler CENR fetches via in-flight promise coalescing (
pendingFetches). - Introduces parameter length guards (
MAX_PARAM_LENGTH) and promotesMAX_TRACE_IPSto a top-level constant; bumps Node/tooling metadata to 1.4.1.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| TODO.md | Marks several previously-tracked reliability/code-quality items as completed. |
| tests/integration/api.test.js | Adds integration assertions for health version and /api/lookup max-length rejection. |
| server.js | Adds app version wiring, fetch coalescing, length guards, and promotes constants. |
| package.json | Bumps to 1.4.1, sets author, and raises Node engines requirement to >=20. |
| package-lock.json | Syncs lockfile metadata with 1.4.1 and Node engines >=20. |
| openapi.yaml | Updates API version to 1.4.1 and documents health version field. |
| CONTRIBUTING.md | Fixes project tree listing to include utils/distance.js. |
| CHANGELOG.md | Documents 1.4.1 release notes for the ops-polish batch. |
| .nvmrc | Pins local Node version to 20. |
| .env.example | Documents ALLOWED_ORIGINS for optional restricted CORS configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+481
to
+486
| if (typeof cloud === 'string' && cloud.length > MAX_PARAM_LENGTH) { | ||
| return res.status(400).json({ | ||
| success: false, | ||
| error: `Parameter too long (max ${MAX_PARAM_LENGTH} characters)` | ||
| }); | ||
| } |
Comment on lines
+481
to
+486
| if (typeof cloud === 'string' && cloud.length > MAX_PARAM_LENGTH) { | ||
| return res.status(400).json({ | ||
| success: false, | ||
| error: `Parameter too long (max ${MAX_PARAM_LENGTH} characters)` | ||
| }); | ||
| } |
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.
Summary
1.4.1 ops polish batch.
Changes
/api/healthreturnsversionfrompackage.jsonpendingFetchespromise coalescingMAX_PARAM_LENGTH = 256) on lookup/traceMAX_TRACE_IPSpromoted to top-level constantpackage.json1.4.1, author, engines ≥20;.nvmrc.env.exampleALLOWED_ORIGINS, CHANGELOG, TODOAfter merge
Tag
v1.4.1when ready.