Skip to content

docs: define the external site publication contract - #222

Merged
tmoreton merged 7 commits into
strands-agents:mainfrom
tmoreton:agent-tasks/external-docs-contract
Nov 3, 2026
Merged

tmoreton merged 7 commits into
strands-agents:mainfrom
tmoreton:agent-tasks/external-docs-contract

Conversation

@tmoreton

@tmoreton tmoreton commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Description

Box documentation changes with the implementation, but external documentation sites currently copy page metadata and navigation by hand. This lets the website and the repository drift.

This change adds a schema-versioned docs/site-manifest.json for every publishable user page. It gives external consumers stable page IDs, source paths, routes, display metadata, navigation order, and a preview status while Markdown remains the source of truth.

A Rust integration test validates the contract, rejects unsafe or incomplete manifests, and requires every docs/user page to be declared. A focused Ubuntu CI job runs for manifest, retirement-registry, and publishable-page changes. On pull requests, it compares the base identity contract and append-only retirement registry. Page removals reserve both the old ID and route; route moves reserve the old route while retaining the stable page ID. Retired values cannot be reused. This is an approved machine-readable documentation interface; it does not change a runtime API.

Related Issues

None.

Type of Change

New feature

Testing

  • cargo test -p strands-box --all-features
  • cargo test -p strands-box --test site_manifest --locked --all-features (27 passed)
  • cargo clippy -p strands-box --all-targets --all-features
  • cargo fmt -p strands-box --check
  • test-integ/run.sh (GREEN: 121 passed, 12 declared macOS skips, 0 failed, 0 errors)

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions Bot added Area - Release documentation Improvements or additions to documentation labels Oct 29, 2026
@tmoreton
tmoreton marked this pull request as ready for review November 2, 2026 17:00
Comment thread .github/workflows/ci.yml Resolved
Comment thread docs/site-manifest.json Resolved
Comment thread docs/site-manifest.json Resolved
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Comment

The validator is strict and well bounded. But two parts of the PR's own goal are not complete. Titles can still drift from the Markdown, and no committed page tells a consumer what the contract is. The CI change also makes every docs-only edit pay for the full Rust matrix.

Review categories
  • Correctness of the goal: The manifest keeps a second copy of display metadata, and no check ties that copy to its source.
  • Repository rules: A new external interface and a new prose location came in, but the page and the "What a change updates" row that AGENTS.md requires for them did not.
  • CI scope: The rust filter grew past its documented scope ("excludes docs-only changes"). A narrow job would give the same protection.
Assumptions and rules checked that held
  • Coverage: every non-README .md under docs/user/ (including tutorials/ and policy/) must be declared, and an extra or missing entry fails (every_user_page_must_be_declared).
  • Symlinked or out-of-tree sources are refused in the same way by validate_source and by collect_published_sources.
  • If a page moves out of docs/user/, the deleted path still selects the job.
  • Slugs refuse .., a leading /, and uppercase. IDs, sources, slugs, and (group, order) pairs are unique, and groups are contiguous.
  • An unknown field or an unknown status is refused (deny_unknown_fields, enum).
  • No new dependency (serde and serde_json are already in strands-box), and the runtime crate surface does not change.
  • At 4c1598e, cargo test -p strands-box --test site_manifest --all-features passes all 8 tests.

The fixture-mutation tests make each refusal easy to see and easy to extend.

Comment thread docs/dev/site-manifest.md Resolved
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Comment (re-review at e9274ba; the earlier review was at 4c1598e)

e9274ba fixes two of the three earlier threads. The third is now a documented choice. There is one new non-blocking suggestion inline, about the stability rule in the contract.

