Skip to content

[Spec] AST-046: rules for splitting a docs topic into a namespace - #7210

Merged
josephfarina merged 6 commits into
mainfrom
spec/docs-tree-splits
Oct 9, 2026
Merged

josephfarina merged 6 commits into
mainfrom
spec/docs-tree-splits

Conversation

@josephfarina

@josephfarina josephfarina commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Approving makes the whole AST-046 record current, not only these three rules. Everything already in it becomes current too: FR1–FR5 and FR7–FR12 (doc identity and routes, one home per doc, unique routes, one-level astryx docs reads, the topic list, Doctor's tree checks, the CLI's own tree, section-level search, integrations in the tree, and the Unorganized level) and decisions DEC-1–DEC-4.

The one behavior decision: Reading one section of a split topic: when exactly one guide has the section, it returns it, as it did before the split. When the same title fragment matches in two guides, it used to guess (first match); now it asks (error with suggestions). Fine?

Joey approved the four docs pieces on 2026-10-08. FR6 states the namespace rule on its own terms: each guide's own section read picks that guide's section (within one guide it still returns its first match, as any topic read does); across guides, a section whose key is the query answers when exactly one guide returns it, otherwise a single guide's result answers, and anything else asks with suggestions. The no-break promise is limited to unambiguous reads inside the topic's own package: a title fragment that now matches in two guides asks instead of guessing, and references from other packages stay an open question (OQ2).

Exact decision needed

Three generic rules for the docs tree (spec:AST-046), so a split of a long docs topic into short guides is governed by a current record:

  1. When a flat topic may become a docs-tree namespace, and what the split must keep (new FR13).
  2. What astryx docs <namespace> <section> returns once a topic is a namespace (FR6, amended).
  3. How the docsite shows a root namespace (new FR14; replaces the non-goal that kept the docsite on flat pages).

Existing authority searched

  • spec:AST-046 (draft) owns the tree, routes, and astryx docs reads. Its FR6 failed every section argument on a namespace, which breaks a released section read of any topic that becomes a namespace. Nothing in it said when a topic may become a namespace or how the docsite shows one; an open question left the docsite layout undecided.
  • spec:AST-047 (draft) owns links, moves, and the graph walk; FR13 relies on its FR9 and FR11 and changes neither.
  • spec:AST-017 FR45 (current): docs routes are mutable data and docs response schemas are contractual. FR13 and FR6 keep more than FR45 requires; nothing here relaxes it.
  • architecture:cli-surface INV25 and INV26 (current): unchanged; INV26 still describes the tree and its one-level reads.
  • Open pull requests touching AST-046, AST-047, or docs/architecture/cli-surface.md: one touches the architecture record for an unrelated rule; none touches this record.

Decision

  • FR13 — A flat topic becomes a namespace without breaking an unambiguous read. Allowed only when: the namespace takes the topic's name (route unchanged, no flat topic keeps the name); every section lands in exactly one guide with its title and id unchanged, and no two guides share a section key; each guide answers one task or decision; every link, {@link} target, and token reference in the provider's docs still resolves (a token reference to the namespace reads its guides as one topic, in tree order); --dense/--zh reads keep their text; each piece of content appears once in the topic list, search, and data.
  • FR6 — A section read names one section. astryx docs <namespace> <section> returns the section when exactly one guide below the namespace has it, taking from each guide the section its own section read returns; across guides, a returned section whose key is the query wins when exactly one guide returns it, otherwise a single guide's result answers, in the same docs.detail.section shape. None, or several at the deciding step: ERR_UNKNOWN_SECTION, with suggestions naming the guide routes. A typed doc still refuses a section argument.
  • FR14 — The docsite shows a root namespace as one page. One page at the namespace's slug: its own content, then every guide in tree order, as astryx docs <namespace> --depth all --detail full returns it. Guide and nested-namespace slugs are temporary redirects to their place on that page. A namespace whose slug is a package's page keeps per-guide pages. Sidebar group: the namespace's category, else foundations when every guide is foundations, else guide. No page for a namespace with no guide below it. The build fails on a slug that is both a page and a redirect.
  • DEC-5, DEC-6, and DEC-7 record why; the owner is their decider (josephfarina, 2026-10-08).
  • OQ2 is new: what another package's doc reads when it links to, extends, or replaces a topic that becomes a namespace. FR13 can only move references inside the topic's own provider.

