Repository navigation
test: fix typecheck regression from #404/#405 merge race - #408
Conversation
docusaurus.config.ts's markdown field types as DeepPartial<MarkdownConfig> | undefined on the Config type, so destructuring config.markdown.preprocessor without narrowing fails tsc with TS5102-adjacent TS2339 once baseUrl is no longer masking it. Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
Important Held for human review by the hive's ACMM level gate. This PR was opened by the "quality" agent while Hive policy required a human checkpoint for that agent. Agent PRs are held at ACMM L3–L5; an Hive will keep the |
✅ Deploy Preview for cncf-techdocs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Format checks were failing because the assert.ok() lines added for the typecheck fix exceeded prettier's line-length preference. Reformat with npx prettier --write; no behavior change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Independently verified this fix; it looks correct to me. (Note: I'm an automated reviewer — a maintainer still needs to approve.)
- On current
main(418adeb),npx tsc --noEmitfails with exactly the claimed error:lib/docusaurusConfigPreprocessor.test.mts(15,9): error TS2339: Property 'preprocessor' does not exist on type 'DeepPartial<MarkdownConfig> | undefined'. - On this branch (e01c625),
npx tsc --noEmitexits 0 andnpm run test:unitpasses 52/52. - The diff touches only
lib/docusaurusConfigPreprocessor.test.mts, adding twoassert.oknarrowing checks before theconfig.markdown.preprocessordestructure (lines 15–26).docusaurus.config.tsdoes definemarkdown.preprocessor, so the assertions cannot fire at runtime; they exist purely to narrowConfig['markdown']: DeepPartial<MarkdownConfig> | undefinedfor the compiler. No production code changes.
The merge-race explanation in the body checks out: #405 fixed TS5102, which unmasked the TS2339 that #404's test file introduces against the Docusaurus Config type. This unblocks typecheck/test:unit on main and seems safe to land.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the test-only type-narrowing changes.
No open issues 🎉
What changed in this PR
Fixes the test-only typecheck regression caused by the combined changes in #404 and #405, addressing #407 without changing production code.
Changes:
- Adds runtime assertions to narrow
config.markdownandpreprocessorbefore use. - Explains why the optional Docusaurus configuration types require these checks.
| File | Description |
|---|---|
lib/docusaurusConfigPreprocessor.test.mts |
Adds type-narrowing assertions and explanatory comments to fix the preprocessor test’s typecheck error. |
Review effort: Balanced
Test Improvement
Fixes
lib/docusaurusConfigPreprocessor.test.mtssonpm run typecheck(and therefore
npm run test:unit/test:coverage) passes again onmain.#404and#405each passednpm run typecheckindependently but merged~2 minutes apart; combined,
config.markdown.preprocessoris destructuredfrom a value typed
DeepPartial<MarkdownConfig> | undefined(Docusaurus'sConfigtype only requirestitle/url/baseUrl/future), which TSnow rejects with TS2339 once TS5102 (the baseUrl error #405 fixed) no longer
masks it.
Adds two
assert.okruntime narrowing checks (config.markdown, thenpreprocessor) before use — no production code touched, no behavior change,test file only. Verified locally:
npx tsc --noEmitexits 0, andnpm run test:coveragereports 52/52 passing with 100%stmts/branch/func/line across all included files.
Related Issue
Fixes #407
Filed by quality agent (hold-gated mode). Human review required.
— hive: agent=quality backend=copilot model=claude-opus-4-6 copilot=1.0.88