Status of earlier threads
  • Title drift: Fixed. load_source_title ties title to the first-line H1, and the 6 H1s now match. The H1 rename that passed before (# Telemetry → # Export traces and metrics) now fails with "must match the first H1".
  • Contract page / eighth prose place: Fixed. docs/dev/site-manifest.md, the docs/README.md section, and the new AGENTS.md place and rows now cover the fields, the version rule, the status, and how links are resolved.
  • CI scope: Not changed, but the ci.yml comment now states that publication paths run in the Rust job on purpose. The full-matrix cost on a docs-only edit is still there. I do not ask for more here.
Assumptions and rules checked that held
  • The title check reads the first line of each of the 19 sources, and each H1 is plain text, with no code span or link.
  • str::lines strips CRLF, and a page that does not start with # fails loudly. It is not skipped.
  • unknown_fields_are_refused covers the manifest, product, a page, and nav.
  • All links to the renamed pages still resolve, because only the H1 text changed and no anchor links to an H1.
  • At e9274ba, cargo test -p strands-box --test site_manifest --all-features passes all 10 tests.

The fix for title drift is minimal, and it is pinned by a test.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

Assessment: Comment (re-review at 9c4beb2; the previous review was at e9274ba)

9c4beb2 resolves the CI-scope thread. A docs-only edit now runs only the focused site-manifest job on Ubuntu, and rust is back to its documented scope. I found nothing new. The id/slug stability suggestion on docs/dev/site-manifest.md is still open and has no reply. It is non-blocking.

Assumptions and rules checked that held
  • Every change that can break the manifest test reaches a job that runs it. A prose edit under docs/user/ and a change to docs/site-manifest.json select site-manifest. A change to site_manifest.rs or ci.yml selects both jobs. A source change in crates/ selects rust, whose workspace cargo test includes this test. A page moved out of docs/user/ is selected through its deleted path.
  • On push and workflow_dispatch, the job runs unconditionally, which matches rust's if.
  • ci-gate lists site-manifest in both needs and allowed-skips. I parsed the YAML to check this.
  • The new job needs no setup step. On Linux, rust-test-lint.yml installs nothing besides the toolchain, which comes from rust-toolchain.toml. The checkout and cache pins match the existing jobs.
  • ci_runs_validation_for_manifest_and_user_page_changes now pins both sides of the split: the paths must be present in site_manifest and absent from rust.
  • At 9c4beb2, cargo test -p strands-box --test site_manifest --locked --all-features passes all 10 tests.

The test that pins the split keeps the change from regressing silently.

kevin-orellana
kevin-orellana previously approved these changes Nov 2, 2026
Timothy Moreton added 6 commits November 3, 2026 10:15
## Problem

The Box user guide has no machine-readable publication contract. An external site must copy page routing and metadata by hand, so the two copies can drift and a new user page can remain unpublished.

## Solution

Add a schema-versioned preview manifest for every publishable user page. Keep page identity, source, site slug, display metadata, and navigation data in one strict machine contract.

Validate the contract in the existing Rust test suite. The test refuses unknown fields, unsafe or missing sources, duplicate identifiers or slugs, invalid navigation positions, and incomplete user-guide coverage. Make manifest and user-page changes select the Rust CI job.

The title, description, and navigation strings are publication metadata required by the external site contract. They do not replace the user guide prose.

## Tests

`cargo test -p strands-box --test site_manifest --all-features` passed all 8 tests.

`cargo fmt --all --check` passed.

`cargo clippy --workspace --all-targets --all-features` passed with the allowances in `justfile`.

`cargo test --workspace --all-features` passed all non-ignored tests and doctests. `just check` was unavailable because `just` is not installed, so its three checked-in recipes were run directly.

The final feature-critic review found no findings.
Comment thread crates/box/tests/site_manifest.rs Resolved
Comment thread crates/box/tests/site_manifest.rs Resolved
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Assessment: Comment (re-review at 7e4715e; the previous review was at 9c4beb2)

7e4715e is a rebase onto a newer main. The PR's own change is the base-manifest compatibility check, which addresses the earlier id/slug stability thread, plus new tests for the schema version and navigation. The check catches the accidental cases. It is stricter than the contract in two cases, and I proved both with SITE_MANIFEST_BASE (inline): a page removal or route move is always refused, and a base manifest in an older schema cannot be parsed.

Assumptions and rules checked that held
  • A source move that keeps id and slug (for example monty.md → python.md) passes. A change to the title, description, nav, or product.status also passes.
  • A changed slug, a swapped slug, and a renamed id on an existing slug are each refused, with a message that names the pair.
  • On this PR, main has no manifest, so git cat-file -e skips the check. A failed fetch stops the step loudly instead of skipping the check.
  • The step runs only on pull_request, and base.sha is compared against the merge checkout of github.sha.
  • repository_validation_uses_supplied_base_manifest re-runs the test binary to show that the env var is actually used.
  • At 7e4715e, cargo test -p strands-box --test site_manifest --locked --all-features passes all 17 tests without a base, and passes repository_manifest_is_valid with the current manifest as its own base.

The CI check of the base manifest is the right place for this rule.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Assessment: Approve-level Comment (re-review at 0ec4a5f; the previous review was at 7e4715e)

0ec4a5f fixes both findings from the last review, and I found nothing new.

  • Removal and route moves: Fixed. docs/site-manifest-retirements.json now permits both edits once they are recorded, and it is append-only against the base.
  • Base parsed with the current schema: Fixed. BaseManifest and BaseRetirements read only the fields the rules need, and they accept unknown fields.
Assumptions and rules checked that held

I reproduced each case with SITE_MANIFEST_BASE and SITE_MANIFEST_RETIREMENTS_BASE:

  • Removal and move together: I deleted tutorials/pi.md and retired its id and slug. I also moved python to reference/monty and retired reference/python. All 27 tests pass.
  • Next PR: Against that new base, moving python back to reference/python and dropping the retirement is refused (retired slug reference/python must remain reserved).
  • Older base schema: A base with an extra page field, an extra top-level field, and schemaVersion: 0 still passes the compatibility check.
  • Edits that are still refused:
    • a slug moved to another id in the same PR, even without a retirement (must remain assigned to id);
    • a retired id that is still on a current page;
    • a removal whose id is retired but whose slug is not.
  • CI wiring:
    • A change to the registry alone selects site-manifest.
    • On this PR, the base has no registry, so the base registry defaults to empty.
    • On push, the current registry is still checked against the manifest.
  • Repository rules: The root AGENTS.md lists the registry as a frozen surface. README.md and docs/dev/site-manifest.md describe the same rule.
  • Tests: At 0ec4a5f, cargo test -p strands-box --test site_manifest --locked --all-features passes all 27 tests.

The registry makes every retirement an explicit, reviewed edit, and retired values stay reserved permanently.

@tmoreton
tmoreton merged commit 7633f90 into strands-agents:main Nov 3, 2026
17 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area - Release documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants