Skip to content

fix(docs): stop embedding internal engineering records; close the docs corpus - #1654

Merged
aaj3f merged 4 commits into
mainfrom
feat/docs-corpus-scoping
Aug 17, 2026
Merged

fix(docs): stop embedding internal engineering records; close the docs corpus#1654
aaj3f merged 4 commits into
mainfrom
feat/docs-corpus-scoping

Conversation

@aaj3f

@aaj3f aaj3f commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Part of #1653 — the A1 corpus scoping plus the D3 cross-links. A6 (rev-stamping non-release builds) is deliberately not here; reasons at the bottom.

A1 — the embedded corpus is now a closed set

The rust-embed derive in fluree-db-docs/src/embed.rs embedded all of ../docs minus book/* and hidden dirs — which shipped docs/audit/ and docs/audit-impl/ (39 internal engineering records: branch names, worktree paths, benchmark run IDs, contributor attribution) inside every released binary, retrievable by any user or agent through fluree docs search / the MCP docs_search tool. Verified at the binary surface before and after: fluree docs search "findings register" returned four audit/… paths on origin/main and returns none on this branch; "worktree" went from four hits to zero. Worth being precise about the exposure: mdBook only builds SUMMARY.md chapters, so these records were never on the docs site — the leak was exactly the binary/agent surface, i.e. content deliberately kept off the website was being served to anyone who asked the binary.

The fix is a policy, not just an exclude: an embedded page must be linked from SUMMARY.md, listed in EMBEDDED_EXTRAS with a reason, or excluded — and four new guardrail tests keep the set closed in both directions (embedded-but-unlisted fails naming offenders; an extras entry that stops existing fails too, so the allowlist can't rot). #[include = "*.md"] also drops book.toml and scripts/llms_preproc.py, which were bytes in every binary no surface could return. The arithmetic closes exactly: 233 embedded = 231 SUMMARY-linked + 2 extras.

Disclosure: which releases shipped this. docs/audit/ first appears at tag v4.1.2 (11 records) and the set grows to 39 by v4.1.5 — so released binaries v4.1.2 through v4.1.5 all embed internal engineering records (branch names, worktree paths, benchmark run IDs, contributor attribution), retrievable via fluree docs search/docs_get and the MCP docs tools. The records were never on the docs site (mdBook builds only SUMMARY chapters); the exposure is exactly the binary/agent surface. At the CLI's default limit of 10, "findings register" returned 9/10 audit hits and "worktree" returned 8/8 — the word existed nowhere else in the corpus. This PR is labeled bug so release notes file it where someone auditing an installed binary will look.

The 44 previously-unlinked files (39 excluded + 3 promoted + 2 extras, one of which is SUMMARY.md itself) sorted as:

  • 39 excluded — the audit records. They stay in the repo; the ~dozen Rust source comments citing them by repo-relative path are unaffected.
  • 3 promoted into SUMMARY.mdcontributing/benches.md, memory/cli/audit.md, memory/guides/hygiene-and-auditing.md. The two memory pages had inbound links from published pages that were dead on the site; contributing/benches.md's inbound links are repo-root files (BENCHMARKING.md, fluree-bench-support/README.md), so promoting it is an editorial call — the right one, but a call, not the mechanical no-judgment case.
  • 2 extrasSUMMARY.md itself (the TOC; docs_tree parses it, it isn't a content page) and operations/running-fluree.md with a TODO(review): 402 lines, zero inbound links, substantial overlap with three published pages. Publishing it or folding it in is an editorial call I didn't want to make silently inside a scoping PR, so it stays searchable with the open decision visible.

Mutation-checked: a scratch page under docs/ fails the publish test naming it; removing the excludes fails three tests listing all 39 records; a bogus extras entry fails the exists test.

D3 — the glue docs

docs/cli/server-integration.md and docs/cli/load.md turned out to already be in SUMMARY.md (221d01a, which also added the docs_coverage gate for docs/cli/) — the anchor's premise was stale there, and the new corpus-wide test generalizes that same gate. What did change: docs/ai/claude-code.md now points at the fluree-cli Claude Code plugin (and the forthcoming stack-first fluree-companion), and its remote section notes that a Fluree AI stack serves its own version-pinned docs at /api/docs — shape verified against the solo source rather than taken on faith.

Why A6 isn't here

Rev-stamping would touch two different contracts and neither cheaply: this workspace has zero build scripts across 48 crates (adding one to the CLI puts a build-script dependency in every workspace compile), a baked SHA goes stale without rerun-if-changed on the resolved HEAD — and in a repo worked almost entirely through git worktrees, the obvious ../.git/HEAD is wrong in exactly the environment we use daily; a confidently wrong rev is worse than none. And the docs-stamp half isn't a field addition — fluree_db_docs::VERSION rides the wire shape of docs --json and the MCP docs_* tools, which downstream consumers parse. fluree manifest already carries the features array as the main same-version-different-surface signal, and A1 makes the docs corpus deterministic per commit. If we still want build-identity in the field, it deserves its own issue with those constraints on the table.

Tests

cargo fmt --check clean; clippy -p fluree-db-docs --all-targets clean; fluree-db-docs 19/19 (4 new); docs_coverage 5/5; fluree-db-mcp 8/8; mdbook build succeeds and the llms preprocessor stages 231 pages, matching the SUMMARY count exactly.

One pre-existing loose end left alone: bench-baselines/README.md links docs/audit/2026-06-architecture-audit.md, which no longer exists on main — unrelated to this change.


Review-pass remediation (post-open): parse_summary now strips HTML comment spans before scanning — a SUMMARY entry unpublished with a multi-line <!-- --> block previously kept all guardrails green while mdBook dropped the page (reproduced, then fixed; the same-line form already failed closed), and docs_tree stops listing commented-out chapters as a side effect. ./-prefixed links are normalized so a published page can't fail the guardrail with a message claiming the opposite. Three new parse tests cover both comment forms, unterminated comments, and the prefix. ai/claude-code.md no longer overstates the fluree-cli plugin's wiring (docs-only, not memory), and the index's post-#[include] filters are labeled belt-and-braces. Docs suite 22/22, coverage 5/5, mcp 8/8, fmt + clippy clean.

Note on the clippy red at HEAD: it is main's breakage, not this branch's — #1580 trips clippy::type_complexity on main itself, and every PR inherits it through the merge-ref checkout. Fix: #1658. This PR's own crates are clippy-clean under -D warnings locally.

aaj3f added 3 commits August 15, 2026 16:49
…aries

`DocsAssets` embedded all of `../docs` minus `book/` and hidden dirs, so
every binary carried the ~39 working records under `docs/audit/` and
`docs/audit-impl/` — audit briefs, findings registers, per-branch gate logs
naming branches, worktree paths, benchmark run IDs, and contributors. They
are not in `SUMMARY.md`, so mdBook never published them, but
`fluree docs search` and the `docs_search` MCP tool returned them to any
user. Exclude both trees; source comments that cite them by repo-relative
path are unaffected.

The leak was possible because nothing decided what the embedded set is.
Make it a policy with a guardrail: an embedded page must be linked from
`SUMMARY.md` or listed in `EMBEDDED_EXTRAS` with a reason, and only
markdown embeds at all (the index skips everything else, so `book.toml`
and the llms.txt preprocessor were dead weight). Tests fail in both
directions — an unaccounted page, and an extras entry whose file is gone.

Reconciling the existing corpus turned up three user-facing pages that
were embedded but missing from the TOC, which also means mdBook never
built them and the inbound links from published pages
(`memory/guides/README.md`, `memory/cli/memory.md`, root `BENCHMARKING.md`)
are broken on the site. Publish them. `operations/running-fluree.md` goes
to `EMBEDDED_EXTRAS` with a TODO instead: it overlaps three published
pages and whether to publish or fold it is an editorial call.
…docs

Two things an agent driving this CLI has no way to discover from inside the
binary: the packaging that installs the MCP wiring for it
(fluree/claude-plugins, plus the forthcoming stack-first `fluree-companion`
plugin), and the fact that a Fluree AI stack publishes a second, disjoint
corpus at `https://<stack>/api/docs` describing the stack rather than the
binary. Both as cross-links, in the page's existing style — the corpora stay
separate, they just now know about each other.
…./ links

Review-pass remediation. parse_summary was a line scan while mdBook parses
CommonMark, so a SUMMARY entry commented out with a MULTI-LINE <!-- -->
block — the natural way to temporarily unpublish a section — kept every
guardrail green while mdBook dropped the page: embedded, searchable,
deliberately unpublished, silently exempted from the closed-set policy
(reproduced before fixing; the same-line form already failed closed).
Comment spans are now stripped before the scan, newlines preserved so
depth arithmetic is unaffected, unterminated comments run to end-of-input
— and docs_tree stops listing commented-out chapters as a side effect.
A ./ link prefix is normalized away too: mdBook accepts it, embedded
paths never carry it, and unnormalized it produced a guardrail failure
claiming a published page was unpublished.

Also: ai/claude-code.md no longer overstates the fluree-cli plugin's
wiring (it registers docs-only, not memory), and the index's redundant
post-include filters are labeled belt-and-braces rather than load-bearing.

@bplatz bplatz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@aaj3f
aaj3f merged commit 06bb253 into main Aug 17, 2026
20 of 21 checks passed
@aaj3f
aaj3f deleted the feat/docs-corpus-scoping branch August 17, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants