Detail for the ONE Data maintainers of this repository, covering the source registry, the build and its branches, and build failures. Contributors writing pages need only CONTRIBUTING.md.
Add a row to sources.yaml with name, repo, ref, docs_dir, and the path the documentation should publish at. A row with kind: external points at a package that publishes its own documentation elsewhere, and carries a url instead of a docs_dir.
A row with kind: skill publishes a repository of agent skills, such as skills. It does not need a sidecar. The build walks docs_dir and publishes each directory that holds a SKILL.md as a skill page at <path>/<directory>, with each file in its references/ as a page at <path>/<directory>/references/<name>. Directories whose names start with _ stay out. The row must set docs_dir, path, and title, and it may not set exclude. It may set internal_dir, a second directory the build walks the same way. Skills under docs_dir are offered for install. Skills under internal_dir are published at the same <path>/<directory> and are not offered. A directory name may appear under only one of the two. Until the repository has the internal_dir directory, the build warns and reads docs_dir alone. Its hub.yaml mount becomes one group titled by title. A categories.yaml in docs_dir lists skills under sources or under a domain in domains, and each category becomes a group inside the mount, titled in sentence case: Sources, and Domains with a group such as Sovereign debt inside it. Categories and the skills in them follow the file's order. Skills the file leaves out come first, in directory order, and without the file that is every skill. Each skill page opens with a header the build writes from the front matter: the skill's name and the first sentence of its description. For a skill under docs_dir, whatever its category, the build writes a zip to corpus/<name>/<directory>.zip, holding <directory>/SKILL.md and <directory>/references/*.md as committed, records the zip on the page's manifest entry as bundle_path, and adds a line to the header that links to the hub page on using skills in your own agent and to the zip. A skill under internal_dir gets no zip, no bundle_path, and no such line.
If the repository needs to sit under a grouping heading, or nest alongside another package, add it to hub.yaml's nav as a mount (or external) entry. A grouping heading such as bblocks or ODA lives only in hub.yaml, since no source repository declares it.
Every source repository is public, and the build and the registry-health workflow clone and query them without credentials. A private repository cannot be registered.
To register a repository without building it yet, set enabled: false and a reason. A disabled row still loads and is reported by name. Turning it on means enabling the row and adding its hub.yaml mount, since a mount whose source is disabled fails the build.
To take most of a repository but hold some pages back, list glob patterns under exclude. They match the docs-root-relative path, so reference/* keeps a whole section out and changelog.md keeps one page out. Use it for pages that cannot render outside their own site, such as an mkdocstrings reference section. A pattern matching no nav entry fails the build, so a pattern left behind by an upstream rename is reported.
uv sync
uv run python scripts/build.pyThe build clones every enabled repository over HTTPS without credentials, normalises what it finds, and writes corpus/ and manifest.json.
corpus/ and manifest.json are generated output that lives on the corpus branch. A push to dev runs the same build in .github/workflows/build.yml, beside the checks in .github/workflows/ci.yml, and the publish-corpus-branch job commits the result there when a page changed and every check passed. Each commit records its run in a Build-Run-Id trailer, and the job refuses to publish when a newer run built a corpus or published the branch, so re-running an old run cannot put older pages back. registry-health.yml checks that branch for external link rot. The DFO site reads the site corpus from the docs bucket instead (below). A pull request into dev or main, draft or ready, runs the checks and the build and publishes nothing. The ci job in build.yml passes only when every check and the build passed, and it is the check for the dev and main rulesets to require.
docs/contracts/docs-corpus.md is the contract for the corpus the website reads from the docs bucket: its file layout, meta.json, front matter, block syntax, roadmap files, version archive and current.json pointer.
--site-out <dir> also writes that layout into <dir>, built from the same pages as corpus/ in the same run: each page at its URL path, one meta.json per folder, the skill zips, corpus.json, and the roadmap as roadmap.json and roadmap/<track>.json, which the website's Roadmap page reads. required-pages.yaml lists the pages the website links to from outside the docs, and redirects.yaml lists moved pages and is copied into corpus.json. baseline-urls.yaml lists the 108 pages and 14 skill zips production served before the bucket publisher: the build refuses a corpus that drops one of its pages without a redirects.yaml row, or one of its zips. A path leaves the list only with a redirect or by an owner's decision. The build replaces <dir> whole, so it refuses a directory that holds files and no corpus.json. The CI build passes it.
The build also runs in CI every hour, at 17 minutes past.
uv run python scripts/build.py --out published --site-out published-site
uv run dfo-docs-publish --site-out published-site --bucket ./staging-bucket --outputs staged.txt
uv run dfo-docs-publish mark-good --bucket ./staging-bucket
uv run dfo-docs-publish promote --from ./staging-bucket --bucket ./production-bucket \
--version <version> --sha256 <sha256>
uv run dfo-docs-publish mark-good --bucket ./production-bucket
uv run dfo-docs-publish restore --bucket ./production-bucket --version <version> --reason "<why>"
uv run dfo-docs-publish resume --bucket ./production-bucketdfo-docs-publish uploads a site corpus to a docs bucket as the version its corpus.json names, in the layout the contract gives under "Published versions": the skill zips under versions/<version>/files/, then versions/<version>/version.json (the archive's SHA-256 and the content digest), then versions/<version>/corpus.tar.gz, then current.json at the bucket root. The pointer moves only after every object of the version is written, so a failed upload leaves the site on the version it had. --bucket takes gs://<name>, reached with Application Default Credentials, or a local directory that stands in for a bucket. Requests to Cloud Storage that fail with 408, 429 or a 5xx status, or with a connection error, are retried up to five times with backoff.
A version is complete once its corpus.tar.gz exists, and running the same publish again picks up where a failed run stopped. With no archive in the bucket, the run uploads the version, deleting any object of that version the corpus does not hold, which completes a partial upload. With the same archive bytes already there, it writes only current.json, which resumes after a failed pointer write and turns a rollback to a kept version into a pointer move. With current.json already naming the version and its archive, it writes nothing and says so. With current.json naming a version whose content_sha256 equals the corpus's content digest, it also writes nothing: the digest covers every page, meta.json and skill zip, and corpus.json and the roadmap files without version, generated_at and generator_commit, so hourly builds of unchanged sources leave one version and leave current.json alone. The corpus checks, the baseline-urls.yaml check among them, run before that comparison, so a changed baseline is checked even when the content is unchanged. --outputs <file> appends version= and sha256= lines naming the version the bucket serves after the run, and good_version= and good_sha256= lines naming the version good.json marks (empty when none is), in the format of $GITHUB_OUTPUT; it fails with exit 1 when the bucket has no current.json. An archive with other bytes under the same version id is a different build, and the run refuses it, because a version is never rewritten.
It refuses to publish, and writes nothing, when a corpus check fails, when the bucket holds the version with another archive, when the version is older than the live one, or when a page the live version serves is missing from the new corpus without a redirects.yaml row, or a skill zip it serves is missing. The baseline check of baseline-urls.yaml runs on every publish and promote, the first one to an empty bucket included, and reads the file from --repo-root (default: the current directory). --rollback lets a version older than the live one through. It reads the live version's pages from the archive current.json names and refuses when that archive is missing or does not match the pointer's SHA-256. --no-live-check skips that read to replace a broken live version, and the missing-page check does not run then.
dfo-docs-publish promote --from <staging> --bucket <production> --version <version> --sha256 <sha256> copies that version from the staging bucket into the production bucket unchanged, under the same version, with the same files and the same archive bytes. It never reads staging's current.json. It refuses when staging's good.json is absent or marks another version or SHA-256, unless --allow-unmarked is passed, and when staging lacks the version's archive or holds it with another SHA-256. On the production side it follows the same rules as a publish: a version production already holds with the same archive gets only a pointer move, a version production already serves is left alone, and another archive under the same version id, a version older than production's live one (unless --rollback), a dropped live page without a redirect, a dropped live skill zip, or a dropped baseline-urls.yaml page or zip is refused. Publish and promote check paused.json again just before writing current.json, so a restore that lands during an upload keeps its pointer. It writes production's current.json last, so rerunning a promote that succeeded, or one whose pointer write failed, finishes cleanly.
After the pointer moves, both commands delete old complete versions and keep the live one, the one it replaced, the newest others up to --keep versions besides the live one (default 2), and the version good.json names. The version is published by then, so a failed listing or delete prints a warning and the command still exits 0. A partial version is never pruned. While good.json is absent or cannot be read, nothing is pruned and the command warns that a version needs mark-good, so a run of builds the website rejects never prunes the last version it accepted.
dfo-docs-publish mark-good --bucket <bucket> writes good.json naming the live version after checking its archive against current.json and version.json; run it after a smoke test of that version passes. --version and --sha256 mark another kept version, and --outputs <file> appends the live and marked versions and their archive SHA-256s to a $GITHUB_OUTPUT file. Pruning keeps the marked version through any number of later publishes, until a new mark replaces it.
dfo-docs-publish restore --bucket <bucket> --version <version> --reason "<why>" points current.json at a version already in the bucket. It checks the version's archive against the SHA-256 in its version.json, or --sha256 for a version published before version.json existed (previous_sha256 in current.json gives it for the version the live one replaced). It rebuilds nothing and skips the missing-page and baseline checks, so it can undo a release that added a page. It writes paused.json before current.json and prunes nothing. While paused.json exists, a publish writes nothing, prints the restore's version and reason, and exits 0, and a promote to that bucket refuses with exit 1; --ignore-pause publishes or promotes anyway. dfo-docs-publish resume --bucket <bucket> deletes paused.json.
In CI, .github/workflows/build.yml publishes every build of dev whose ci job passed to the staging bucket in the publish-site-corpus job, from GitHub Environment corpus-staging, and uploads the version staging then serves, the version staging's good.json marks, and their archive SHA-256s as the staged-version artifact. Scheduled runs respect a pause; a workflow_dispatch with ignore_pause set passes --ignore-pause. A push to main builds nothing: the staged-version job reads the newest staged-version artifact of a dev run, takes the version marked good there, fails when staging has none, and shows the version and hash in its summary. To mark staging good, run .github/workflows/build.yml on dev from the Actions tab (or gh workflow run build.yml --ref dev -f mark_good_version=<version> -f mark_good_sha256=<sha256>) after the smoke test passes. That run builds nothing: its mark-good job, from corpus-staging, runs dfo-docs-publish mark-good with that version and hash and uploads a staged-version artifact recording the mark, so the next push to main promotes it. The staged-version job holds no Google credentials, which is why the mark reaches it through an artifact. The promote-site-corpus job, from Environment corpus-production and after its approval, runs dfo-docs-publish promote with that version and hash, so production serves the version the approver saw. Both jobs sign in through Workload Identity Federation as their environment's docs publisher service account. Each environment holds the variables GCP_WIF_PROVIDER, DOCS_CORPUS_BUCKET and DOCS_PUBLISHER_SERVICE_ACCOUNT, which dfo-infra's scripts/handoff.sh <dfo-dev|dfo-prod> docs-corpus writes. corpus-production also needs DOCS_CORPUS_STAGING_BUCKET, the staging bucket's name, and the production publisher service account needs to list and read objects in the staging bucket (roles/storage.objectViewer on that bucket). Pull requests build and check the site corpus and publish nothing.
A build exits 3 when the corpus published and the site corpus did not, because a site corpus check failed or required-pages.yaml, redirects.yaml or baseline-urls.yaml could not be read. CI then updates the corpus branch when every check passed, publishes nothing to the bucket, and fails the build and ci jobs.
The build checks every enabled repository before it exits, so the log names every failure in one run.
The repository was renamed, made private, or deleted. Fix the repo field in sources.yaml, or disable the row.
The source repository renamed its docs_dir. Update docs_dir in sources.yaml to match.
A repository is publishing mkdocstrings-generated reference through the normal build path. Exclude the pages that carry it, or move the whole repository to the self-published tier with kind: external.
The source would publish nothing. In a zensical.toml this is usually a nav array written after a [project.<table>] header, which TOML scopes into that table instead of into [project]. Move the array above every sub-table header.
Only with --site-out. The build names the page and the link. Fix the link in the source page, or restore the page it points at. Links to the rest of the site start with /, and links to other sites with a scheme.
Only with --site-out. The docs refuse HTML outside code blocks, since they share an origin with signed-in sessions. The build names the file and line. Rewrite the markup as Markdown, or put it in a code block.
Only with --site-out. A page other than the home matches no paths entry of the tabs list in hub.yaml, a path appears in two tabs, or a path names no page or folder. Add the folder to a tab, or fix the path. The matching rule is in the contract ("Tabs").
Only with --site-out. The page is in the corpus but the nav never reaches it. Add it to its source's nav (the sidecar or hub.yaml).
Only with --site-out. A page in required-pages.yaml is gone, and the website links to it. Restore the page, or move the website's link first and then drop the row.
A page or skill zip in baseline-urls.yaml is gone. Links outside the site may point at it. Restore it, or add a redirects.yaml row for a moved page. Drop the row only on an owner's decision.
Only with --site-out. A redirects.yaml row whose to is not a page needs the new path of the moved page, and a row whose from is a page needs removing, since the page answers at that URL.
The build names the directory or file. Add the SKILL.md, fix its front matter so it carries a name and a description, or move the directory out of the row's docs_dir and internal_dir if it is not a skill.
The build names both. A skill's directory name is its page address, so keep one.
The build names the file. Give sources a list of skill directories and domains a mapping from each domain to such a list, and list each skill once.
A page an exclude row named was renamed or removed upstream. Update the pattern in sources.yaml, or drop it if the page is gone for good.
Only with --site-out. A hub page sets template: essay without a date as YYYY-MM-DD, sets another template or status value, repeats a tag, sets template: essay-index anywhere but tech-blog/index.md, or sets author or tags without template: essay, date without template: essay, or status without template: essay or template: pattern. The build reads these keys from hub pages only, and drops them from a source repository's pages. The build names the file. The rules are in the contract ("Essays").
Only with --site-out. A hub page sets template: pattern with blocks that is not a list of page paths, a block that names no page, or a status other than draft, sets template: pattern-index anywhere but build/patterns/index.md, or sets blocks without template: pattern. Fix the path, or add the page the block names. The build names the file. The rules are in the contract ("Patterns").