Rejected alternatives

  • Keeping the flat topic beside the namespace, as an alias or a data copy (DEC-5): the name has two owners, and lists and search show the content twice.
  • Failing every section argument on a namespace (DEC-6, the old FR6): released section reads break for each split topic.
  • Returning the first match in tree order (DEC-6): it picks a guide silently when two match.
  • One docsite page per guide (DEC-7): every split topic's address moves and its page thins.

Claim scope and non-goals

  • Governs only FR6, FR13, FR14 and the decisions behind them. The other requirements are unchanged apart from rubric wording fixes (see R1).
  • DEC-1's text now says the docsite follows the tree only as far as FR14 states. Its decision (CLI first, docsite later) is unchanged.
  • Not governed: page design, how the docsite shows flat topics, and the internals of the compiler or the docsite build.
  • Compatibility note for review: a title fragment found in two guides now fails with suggestions, where the flat topic returned the first match. An exact key held by one guide always resolves.

Owner approval

The owner approved this record's content on 2026-10-08. The head carries the approval commit: authority: current, approved_by: josephfarina, approved_at: 2026-10-08, and the owner as decider on DEC-5 to DEC-7; pnpm check:knowledge passes with it. The PR is ready, and /approve-spec <head sha> on the exact head completes the owner gate. That makes the whole record current, not only these three rules.

Evidence and implementation relationship

  • FR6 applies each guide's own section read, then a cross-guide rule; it does not change how a topic's section read picks within one topic.
  • FR14 describes the docsite's current behavior on main (apps/docsite/scripts/docs-pages.mjs and generate-data.mjs, with their page and route-resolution tests). No implementation is in this PR.
  • The FR6 change and FR13's language and single-copy rules need CLI work. That work goes in its own code PRs once the rules are approved.
  • Test case outside the record: the open docs-tree split pull requests can each be checked line by line against FR13.

