Read the backend contract from its TypeScript server - #28
Conversation
The backend replaced its Rust crates with server/ (CortexLM/backend#441). Error codes and PROBLEM_TYPE_BASE now come from server/src/core/error.ts and registered paths from the route literals under server/src/api; admin-listener paths stay out of the public set.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe documentation checker now validates problem pages against the TypeScript server’s ChangesDocumentation validation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The validator now reads TypeScript backend contracts, with no demonstrated merge-blocking issue. Compatibility with the actual backend route conventions remains unverified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change remains a file-based documentation check and does not expose or execute backend routes. Residual uncertainty concerns whether the new route-discovery rules accurately distinguish public and private routes in the external backend. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Cortex Security
Nothing to change. Cortex Security reviewed every changed file and found no issues.
●●●●● 5/5 — Nothing to change
What happens, in order
flowchart
errorSrc["server/src/core/error.ts"] --> baseCheck{PROBLEM_TYPE_BASE == "https://docs.cortex.foundation/problems"?}
errorSrc --> codes["parse ERROR_CODES codes"]
baseCheck -- no --> fail1["FAIL: PROBLEM_TYPE_BASE mismatch"]
baseCheck -- yes --> tsBaseCheck["check packages/api-types/src/errors.ts PROBLEM_TYPE_BASE"]
tsBaseCheck -- mismatch --> fail2["FAIL: PROBLEM_TYPE_BASE mismatch"]
tsBaseCheck -- ok --> codes
codes --> missingPageCheck{for each code: problems/{code}.mdx exists?}
missingPageCheck -- no --> fail3["FAIL: missing problem page"]
missingPageCheck -- yes --> extraPageCheck{for each .mdx: code in ERROR_CODES?}
extraPageCheck -- no --> fail4["FAIL: undocumented error code"]
extraPageCheck -- yes --> routerCheck["walk server/src/api/*.ts → extract registered routes"]
routerCheck --> docPathCheck{for documented /v1/… paths: registered in router?}
docPathCheck -- no --> fail5["FAIL: undocumented API path"]
3 further observations did not survive verification and were not posted.
Review 1 · read c18d111 · comment @cortex-security-agent review to look again
The backend replaces its Rust crates with
server/in CortexLM/backend#441, so this validator'scrates/…reads fail there.PROBLEM_TYPE_BASEnow come fromserver/src/core/error.ts(ERROR_CODESkeys).server/src/api:/v1prefix except health probes and/internal/…; admin-listener literals (/v1/admin/…) stay out of the public set.Test plan:
node scripts/check-docs-site.mjs <backend at #441>: ok (24 problem pages; 317 router paths). The 317 match the public rows of the backend's route-parity fixture exactly.bash scripts/tests/check-docs-site.test.sh: ok. New cases: a code removed fromERROR_CODESfails; documenting an admin path fails.check-docs-content,docs-ui,docs-imagestests: ok.mint validatenot run locally (network).Merge order: this must land with or before backend#441; the backend CI pins this commit.
Summary by CodeRabbit