Skip to content

fix(public): make slug-collision precedence fixture self-contained - #4014

Merged
PierreBrisorgueil merged 1 commit into
masterfrom
fix/4012-precedence-fixture-self-contained
Aug 4, 2026
Merged

fix(public): make slug-collision precedence fixture self-contained#4014
PierreBrisorgueil merged 1 commit into
masterfrom
fix/4012-precedence-fixture-self-contained

Conversation

@PierreBrisorgueil

@PierreBrisorgueil PierreBrisorgueil commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • What changed: In the "slug-collision precedence" describe block (modules/public/tests/public.docs.integration.tests.js), the fixture's config.files.guides input no longer extends the real on-disk guide list (...originalGuides spread 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.
  • Why: The old fixture built its input by spreading originalGuides — the real, on-disk config.files.guides — which implicitly assumed at most one real guide per slug (the framework's own modules/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 in resolveGuideEntries, 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.
  • Related issues: Closes fix(public): slug-collision precedence test fixture collides with a second real application-tier guide module #4012

Scope

  • Module(s) impacted: public (tests only)
  • Cross-module impact: none
  • Risk level: low

Validation

  • npm run lint
  • npm test
  • Manual checks done (if applicable)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed

Notes for reviewers

Summary by CodeRabbit

  • Tests
    • Improved slug-collision test coverage by explicitly including framework and fixture guides.
    • Added documentation clarifying expected precedence when guides share the same slug.

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
@PierreBrisorgueil PierreBrisorgueil added Fix A bug fix Tests Adding missing tests or correcting existing labels Aug 4, 2026
@PierreBrisorgueil PierreBrisorgueil self-assigned this Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ee1474cc-3eb4-4300-8ac4-5c7b93bc6723

📥 Commits

Reviewing files that changed from the base of the PR and between adbc2b8 and 5be2732.

📒 Files selected for processing (1)
  • modules/public/tests/public.docs.integration.tests.js

Walkthrough

The 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.

Changes

Guide fixture configuration

Layer / File(s) Summary
Explicit framework guide setup
modules/public/tests/public.docs.integration.tests.js
The beforeAll setup declares the framework guide paths separately and combines them with fixture guides. Comments explain the slug-collision behavior addressed by the test setup.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related issues

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4012-precedence-fixture-self-contained

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.54%. Comparing base (adbc2b8) to head (5be2732).
⚠️ Report is 1 commits behind head on master.

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           
Flag Coverage Δ
integration 61.83% <ø> (ø)
unit 76.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update adbc2b8...5be2732. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review August 4, 2026 15:32
@PierreBrisorgueil
PierreBrisorgueil merged commit 05f3621 into master Aug 4, 2026
8 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the fix/4012-precedence-fixture-self-contained branch August 4, 2026 15:33
PierreBrisorgueil added a commit that referenced this pull request Aug 4, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix A bug fix Tests Adding missing tests or correcting existing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(public): slug-collision precedence test fixture collides with a second real application-tier guide module

1 participant