fix(public): make slug-collision precedence fixture self-contained - #4014
Conversation
The "slug-collision precedence" describe block built its fixture input as `[...originalGuides, appGuidePath, reverseGuideRelPath]`, spreading the real on-disk guide list. That implicitly assumed at most one real guide per slug (the framework's own modules/home/). A consumer shipping a second real guide at the same slug from its own module lands at the same precedence tier as the fixture and silently wins the same-tier tiebreak, defeating the test. The block now fully controls its own input: the two framework sample guides these fixtures collide against are listed explicitly by their known real path instead of spread from originalGuides. Closes #4012
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughThe integration test now declares the two framework guide paths explicitly before adding fixture guides. Comments document how spreading the original guide configuration could hide same-slug framework guides when consumers provide duplicate guide slugs. ChangesGuide fixture configuration
Estimated code review effort: 2 (Simple) | ~5 minutes Possibly related issues
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4014 +/- ##
=======================================
Coverage 93.54% 93.54%
=======================================
Files 170 170
Lines 5759 5759
Branches 1847 1847
=======================================
Hits 5387 5387
Misses 302 302
Partials 70 70
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
* fix(public): make docs integration tests consumer-independent The public docs integration suite still read real on-disk guide content/counts in several places (tree grouping, the raw-markdown :slug.md test, the front-matter leak check). A consumer shipping its own guide at a globally-shared slug (welcome/quickstart) now deterministically wins that slug by design (#4011), so any assertion pinned to which real guide wins is a consumer-dependence bug. Split the file's first describe block into a shape/status-only block (no fixture needed, content is irrelevant) and a controlled-fixture block that fully replaces config.files.guides with self-authored guides (the #4014 pattern), restored in afterAll. The raw-markdown test now targets a fixture guide at a unique slug and asserts its own content. The slug-collision precedence block is untouched. Verified the invariant holds by running the suite with a synthetic extra guide file injected at the welcome/quickstart slugs from a fake non-core module — identical green result with or without it. Closes #4015 * fix(public): scope the unknown-slug 404 test to the controlled fixture CodeRabbit review on #4016: the 404-for-unknown-slug test lived in the shape/status-only block and queried a hardcoded slug against whatever config.files.guides resolves to at boot. A consumer could in principle configure a guide at that exact slug, making the test consumer-dependent again. Move it into the controlled-fixture block (config.files.guides fully replaced there) and query a slug guaranteed absent from that fixture set.
Summary
modules/public/tests/public.docs.integration.tests.js), the fixture'sconfig.files.guidesinput no longer extends the real on-disk guide list (...originalGuidesspread removed). It now uses an explicit list: the two known framework guide paths (modules/home/doc/guides/00-welcome.md,modules/home/doc/guides/01-quickstart.md) plus the fixture's own two synthetic guide paths.originalGuides— the real, on-diskconfig.files.guides— which implicitly assumed at most one real guide per slug (the framework's ownmodules/home/). A downstream consumer that ships a second real guide at the same slug from its own module lands at the same precedence tier as the fixture and silently wins the same-tier tiebreak inresolveGuideEntries, defeating this test deterministically in that consumer's CI — even though production precedence behavior is correct. Removing the spread makes the block fully control its own input, independent of any downstream repo's real on-disk guide state.Scope
public(tests only)nonelowValidation
npm run lintnpm testGuardrails check
.env*,secrets/**, keys, tokens)Notes for reviewers
Summary by CodeRabbit