Skip to content

docs: index all 9 feature guides on every surface + drift guard (LAB-1013) - #260

Open
27Bslash6 wants to merge 6 commits into
mainfrom
lab-1013-index-orphaned-feature-guides
Open

docs: index all 9 feature guides on every surface + drift guard (LAB-1013)#260
27Bslash6 wants to merge 6 commits into
mainfrom
lab-1013-index-orphaned-feature-guides

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Five of the nine docs/features/ guides (interop-mode, l1-invalidation, reference-caching, rust-serialization, ssrf-protection) were unreachable from every index surface — README.md, docs/README.md, and llms.txt all listed the same original four. Guides were "born orphaned" because nothing checked index reachability (LAB-1013).

Changes

  • All nine guides linked from all three surfaces, in each surface's existing style (table rows + link-reference definitions in README.md, table rows in docs/README.md, - [Name](path): description lines in llms.txt). Deliberate call: the top-level README indexes the full set rather than a curated subset.
  • Recurrence guard: tests/unit/test_feature_guide_index.py globs docs/features/*.md and fails with the offending filenames if any guide is not linked from an index. It verifies rendered reachability: for reference-style links it requires the definition's label to actually be used, so an orphaned [label]: docs/features/x.md definition with no table row does not pass.
  • Guard lives in tests/unit/ (not tests/docs/) because CI's PR lane collects only tests/unit/ and tests/critical/ — a guard in tests/docs/ would never run in CI.

Proof the guard works

  • Removed the interop-mode line from llms.txtAssertionError: Feature guides missing from llms.txt: ['interop-mode.md']
  • Removed the README table row while leaving its link-reference definition → AssertionError: Feature guides missing from README.md: ['interop-mode.md']
  • Both restored; all three parametrized cases pass.

Verification

  • uv run pytest tests/unit/ -m "not slow" -n auto — 1913 passed
  • uv run pytest tests/critical/ -m "not slow" — 234 passed
  • uv run pytest --markdown-docs docs/ — 121 passed
  • uv run ruff check / ruff format --check — clean
  • Expert-panel review run (4 agents); the one surviving MAJ (README reference-definition false-pass) is fixed in this diff.

Summary by CodeRabbit

  • Documentation

    • Added links to feature guides covering Interop Mode, L1 invalidation and stale-while-revalidate, reference caching, Rust serialisation, and SSRF protection.
    • Updated the main documentation indexes and AI-oriented documentation reference.
  • Tests

    • Added coverage to verify every feature guide is linked from all relevant documentation indexes.

…1013)

Five of nine docs/features/ guides (interop-mode, l1-invalidation,
reference-caching, rust-serialization, ssrf-protection) were unreachable
from README.md, docs/README.md, and llms.txt — born orphaned because
nothing checked index reachability.

- Link all nine guides from all three index surfaces (deliberate call:
  the top-level README indexes the full set, not a curated subset).
- Add tests/unit/test_feature_guide_index.py: globs docs/features/*.md
  and fails with the offending filenames if any guide is missing from an
  index. Lives in tests/unit/ because CI's PR lane only collects
  tests/unit/ and tests/critical/ — a guard in tests/docs/ would never
  run in CI.
@kodus-27b

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 54 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2bbbe2f7-2373-40e8-92ff-f27177104585

📥 Commits

Reviewing files that changed from the base of the PR and between 031c7ca and 85e18d8.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (1)
  • tests/unit/test_feature_guide_index.py

Walkthrough

The change adds five feature-guide links to three documentation indexes. A parametrised unit test checks that every feature guide appears in each index.

Changes

Feature guide indexing

Layer / File(s) Summary
Index feature guides
README.md, docs/README.md, llms.txt
The documentation indexes now link to Interop Mode, L1 Invalidation & SWR, Reference Caching, Rust Serialisation, and SSRF Protection. README.md also includes the reference-link definitions.
Validate guide coverage
tests/unit/test_feature_guide_index.py
A parametrised test discovers feature guides and checks rendered inline or reference-style Markdown links in each index surface. It ignores fenced code, HTML comments, unused references, and off-site paths.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main documentation change and the added drift guard.
Description check ✅ Passed The description clearly covers the motivation, changes, guard behaviour, placement, proof, and verification results, despite omitting the template checkboxes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 lab-1013-index-orphaned-feature-guides

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

Comment thread tests/unit/test_feature_guide_index.py
Comment thread tests/unit/test_feature_guide_index.py

@kodus-27b kodus-27b Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/test_feature_guide_index.py`:
- Around line 23-39: Update _is_linked to ignore non-rendered Markdown content,
including fenced code blocks and HTML comments, before evaluating inline and
reference-style links. Preserve detection of rendered links, and add regression
cases covering both fenced code and HTML comments.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fbe5edd9-4422-410a-98af-f9060082ce44

📥 Commits

Reviewing files that changed from the base of the PR and between 2607faf and 095d69c.

📒 Files selected for processing (4)
  • README.md
  • docs/README.md
  • llms.txt
  • tests/unit/test_feature_guide_index.py

Comment thread tests/unit/test_feature_guide_index.py Outdated
…omments (LAB-1013)

CodeRabbit: link-shaped text inside a fenced code block or HTML comment
satisfied _is_linked without rendering, so the guard could pass while a
guide stayed unreachable. Strip non-rendered content before matching,
fail loud on unpaired fences (silent pairing skew would reopen the same
false-pass), and pin both cases with a regression test.
@kodus-27b

This comment has been minimized.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@kody start-review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread tests/unit/test_feature_guide_index.py

@kodus-27b kodus-27b Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/unit/test_feature_guide_index.py (1)

48-53: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Match only local guide paths.

re.escape protects the guide name, but both expressions still match features/{guide_name} anywhere in a URL. For example, [X](https://example.test/features/x.md) is accepted. A used reference to the same external URL is also accepted. The guard can therefore pass while the repository guide is absent. Match only features/{guide_name} or docs/features/{guide_name} at the link target boundary. Add negative cases to test_is_linked_counts_rendered_links_only.

Proposed matching change
     target = re.escape(f"features/{guide_name}")
-    if re.search(rf"\]\([^)]*{target}\)", index_text):
+    local_target = rf"(?:docs/)?{target}"
+    if re.search(rf"\]\({local_target}(?:[?#][^)]*)?\)", index_text):
         return True
-    for m in re.finditer(rf"^\[([^\]]+)\]:\s*\S*{target}\s*$", index_text, re.MULTILINE):
+    for m in re.finditer(
+        rf"^\[([^\]]+)\]:\s*{local_target}(?:[?#]\S*)?\s*$",
+        index_text,
+        re.MULTILINE,
+    ):

Also applies to: 57-64

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/test_feature_guide_index.py` around lines 48 - 53, Restrict the
link and reference regexes in the relevant guide-link helper to local targets
only: accept targets beginning with features/{guide_name} or
docs/features/{guide_name} at the link boundary, and reject external URLs
containing those paths. Extend test_is_linked_counts_rendered_links_only with
negative cases covering external inline and reference links.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/test_feature_guide_index.py`:
- Around line 30-34: Update _strip_non_rendered to remove HTML comments before
validating or stripping fenced blocks, so fence markers inside comments are
ignored and cannot pair with rendered content. Preserve the existing
unpaired-fence assertion after comment removal, and add a regression test
covering a fence contained within an HTML comment.

---

Outside diff comments:
In `@tests/unit/test_feature_guide_index.py`:
- Around line 48-53: Restrict the link and reference regexes in the relevant
guide-link helper to local targets only: accept targets beginning with
features/{guide_name} or docs/features/{guide_name} at the link boundary, and
reject external URLs containing those paths. Extend
test_is_linked_counts_rendered_links_only with negative cases covering external
inline and reference links.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 765d47af-24cc-423f-9340-a0209994a772

📥 Commits

Reviewing files that changed from the base of the PR and between 095d69c and e797ba5.

📒 Files selected for processing (1)
  • tests/unit/test_feature_guide_index.py

Comment thread tests/unit/test_feature_guide_index.py Outdated
…(LAB-1013)

Two CodeRabbit findings on the previous fix, both reproduced against
e797ba5 before changing anything:

- Sequential strip passes are wrong in *both* orderings. Fences-first
  made a ``` inside a closed <!-- --> look like an unpaired fence and
  raised AssertionError; the reordering CodeRabbit proposed only moves
  the bug, since a <!-- inside a code fence is literal text and would
  then eat the rendered content after it. One alternation fixes both:
  re.sub scans left to right, so whichever construct opens first
  consumes the other — which is how markdown resolves the overlap.

- _is_linked matched features/<name> anywhere in a link target, so
  https://elsewhere.example/features/x.md counted as a local guide
  (confirmed True on both the inline and reference-style forms). Anchor
  the path to the target's start, allowing only ./ and docs/ prefixes.
  Every real link across the three surfaces is repo-relative, so this
  narrows nothing that exists; an unrecognised form now fails loud
  rather than passing falsely.

Regression tests pin both, and both fail against the old helpers.
@kodus-27b

This comment has been minimized.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

Review remediation — 031c7ca

1. "Match only local guide paths" (outside-diff, Major) — fixed.
Confirmed against e797ba5 before changing anything: _is_linked("[X](https://example.test/features/x.md)", "x.md") returned True, and the reference-style form did too. The path is now anchored to the start of the link target, allowing only ./ and docs/ prefixes:

path = re.escape(f"features/{guide_name}")
target = rf"(?:\./)?(?:docs/)?{path}"

Every real link across the three index surfaces is repo-relative (features/x.md in docs/README.md, docs/features/x.md in llms.txt and README.md, inline and reference-style), so this narrows nothing that exists. An unrecognised form now fails loud rather than passing falsely — the safe direction for a drift guard, where a false pass is the failure mode that matters.

2. Fence/comment strip ordering (Major) — fixed, see the inline reply. Single alternation rather than the proposed reordering, because sequential passes are wrong in both directions.

Verification: 1916 passed, 8 skipped on tests/unit; ruff lint + format and basedpyright clean via pre-commit. Both regression tests fail against the old helpers.


⚠️ CI is red for a reason unrelated to this PR

Python Dependency CVEs (and therefore the Security Fast Success gate) fails on h2 4.3.0 — GHSA-6hr6-w5qg-qmwg / CVE-2026-71554, HTTP/2 request smuggling via duplicate Host headers (CWE-444), fixed in 4.4.1. h2 arrives transitively through httpx[http2].

This PR cannot have caused it — the diff is 3 markdown/txt files plus one test file, and uv.lock and pyproject.toml are untouched:

$ git diff --name-only origin/main...HEAD | grep -E 'uv.lock|pyproject.toml'
(no matches)

Security Fast last passed on 2026-08-06 and fails on 2026-08-07 with no lockfile change in between — a newly published advisory against an already-pinned transitive dep. It is on main and will red every open PR in the repo until the floor is raised.

The repo already has the mechanism for exactly this, [tool.uv] constraint-dependencies in pyproject.toml (currently pinning urllib3, fonttools, werkzeug, pip). The fix is one entry plus a uv lock:

# GHSA-6hr6-w5qg-qmwg: duplicate Host headers forwarded to the consumer;
# an HTTP/2->1.1 downgrade turns that into request smuggling (CWE-444).
"h2>=4.4.1",

Deliberately not folded into this PR — it is a dependency + lockfile change with a different blast radius and reviewer audience than a docs-index diff, and holding the docs behind it (or slipping it past a docs review) both seem worse than flagging it. Happy to push it here if you'd rather unblock in place, or split it into its own security PR — your call.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 7, 2026
Comment thread tests/unit/test_feature_guide_index.py Outdated

@kodus-27b kodus-27b Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

pip-audit fails the PR lane on GHSA-6hr6-w5qg-qmwg: h2 <=4.4.0 forwards
duplicate Host headers, a request-smuggling primitive when HTTP/2 is
downgraded to HTTP/1.1. h2 is transitive via httpx[http2]; lock-only
bump (hpack 4.1.0 -> 4.2.0 comes along). pip-audit clean locally on the
same 'uv sync --group dev' resolution CI uses; full unit suite green.
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 7, 2026
@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@kody start-review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
⚠️ Action not completed

No files to review.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…B-1013)

A shared optional (?:docs/)? prefix counted a link that 404s on its own
surface (docs/features/x.md inside docs/README.md, or features/x.md inside
the top-level README) as indexed — a false pass against the guard's charter
of reader reachability. INDEX_FILES now maps each surface to its exact
prefix and _is_linked anchors on it; the two copy-paste-between-surfaces
mistakes are covered as negative cases.

Also trims speculative tolerances the panel cut: ./-prefixed links and
#anchor/?query suffixes (no surface uses either; if one appears the guard
fails loud, the safe direction), the offsite-URL self-test (emergent from
the anchored prefix, not a separate code path), and the interleaved
fence/comment self-test (construct absent from all three files).
@kodus-27b

This comment has been minimized.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

Expert-panel re-review (round 2 requested on LAB-1634) — 20c70dc

Full panel re-run (bug-hunter, security, craftsman, pragmatism) on the current diff. One surviving MAJ, now fixed:

Per-surface link prefixes in the index guard. The shared optional (?:docs/)? prefix let a link that 404s on its own surface count as indexed — [X](docs/features/x.md) inside docs/README.md resolves to docs/docs/..., and [X](features/x.md) inside the top-level README resolves to a path that doesn't exist. INDEX_FILES now maps each surface to its exact prefix (README.md/llms.txtdocs/features/, docs/README.mdfeatures/), _is_linked anchors on it, and both cross-surface copy-paste cases are locked as negative asserts.

Panel cut list applied in the same commit (net −5 lines): the ./-prefix and #anchor/?query tolerances (no surface uses either; if one appears the guard fails loud — the safe direction), the offsite-URL self-test (emergent from the anchored prefix, not a separate code path), and the interleaved fence/comment self-test (construct absent from all three files).

Verified: 1915 unit tests pass, ruff lint/format clean, and mutation probes confirm the guard fails loud on an orphaned guide, an unused reference definition, a fenced/commented link, and a wrong-prefix link on every surface.

Kody note: the standing CHANGES_REQUESTED (2026-08-07T06:12Z) cites assert in this pytest module — rebutted in three resolved threads already (assert is pytest's contract; the team rule targets production validation under python -O). Re-requesting review below since the 06:21Z trigger produced no fresh verdict.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@kody start-review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Comment thread tests/unit/test_feature_guide_index.py
Comment thread tests/unit/test_feature_guide_index.py Outdated

@kodus-27b kodus-27b Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

Kody flagged that 20c70dc's exact-prefix rewrite dropped the suffix
tolerance, so a correctly-indexed link like docs/features/x.md#anchor
would be reported as an orphan — a drift guard whose failure message
lies about a true fact. Restore the tolerance as one atom on the shared
target so both link forms (inline and reference-definition) get it;
[^)\s]* keeps it bounded by the inline ) and the definition's line end.
The character after .md must still be #, ?, ) or end-of-definition, so
x.mdx cannot false-pass — pinned by the new negative assert.

Panel-reviewed (4 agents): SHIP, no findings, no cuts; the restore is
guard correctness, not the speculative tolerance the panel cut.
@kodus-27b

kodus-27b Bot commented Aug 8, 2026

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@kody start-review

@27Bslash6

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.


def test_is_linked_accepts_fragment_and_query_suffixes():
"""#fragment / ?query target the same file — indexed; other suffixes are not it."""
assert _is_linked("[X](docs/features/x.md#anchor)", "x.md", "docs/features/")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules critical

Violates team rule 'Don’t Use `assert` for Data Validation': Ensure that assert is not used for validating user input or critical checks. Assertions can be disabled in optimized mode (python -O). Recommend using explicit validation with if conditions and raising proper exceptions.

Also found in:

  • tests/unit/test_feature_guide_index.py:82-82
  • tests/unit/test_feature_guide_index.py:83-83
  • tests/unit/test_feature_guide_index.py:85-85
Prompt for LLM

File tests/unit/test_feature_guide_index.py:

Line 81:

Violates team rule 'Don’t Use `assert` for Data Validation': Ensure that `assert` is not used for validating user input or critical checks. Assertions can be disabled in optimized mode (`python -O`). Recommend using explicit validation with `if` conditions and raising proper exceptions.

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

@kodus-27b kodus-27b Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found critical issues please review the requested changes

@codecov

codecov Bot commented Aug 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant