Skip to content

feat(docs): gate BReg tutorials with a runner that reads the page as its spec - #1572

Merged
jeremi merged 15 commits into
mainfrom
feat/tutorial-runner-pilot
Sep 26, 2026
Merged

jeremi merged 15 commits into
mainfrom
feat/tutorial-runner-pilot

Conversation

@jeremi

@jeremi jeremi commented Sep 26, 2026

Copy link
Copy Markdown
Member

Summary

This replaces the bash BReg tutorial gate (check-breg-tutorial.sh) with a Node runner in which the tutorial page is the specification. The runner replays a page's sh fences in document order, in one shell, from an empty reader directory. Each check sits on the page, as a fence annotation:

  • test-expect: the whole output of the preceding fence, with <name> placeholders.
  • test-excerpt / test-excerpt="<path>": a run of lines, or a JSON subset, found in that output or in a file.
  • test-edit: a diff block applied to the file it names, exactly as the reader sees it.
  • test-exit="N": a documented refusal.
  • test-skip="reason": a fence the replay cannot run.

Coverage comes from each page's frontmatter (tutorial_test: {toolset, after?, skip?, checkout?}). Every page under start/ or tutorials/ whose fences run breg/bregctl must either be replayed or say why it is skipped. node docs/site/scripts/run-tutorial.mjs --gate breg replays every journey, and --dry-run prints the plan.

The pages give the reader file contents and edits, not scripts that write files, so they still read as written for people.

What this PR replays

  • first-breg -> extend-a-registry-with-a-module, as one journey
  • derive-a-registry-from-publicschema. Replaying it found stale init output and a false claim that paths were omitted; both are fixed.
  • review-registry-changes, which starts in a copy of the checkout (checkout: true). Its old skip reason was stale.
  • Five BReg pages are skipped, each with a stated reason.

Also in this PR

  • The diff copy button copies the resulting file lines only.
  • QuickstartMeta prerequisites link to the pages that cover them.
  • The CI breg-tutorial job runs the runner's own tests and then the gate. check-breg-tutorial.sh and its test are removed, and the CI routing and gates inventory are updated.

Verification

  • npm test in docs/site: 661 pass.
  • test_ci_changes.py: 119 pass. check-gates-inventory.py passes.
  • A real end-to-end gate with locally built breg/bregctl: gate PASS: 3 journeys replayed, 5 pages skipped. Every bregctl dev session was stopped, and no tokens appeared in the log.

Known limits

  • Fence output is written to the log after each fence finishes, not streamed. After an interrupt, the log shows the running fence's output so far.
  • test-exit checks only the fence's final status.
  • Markdown tables, such as the derive README field table, are not checked.

Follow-ups

The Casework, Evidence, Relay, and Discovery tutorial gates move to this runner in one PR per product.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T06:42:35.248590Z 46ce755 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jeremi
jeremi enabled auto-merge September 26, 2026 05:51

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f0d9304513

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/site/scripts/tutorial-runner/gate.mjs Outdated
Comment thread docs/site/scripts/tutorial-runner/gate.mjs
Comment thread docs/site/scripts/run-tutorial.mjs Outdated
A Node runner reads the tutorial as the specification: sh fences run in
one shell in document order, test-skip names why a fence is left alone,
and test-expect output blocks are checked against what the fence above
printed. It runs beside check-breg-tutorial.sh until the two agree.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
A diff block titled with its file and marked test-edit is the change the
page asks for; the runner applies it at whatever indentation the file has
and refuses an edit that matches nowhere or more than once. test-exit
covers a refusal the page demonstrates, and pages given together replay in
one directory, so extend-a-registry-with-a-module continues from
first-breg as a reader does.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…t they quote

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…age runner

Each page under start/ or tutorials/ that runs breg or bregctl now declares
tutorial_test: the toolset, the page a reader finishes first, or why it is
not replayed. run-tutorial.mjs --gate breg replays first-breg and the module
tutorial as one journey and replaces check-breg-tutorial.sh in CI.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…gain

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…report init prints

The page showed a trimmed finding list the command no longer prints; the
replay caught it. The selection change is now the edit a reader makes.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…ts page does

A page that begins from a Registry Stack checkout sets tutorial_test.checkout,
and the runner starts it at the root of a copy of the tracked and unignored
files instead of an empty directory.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
The request excerpt now quotes the example file in the order it is written,
and the page shows the part of the explain report it describes.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…stopped a journey

A misspelt toolset, unreadable frontmatter, or a broken annotation on a skipped page now fails the gate by name. An interrupt reaches the running command and shows its output, a fence that exits its shell stops the journey on any page, a page bash cannot parse is blamed instead of the fence before it, and cleanup survives directories the journey locked.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…ncher

The routing comments and tests named a quickstart launcher and a deleted script; the gate runs the page runner, which starts bregctl dev.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
…al inputs

Every products/breg path already selects the BReg packages the replay builds, and no replayed binary links registry-evidence, so the comment saying it did is gone.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
A page running breg commands under another toolset, or skipping every
one of them, is now refused, and the journey script no longer sets
shell variables a page's fences could read or overwrite.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@jeremi
jeremi force-pushed the feat/tutorial-runner-pilot branch from f0d9304 to 6dfc284 Compare September 26, 2026 06:10

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6dfc28433a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/site/scripts/run-tutorial.mjs
A toolset that cannot be prepared fails every journey the same way, so
the gate now exits 2 at once instead of rebuilding it for each journey
and reporting an ordinary replay failure.

Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
@jeremi
jeremi added this pull request to the merge queue Sep 26, 2026
Merged via the queue into main with commit 04e2a6d Sep 26, 2026
55 checks passed
@jeremi
jeremi deleted the feat/tutorial-runner-pilot branch September 26, 2026 10:54
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