Writing rubric results

  • R1 narration: three found and fixed. Current-state impact opened with "Before this record…" (deleted). FR11 had a release-history parenthetical (removed, rule unchanged). FR9's "the old flat name … is gone" and FR8's "these checks are new" are now present tense. The new text uses no past-change wording, except FR6 and FR13 naming what a read returned before a split, which is the rule's subject.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. The verification rows name tests and states.
  • R4 rejected alternatives over one line or outside a decision: four, each one line inside DEC-5, DEC-6, or DEC-7.
  • R5 pull request or issue references remaining: none (searched for # followed by digits, /pull/, /issues/).
  • R6 ruled open questions still listing options: one found. The docsite-layout question listed "listed or inlined" and is answered by FR14, so it moved into DEC-7. OQ1 is unanswered, and OQ2 is new and lists no options.

Scope

  • This PR contains specification records only.
  • It records observable behavior and preserves equivalent internal implementations.
  • Any named internal mechanism is intentionally public, names its dependent caller/system, and explains why an equivalent implementation would not satisfy the contract.
  • Verification states the evidence layer and failure signal without prescribing CI job/workflow topology.
  • It records one intentional durable decision, not a rescue for a separable tagalong.
  • The canonical knowledge owner, affected current claims, and overlapping open work are named; any ownership collision is resolved or called out for human decision.
  • Adjacent API, visual, accessibility, composition, and implementation facts remain outside scope unless this exact decision depends on them.
  • Public text and artifacts contain no internal Meta context.

Validation

  • pnpm check:knowledge: passes on the head, with the record current.
  • Prettier: prettier --check passes on the record.
  • git diff --check: clean.
  • scripts/check-knowledge.test.mjs and .github/scripts/spec-owner-reconcile.test.mjs: 160 tests pass.

Adds the generic rules a docs-tree split follows (FR13), lets a section
read on a namespace resolve through its guides (FR6), and states how the
docsite shows a root namespace (FR14). The record stays draft for owner
review.
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 9, 2026 4:47am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 9, 2026
@astracat-bot

astracat-bot Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🔄 In progress (for maintainers only) Oct 9, 2026, 5:06 AM UTC

@josephfarina
josephfarina marked this pull request as ready for review October 9, 2026 03:25
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

View Storybook for this PR · View Sandbox for this PR

Current run: The current change has no visual or preview-producing scope. Visual checks are not applicable; preview links are not shown.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot 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.

This change is waiting on a maintainer decision before it can be approved.

The proposal would make the docs-tree record governing and settle three useful rules: when a flat topic may split into a namespace of guides, how a section read resolves through those guides, and how the docsite shows a namespace as one page. The split and paging rules fit the existing route and response contracts, the paging description matches how the site already behaves, and validation passes. Approval, though, needs an engineering owner to approve the whole record as governing on the exact head through the repository's owner gate, which is still pending. Automated review cannot take that step.

Two corrections should land before the text governs:

  • The section-lookup description says a topic read already looks up by key first and then by title. Today a topic read returns the first title-substring match and only falls back to keys (key-first applies only with localized titles). Please restate the namespace rule as its own cross-guide precedence and name where it differs from within-topic behavior, including two title matches inside one guide.
  • The repeated promise that every released read keeps working needs its exceptions beside it: an ambiguous title query across two guides now errors instead of returning the first match, and references from other packages remain an open question.

Once a maintainer is ready to make the record governing, ideally with those fixes on the head they approve, the follow-up implementation work can proceed against clear rules.

[Automated review]

@astracat-bot astracat-bot Bot 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.

This change is waiting on a maintainer decision before it can be approved.

The proposal would make the docs-tree record governing and settle three useful rules: when a flat topic may split into a namespace of guides, how a section read resolves through those guides, and how the docsite shows a namespace as one page. The lookup rule is stated exactly on its own terms, and the compatibility promise is properly limited to unambiguous reads inside a topic's own package, with ambiguous title queries across guides and cross-package references named as exceptions. The paging description matches how the site already behaves, and validation passes. Approval still needs an engineering owner to approve the whole record as governing on the exact head through the repository's owner gate, which is pending. Automated review cannot take that step.

One addition should land before the text governs: the split rules keep each section's title and authored id, but readers address sections by a derived key that is allocated per document and can change when sections move between guides. Please require each section's addressed key to stay unchanged across a split (pinning it explicitly when regrouping would change it), so a split that follows every listed rule cannot break a released key read.

Once a maintainer is ready to make the record governing, ideally with that addition on the head they approve, the follow-up implementation work can proceed against clear rules.

[Automated review]

@astracat-bot astracat-bot Bot 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.

This change is waiting on a maintainer decision before it can be approved.

The proposal would make the docs-tree record governing and settle three useful rules: when a flat topic may split into a namespace of guides, how a section read resolves through those guides, and how the docsite shows a namespace as one page. The lookup rule is stated exactly on its own terms, the compatibility promise is properly limited to unambiguous reads inside a topic's own package (with ambiguous title queries across guides and cross-package references named as exceptions), and the split rules now also keep each section's addressed key unchanged, pinning it explicitly when regrouping would change it. The paging description matches how the site already behaves, and validation passes. Approval still needs an engineering owner to approve the whole record as governing on the exact head through the repository's owner gate, which is pending. Automated review cannot take that step.

Once a maintainer is ready to make the record governing, the follow-up implementation work can proceed against clear rules.

[Automated review]

@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 6770522

@github-actions github-actions Bot added spec-auto-merge Auto-merge was enabled by the spec owner gate and removed needs:spec-owner-review Current knowledge records await owner approval labels Oct 9, 2026
@josephfarina
josephfarina merged commit cf59be8 into main Oct 9, 2026
41 checks passed
@github-actions
github-actions Bot deleted the spec/docs-tree-splits branch October 9, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 67705220 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. spec-auto-merge Auto-merge was enabled by the spec owner gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant