diff --git a/.claude/SESSION_CONTEXT.md b/.claude/SESSION_CONTEXT.md
index 697af9df..100e6eb7 100644
--- a/.claude/SESSION_CONTEXT.md
+++ b/.claude/SESSION_CONTEXT.md
@@ -9,7 +9,7 @@ Last updated: 2026-10-31
| Item | Value |
|------|-------|
| Branch | See PLAYBOOK Section 3 for the active worktree branch. |
-| Tests | **3120 passing** across 104 tracked test modules |
+| Tests | **3158 passing** across 104 tracked test modules |
| Coverage | 89% (2026-08-20 run, `pytest --cov=scrobblescope`) |
| Pre-commit | See PLAYBOOK Section 4's latest validation and deviations. |
| Batches 0-20 | **All complete.** PLAYBOOK Section 2 has the index: title, definition and log per batch. |
@@ -47,7 +47,7 @@ Last updated: 2026-10-31
- Current-batch entries in active log block: 0.
- Completed work packages in current-batch entries: none.
- Next expected work package: WP-0.
-- Latest validated test count: **3120 passed**.
+- Latest validated test count: **3158 passed**.
- Newest current-batch entry: none.
@@ -303,7 +303,7 @@ results-release-checks.js polls GET /api/release_checks?job_id=...
---
-## 6. Test structure (3120 tests)
+## 6. Test structure (3158 tests)
The per-file breakdown used to live here as a 40-row table. It was
removed on 2026-08-26: nothing read it, only the total is gated, and it
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 446e4e75..9ef2bf7c 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -13,7 +13,40 @@ on:
workflow_dispatch:
jobs:
- quality-gate:
+ # Decides whether the browser job can be skipped. Only a pull request can be
+ # docs-only, and it is judged on the whole pull request against its base:
+ # actions/checkout's default refs/pull/N/merge commit has the base tip as
+ # its first parent, so HEAD^1..HEAD lists what the pull request changes and
+ # not what the base gained since the branch was cut. A per-push diff would
+ # let a docs-only commit on top of a code pull request skip the browser job.
+ # Fail closed: any git failure leaves docs_only false. The path rules live
+ # in scripts/dev/ci_jobs.py, where the tests cover them.
+ changes:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ outputs:
+ docs_only: ${{ steps.classify.outputs.docs_only }}
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+ with:
+ fetch-depth: 2
+ persist-credentials: false
+
+ - name: Classify the changed paths
+ id: classify
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ run: |
+ set -o pipefail
+ docs_only=false
+ if [ "$EVENT_NAME" = pull_request ] && git rev-parse --verify --quiet 'HEAD^2' >/dev/null; then
+ docs_only=$(git diff --name-only --no-renames -z HEAD^1 HEAD | python3 scripts/dev/ci_jobs.py docs-only) || docs_only=false
+ fi
+ echo "docs_only=${docs_only}" >> "$GITHUB_OUTPUT"
+
+ checks:
runs-on: ubuntu-latest
# Least privilege (zizmor: excessive-permissions / artipacked). The job
@@ -114,6 +147,47 @@ jobs:
path: coverage.xml
retention-days: 14
+ - name: Security audit (pip-audit)
+ uses: pypa/gh-action-pip-audit@v1.1.0
+ with:
+ inputs: requirements.txt requirements-dev.txt
+ continue-on-error: true
+
+ # The slowest job (the frontend gate), run beside the cheaper ones so the
+ # run takes as long as it does. It is skipped only for a docs-only pull
+ # request; quality-gate below turns every other skip into a failure.
+ browser:
+ needs: changes
+ if: ${{ needs.changes.outputs.docs_only != 'true' }}
+ runs-on: ubuntu-latest
+
+ permissions:
+ contents: read
+
+ env:
+ # No provider secret is passed to this job. scripts/dev/frontend_gate.py
+ # supplies placeholders, and no step reads a real key. A step that ever
+ # needs one takes it in its own `env:`.
+ FLASK_ENV: development
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Set up Python
+ uses: actions/setup-python@v7
+ with:
+ python-version: '3.13'
+ cache: 'pip'
+ cache-dependency-path: requirements*.txt
+
+ - name: Install dependencies
+ run: |
+ pip install --upgrade pip
+ pip install -r requirements-dev.txt
+
- name: Read the runner image version
id: runner-image
run: echo "version=${ImageOS:-unknown}-${ImageVersion:-unknown}" >> "$GITHUB_OUTPUT"
@@ -135,8 +209,8 @@ jobs:
restore-keys: |
playwright-apt-${{ runner.os }}-${{ runner.arch }}-
- # Last on purpose. Starting a browser costs far more than a lint, a
- # rebuild or the suite, so every cheaper gate reports first.
+ # Starting a browser costs far more than a lint, a rebuild or the
+ # suite. This job is the slowest and runs beside the cheaper ones.
- name: Install Playwright browser
run: |
# apt reads packages from a root-owned directory the cache action
@@ -174,8 +248,32 @@ jobs:
python scripts/dev/results_behavior_tests.py
python scripts/dev/frontend_gate.py
- - name: Security audit (pip-audit)
- uses: pypa/gh-action-pip-audit@v1.1.0
+ # The one required check. It reports even when a job above was skipped or
+ # failed (`always()`; a cancelled run reads red, the safe side) and passes
+ # only when changes and checks succeeded and browser either succeeded or was
+ # skipped for a docs-only pull request. The results arrive through `env:`,
+ # never interpolated into the script.
+ quality-gate:
+ needs: [changes, checks, browser]
+ if: always()
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
with:
- inputs: requirements.txt requirements-dev.txt
- continue-on-error: true
+ persist-credentials: false
+
+ - name: Aggregate the job results
+ env:
+ CHANGES_RESULT: ${{ needs.changes.result }}
+ CHECKS_RESULT: ${{ needs.checks.result }}
+ BROWSER_RESULT: ${{ needs.browser.result }}
+ DOCS_ONLY: ${{ needs.changes.outputs.docs_only }}
+ run: |
+ python3 scripts/dev/ci_jobs.py aggregate \
+ --changes "$CHANGES_RESULT" \
+ --checks "$CHECKS_RESULT" \
+ --browser "$BROWSER_RESULT" \
+ --docs-only "$DOCS_ONLY"
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 967a01a6..37f744e4 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -593,10 +593,14 @@ regression in `tests/test_routes.py` covers it.
served page. Its cases carry the `browser` marker registered in
`pyproject.toml`. A local `pytest -q` runs them with everything else, so a
local run needs the same Playwright Chromium build as the gate. CI's coverage
-step runs `pytest -m "not browser"` instead. It runs the marked tests in the
-"Run frontend gate" job step, after installing both browsers. See
-`.github/workflows/test.yml` for the exact invocations. Advisory `pip-audit`
-scans both `requirements.txt` and `requirements-dev.txt`.
+step, in the `checks` job, runs `pytest -m "not browser"` instead. The marked
+tests run in the "Run frontend gate" step of the separate `browser` job, after
+it installs both browsers. A pull request whose whole diff against its base is
+documentation paths skips the `browser` job; `scripts/dev/ci_jobs.py` holds
+that rule and the aggregation rule behind the required `quality-gate` check.
+See `.github/workflows/test.yml` for the exact invocations. Advisory
+`pip-audit`, a step of `checks`, scans both `requirements.txt` and
+`requirements-dev.txt`.
**`scripts/dev/frontend_gate.py`** is the full-page gate. Install the browsers
once, after the pinned development requirements:
diff --git a/README.md b/README.md
index 510cd24a..c5a37f01 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
-Last updated: 2026-10-30
+Last updated: 2026-10-31
Your Last.fm listening habits, visualized.
@@ -20,9 +20,10 @@ Last updated: 2026-10-30
The Quality Gate badge tracks real gates rather than a snapshot of them: it
runs the Python suite, a coverage floor, Ruff, the documentation-integrity
-checks and the browser gate on every push. Nothing on this page carries a
-hand-maintained test or coverage number, because a number typed into a README
-is wrong the next time anybody commits.
+checks and the browser gate on every push (a documentation-only pull request
+skips the browser gate; `scripts/dev/ci_jobs.py` owns that rule). Nothing on
+this page carries a hand-maintained test or coverage number, because a number
+typed into a README is wrong the next time anybody commits.
**[Try it live ->](https://scrobblescope.fly.dev)**
diff --git a/config/docsync.toml b/config/docsync.toml
index 1181cea6..2052c9ab 100644
--- a/config/docsync.toml
+++ b/config/docsync.toml
@@ -739,4 +739,4 @@ allow_files = ["docs/history/*", "docs/logarchive/*", "docs/superpowers/*", "CLA
grandfathered = []
[test_count]
-pinned = 3120
+pinned = 3158
diff --git a/docs/agents/FINDINGS.md b/docs/agents/FINDINGS.md
index 50843e3b..44854bed 100644
--- a/docs/agents/FINDINGS.md
+++ b/docs/agents/FINDINGS.md
@@ -3,7 +3,7 @@
Last updated: 2026-10-31
Status: Batch 23 is active, opened 2026-09-21; Batch 22 closed 2026-09-20.
PLAYBOOK Section 3 owns the current work order.
-3120 tests across 104 tracked test modules.
+3158 tests across 104 tracked test modules.
**Rotation policy:** resolved and no-action findings rotate to
`docs/history/findings/FINDINGS_ARCHIVE.md` at the next
`doc_state_sync.py --fix` once their lifecycle record is checked (the
diff --git a/docs/agents/PLAYBOOK.md b/docs/agents/PLAYBOOK.md
index be4db32d..3fe6e116 100644
--- a/docs/agents/PLAYBOOK.md
+++ b/docs/agents/PLAYBOOK.md
@@ -69,15 +69,28 @@ See FINDINGS F-DOCSYNC-3.
## 3. Active batch + next action
+- **CI parallel-jobs side task (owner, 2026-10-31):** PR #285, branch
+ `ci/parallel-jobs`, cut from `main` at `7f85bade`. It splits the single CI
+ job into `changes`, `checks` and `browser` jobs plus a `quality-gate`
+ aggregator that keeps the required check's name, and skips the browser job
+ when a pull request changes only documentation. The plan
+ `docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md` is executed and its
+ Execution record holds the CI evidence (four jobs green, 5 min 32 s). The
+ post-merge check (b2) remains: on the first documentation-only pull
+ request, `browser` is skipped and `quality-gate` succeeds. The findings
+ triage follows this PR.
+
+- **Archive pagination side task:** Complete and merged as PR #284, merge
+ commit `7f85bade`. The four archives past the page target are indexes with
+ numbered pages. F-B23-35 (page manifests are never checked) is ranked in
+ the findings triage.
+
- **Deezer busy-service side task (owner, 2026-10-31):** branch
`fix/deezer-service-busy`. A DeepSeek patch, approved by a typed review;
it closes F-B23-37 (a Deezer HTTP 200 body of error code 700 is retried
and raised as `deezer_unavailable`, not read as "no match"). The findings
triage comes next.
-- **Archive pagination side task:** Complete and merged as PR #284, merge
- commit `7f85bade`.
-
- **UI audit Minors side task:** Complete and merged as PR #283, merge commit
`fe2de3f7`. The spec is
`docs/superpowers/specs/2026-10-31-ui-audit-minors-design.md` and the
@@ -211,89 +224,77 @@ listed by `docs/logarchive/PLAYBOOK_EXECUTION_LOG_ARCHIVE.md`; search the
-### 2026-10-31 - Retry a busy Deezer service instead of reading it as no match
-
-Side task, no batch tag, branch `fix/deezer-service-busy`; closes F-B23-37.
-Deezer's documented error table (read by the owner on 2026-10-31) lists code
-700 as SERVICE_BUSY. `_deezer_request` now retries a 200 body carrying code
-700 like an HTTP 5xx, so the retry helper raises `deezer_unavailable` instead
-of recording a terminal miss. The existing test
-`test_deezer_search_5xx_on_every_attempt_raises_unavailable_not_no_match` is
-parametrized over the HTTP 500 and HTTP 200 code 700 cases and renamed
-`test_deezer_search_refused_on_every_attempt_raises_unavailable_not_no_match`.
-An outside agent (DeepSeek) wrote the patch and an independent review
-approved it.
-
-Validation: `pytest -q` -- **3120 passed**.
-
-### 2026-10-31 - Repoint the archive pointers the split review found
-
-Side task, no batch tag, branch `docs/paginate-archives`: fixes from the
-independent review of the two archive commits. Section 4's own read guide
-above still sent agents to the side-task archive file, which is now an index;
-it now names the pages and says to search the directory.
-`docs/AGENT_DOC_MAP.md` said that file "holds content" and that the findings
-archive "holds the closed items"; both now say the entries are on the pages.
-`AGENTS.md` "Doc Sync Rules" no longer calls the side-task archive a monolith.
-The read-helper prologue in `scripts/docsync/renderer.py` no longer states
-the 500-line default, since the page target is a setting in
-`config/docsync.toml`; `--fix` rewrote the index prologue from it.
-
-One new test, `test_side_archive_read_helpers_reach_the_archive_pages` in
-`tests/test_docsync_renderer.py`, checks that every read helper searches a
-place that holds the archive's pages. It failed with a helper pointed back
-at the archive file and passed with the fix. The review found no gate would
-otherwise catch that.
-
-Deviations: none. This stages docsync control-plane code, so it lands alone
-through the documented `SKIP=doc-state-sync-check` escape. Existing tests
-edited: none.
-
-Validation: `pytest -q` -- **3119 passed**.
-
-### 2026-10-31 - Point the side-task archive's read helpers at its directory
-
-Side task, no batch tag, branch `docs/paginate-archives`, after the archive
-split. `SIDE_ARCHIVE_PREFIX` in `scripts/docsync/renderer.py` is the canonical
-prologue DOC004 holds the side-task archive to. Its read helpers searched the
-archive file itself, which is now an index with no entries, so an agent
-following them found nothing. They now search `docs/logarchive/`, and the
-prologue says why. The `Get-Content` helper is gone: reading the whole
-archive is what the split exists to avoid. `--fix` rewrote the index's
-prologue from the new constant.
-
-Deviations: none. This is docsync control-plane code, so it lands as its own
-commit through the documented `SKIP=doc-state-sync-check` escape. No test
-changed: every test reads the constant by name.
-
-Validation: `pytest -q` -- **3118 passed**.
-
-### 2026-10-31 - Paginate the four archives past the page target
-
-Side task, no batch tag, branch `docs/paginate-archives`. The owner asked for
-the split because a 17,000-line archive is hard for an agent to grep or read.
-`doc_state_sync.py --paginate-archives` turned four archives into indexes with
-numbered pages under a `pages/` folder beside each: the side-task log archive
-(36 pages), the findings archive (8), the Batch 21 log (2) and the Batch 22 log
-(3). Every page is under 500 lines and none is oversized. The four DOC024
-page-target warnings are gone. Two new informational DOC024 warnings name
-findings pages 0001 and 0002, whose undated entries can never age into cold
-storage. No `--cold-storage` run: that needs an explicit date from the owner.
-
-The split was checked independently of the tool's own verification. Every
-non-blank line of each old file is still present across its index and pages,
-the only new lines are page headers and index lines, and all 687 dated
-entries and 141 F-ID headings are on the pages.
-
-Live instructions that searched an archive file by name now search its
-directory: `AGENTS.md` "What to update after a WP or side-task commit",
-`docs/logarchive/README.md`, `docs/AGENT_DOC_MAP.md` (a new trap entry),
-`docs/SWE_AUDIT_CHARTER.md`, `DEVELOPMENT.md` (the archive section, the search
-step and the sample `--check` output) and the cloud kit's expected docsync
-warnings. Point-in-time records keep the old paths, which still resolve to
-the indexes. The side-task archive's built-in read helpers are control-plane
-text and change in the next commit (owner ruling, 2026-10-31).
-
-Deviations: none. No code or test changed.
-
-Validation: `pytest -q` -- **3118 passed**.
+### 2026-10-31 - Record the CI parallel jobs execution
+
+Side task, no batch tag, branch `ci/parallel-jobs`: the plan
+`docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md` gets an Execution
+record and its done boxes ticked. Run 41223708194 at head `3ca1f53b` ran all
+four jobs green: `changes` 7 s, `checks` 74 s, `browser` 313 s, `quality-gate`
+4 s, 5 min 32 s in all against 6 min 47 s for PR #284's single job. Reviews:
+the plan once and then fixed in 2 rounds, the second without its own
+re-review, the split after 1 (`fbb6f449`), the docs sweep
+approved. Acceptance (b1) passed locally; (b2) stays open for the first
+documentation-only pull request after merge, because this PR changes the
+workflow and so runs `browser` on every head. Also: `development-cycle.md`,
+`documentation-tooling.md` and `README.md` point at `scripts/dev/ci_jobs.py`
+as the owner of the docs-only path list instead of paraphrasing it, and the
+README wrap around the docs-only note is fixed.
+
+Deviations: none. Docs only; no code or test changed.
+
+Validation: `pytest -q` -- **3157 passed**.
+
+### 2026-10-31 - Describe the parallel CI jobs
+
+Side task, no batch tag, branch `ci/parallel-jobs`: the documentation sweep
+for the four-job workflow. `DEVELOPMENT.md` (the `tests/frontend/` paragraph),
+`docs/architecture/development-cycle.md` (the CI paragraph) and
+`docs/architecture/documentation-tooling.md` (the CI summary near the end)
+now name `changes`, `checks`, `browser` and the `quality-gate` aggregator, say
+which pull requests skip `browser`, and point at `scripts/dev/ci_jobs.py`. The
+run time reads about 1.5 minutes for a docs-only pull request and about 5
+minutes for any other. `README.md` notes the skip and the
+`tests/scripts/dev/test_frontend_gate.py` docstring says "CI browser job". No
+Mermaid node changed: "GitHub Actions Quality Gate" and its edges stay true.
+Point-in-time records are untouched.
+
+Validation: `pytest -q` -- **3157 passed**.
+
+### 2026-10-31 - Tighten the CI split tests after review
+
+Side task, no batch tag, branch `ci/parallel-jobs`: fixes from the review of
+the split commit, tests only. In `tests/scripts/dev/test_ci_jobs.py` the
+192-row `aggregate` table and its `_allowed` oracle are replaced by one test
+that loops the full product against a hand-written set of accepted tuples
+and lists every mismatch; `test_aggregate_rejects_an_empty_or_unknown_docs_only_value`
+and the duplicate `()` row are removed; the misnamed
+`test_main_aggregate_accepts_an_empty_docs_only_value` is replaced by
+`test_main_aggregate_rejects_an_empty_docs_only_given_as_a_separate_argument`;
+`test_main_aggregate_exits_nonzero_when_a_required_flag_is_missing` is added;
+the docs-only table gains `.superpowers-old/x.py`, `build.cmd`,
+`src/my file.py` and `my notes.md`. In `tests/test_ci_workflows.py` the
+parametrized app-jobs test is split into
+`test_app_jobs_set_flask_env` and
+`test_the_workflow_passes_no_secret_outside_a_step_env`, so the whole-file
+secret scan runs once. No script or workflow change.
+
+Validation: `pytest -q` -- **3157 passed**.
+
+### 2026-10-31 - Run the quality gate as parallel jobs
+
+Side task, no batch tag, branch `ci/parallel-jobs`. The one CI job took about
+7 minutes, 4.5 of them in the browser gate. `.github/workflows/test.yml` now
+has four jobs: `changes` (is the pull request docs-only), `checks` (install,
+preflight, pre-commit, pytest with coverage, pip-audit), `browser` (Playwright
+and the frontend gate) and `quality-gate`, the one required context, which
+aggregates the other three. `scripts/dev/ci_jobs.py` holds the two decisions
+(`docs-only` path classification and `aggregate`), with truth-table tests in
+`tests/scripts/dev/test_ci_jobs.py`; `tests/test_ci_workflows.py` reads
+per-job blocks. A docs-only pull request skips `browser`; any other skip, or
+a failed or cancelled job, turns `quality-gate` red.
+
+Deviations: an empty or unrecognised `--docs-only` value fails the
+aggregator even when all three jobs succeeded (fail closed). `browser` has
+no Tailwind asset cache: nothing it runs reads `scripts/bin`.
+
+Validation: `pytest -q` -- **3347 passed**.
diff --git a/docs/architecture/development-cycle.md b/docs/architecture/development-cycle.md
index c6ae0bee..b2a50990 100644
--- a/docs/architecture/development-cycle.md
+++ b/docs/architecture/development-cycle.md
@@ -67,11 +67,16 @@ session: force-pushes, history rewrites, and anything targeting `main`. A
Copilot session that has been authorized to push uses the platform progress
tool rather than shell `git` or `gh`.
-`CI` (the `Quality Gate` workflow) runs the docsync preflight, then
+`CI` (the `Quality Gate` workflow) runs four jobs. `changes` decides whether
+the pull request is docs-only. `checks` runs the docsync preflight, then
pre-commit with `worktree-alignment` skipped, then `pytest -m "not browser"`
-with coverage, then every test carrying the `browser` marker (selected by
-marker across the whole tree, not by folder) and
-`scripts/dev/frontend_gate.py` after installing both browsers, and advisory
-`pip-audit` last -- against both `requirements.txt` and
-`requirements-dev.txt` now that the dev-only pins moved out of the
-production file.
+with coverage, and advisory `pip-audit` last -- against both
+`requirements.txt` and `requirements-dev.txt` now that the dev-only pins
+moved out of the production file. `browser` runs beside `checks`: every test
+carrying the `browser` marker (selected by marker across the whole tree, not
+by folder) and `scripts/dev/frontend_gate.py`, after installing both
+browsers. A pull request whose whole diff against its base is documentation
+only skips `browser`; `scripts/dev/ci_jobs.py` owns the path list.
+`quality-gate`, the required check, aggregates the other three and fails on
+any failed, cancelled or unexpectedly skipped job. A docs-only pull request
+therefore takes about 1.5 minutes and any other about 5 minutes.
diff --git a/docs/architecture/documentation-tooling.md b/docs/architecture/documentation-tooling.md
index e1c6ae00..c9c7b5f9 100644
--- a/docs/architecture/documentation-tooling.md
+++ b/docs/architecture/documentation-tooling.md
@@ -551,5 +551,7 @@ so it needs no separately running app.
Pre-commit runs the ten hooks above, including `doc-state-sync-check` (now
the first hook in the file); CI runs the docsync preflight explicitly, then
pre-commit with `worktree-alignment` skipped, since a runner has no
-developer worktree lineage to check, then pytest with coverage, then the
-frontend gate after installing both browsers, and advisory pip-audit last.
+developer worktree lineage to check, then pytest with coverage, and
+advisory pip-audit last, all in the `checks` job; the frontend gate runs in
+the parallel `browser` job after installing both browsers, and a docs-only
+pull request skips it (`scripts/dev/ci_jobs.py` owns the path list).
diff --git a/docs/logarchive/PLAYBOOK_EXECUTION_LOG_ARCHIVE.md b/docs/logarchive/PLAYBOOK_EXECUTION_LOG_ARCHIVE.md
index 7b80bf6f..19a127d4 100644
--- a/docs/logarchive/PLAYBOOK_EXECUTION_LOG_ARCHIVE.md
+++ b/docs/logarchive/PLAYBOOK_EXECUTION_LOG_ARCHIVE.md
@@ -10,7 +10,7 @@ target, this file is an index and the entries are on its numbered pages):
- `rg -n "" docs/logarchive/`
-
+
## Archive pages
@@ -54,4 +54,4 @@ entries and is the only one that still changes.
- [pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0033.md](pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0033.md) -- 53 entries, 492 lines
- [pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0034.md](pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0034.md) -- 41 entries, 485 lines
- [pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0035.md](pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0035.md) -- 29 entries, 485 lines
-- [pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md](pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md) -- 21 entries, 379 lines
+- [pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md](pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md) -- 26 entries, 485 lines
diff --git a/docs/logarchive/pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md b/docs/logarchive/pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md
index 546d534d..74ebe725 100644
--- a/docs/logarchive/pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md
+++ b/docs/logarchive/pages/PLAYBOOK_EXECUTION_LOG_ARCHIVE_0036.md
@@ -1,6 +1,112 @@
# PLAYBOOK_EXECUTION_LOG_ARCHIVE -- page 0036
+### 2026-10-31 - Retry a busy Deezer service instead of reading it as no match
+
+Side task, no batch tag, branch `fix/deezer-service-busy`; closes F-B23-37.
+Deezer's documented error table (read by the owner on 2026-10-31) lists code
+700 as SERVICE_BUSY. `_deezer_request` now retries a 200 body carrying code
+700 like an HTTP 5xx, so the retry helper raises `deezer_unavailable` instead
+of recording a terminal miss. The existing test
+`test_deezer_search_5xx_on_every_attempt_raises_unavailable_not_no_match` is
+parametrized over the HTTP 500 and HTTP 200 code 700 cases and renamed
+`test_deezer_search_refused_on_every_attempt_raises_unavailable_not_no_match`.
+An outside agent (DeepSeek) wrote the patch and an independent review
+approved it.
+
+Validation: `pytest -q` -- **3120 passed**.
+
+### 2026-10-31 - Plan the CI split into parallel jobs
+
+Side task, no batch tag, branch `ci/parallel-jobs`. The owner approved
+splitting the one CI job into parallel jobs with an aggregator, because the
+frontend gate takes about 4.5 of the job's 7 minutes and proves nothing
+about a documentation-only change. This commit adds the plan,
+`docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md`, written by a plan
+task and reviewed: one review and two fix rounds. The rounds moved the
+docs-only and aggregator decisions out of inline workflow shell into a
+tested script, kept the docs-only decision on the whole pull request (a
+per-push diff could skip the browser job on a code PR), and added
+near-miss cases to its test table. Because this PR changes the workflow
+itself, it cannot show the browser job skipped; the first documentation-only
+PR after merge is the check for that.
+
+Deviations: none. Docs only; no code or test changed.
+
+Validation: `pytest -q` -- **3119 passed**.
+
+### 2026-10-31 - Repoint the archive pointers the split review found
+
+Side task, no batch tag, branch `docs/paginate-archives`: fixes from the
+independent review of the two archive commits. Section 4's own read guide
+above still sent agents to the side-task archive file, which is now an index;
+it now names the pages and says to search the directory.
+`docs/AGENT_DOC_MAP.md` said that file "holds content" and that the findings
+archive "holds the closed items"; both now say the entries are on the pages.
+`AGENTS.md` "Doc Sync Rules" no longer calls the side-task archive a monolith.
+The read-helper prologue in `scripts/docsync/renderer.py` no longer states
+the 500-line default, since the page target is a setting in
+`config/docsync.toml`; `--fix` rewrote the index prologue from it.
+
+One new test, `test_side_archive_read_helpers_reach_the_archive_pages` in
+`tests/test_docsync_renderer.py`, checks that every read helper searches a
+place that holds the archive's pages. It failed with a helper pointed back
+at the archive file and passed with the fix. The review found no gate would
+otherwise catch that.
+
+Deviations: none. This stages docsync control-plane code, so it lands alone
+through the documented `SKIP=doc-state-sync-check` escape. Existing tests
+edited: none.
+
+Validation: `pytest -q` -- **3119 passed**.
+
+### 2026-10-31 - Point the side-task archive's read helpers at its directory
+
+Side task, no batch tag, branch `docs/paginate-archives`, after the archive
+split. `SIDE_ARCHIVE_PREFIX` in `scripts/docsync/renderer.py` is the canonical
+prologue DOC004 holds the side-task archive to. Its read helpers searched the
+archive file itself, which is now an index with no entries, so an agent
+following them found nothing. They now search `docs/logarchive/`, and the
+prologue says why. The `Get-Content` helper is gone: reading the whole
+archive is what the split exists to avoid. `--fix` rewrote the index's
+prologue from the new constant.
+
+Deviations: none. This is docsync control-plane code, so it lands as its own
+commit through the documented `SKIP=doc-state-sync-check` escape. No test
+changed: every test reads the constant by name.
+
+Validation: `pytest -q` -- **3118 passed**.
+
+### 2026-10-31 - Paginate the four archives past the page target
+
+Side task, no batch tag, branch `docs/paginate-archives`. The owner asked for
+the split because a 17,000-line archive is hard for an agent to grep or read.
+`doc_state_sync.py --paginate-archives` turned four archives into indexes with
+numbered pages under a `pages/` folder beside each: the side-task log archive
+(36 pages), the findings archive (8), the Batch 21 log (2) and the Batch 22 log
+(3). Every page is under 500 lines and none is oversized. The four DOC024
+page-target warnings are gone. Two new informational DOC024 warnings name
+findings pages 0001 and 0002, whose undated entries can never age into cold
+storage. No `--cold-storage` run: that needs an explicit date from the owner.
+
+The split was checked independently of the tool's own verification. Every
+non-blank line of each old file is still present across its index and pages,
+the only new lines are page headers and index lines, and all 687 dated
+entries and 141 F-ID headings are on the pages.
+
+Live instructions that searched an archive file by name now search its
+directory: `AGENTS.md` "What to update after a WP or side-task commit",
+`docs/logarchive/README.md`, `docs/AGENT_DOC_MAP.md` (a new trap entry),
+`docs/SWE_AUDIT_CHARTER.md`, `DEVELOPMENT.md` (the archive section, the search
+step and the sample `--check` output) and the cloud kit's expected docsync
+warnings. Point-in-time records keep the old paths, which still resolve to
+the indexes. The side-task archive's built-in read helpers are control-plane
+text and change in the next commit (owner ruling, 2026-10-31).
+
+Deviations: none. No code or test changed.
+
+Validation: `pytest -q` -- **3118 passed**.
+
### 2026-10-31 - Take main into the UI audit Minors branch after PR #282
Side task, no batch tag: merge `main` (`708fb48b`, PR #282) into
diff --git a/docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md b/docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md
new file mode 100644
index 00000000..da757dac
--- /dev/null
+++ b/docs/superpowers/plans/2026-10-31-ci-parallel-jobs.md
@@ -0,0 +1,136 @@
+# CI Parallel Jobs Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Split the single `quality-gate` job in `.github/workflows/test.yml` into parallel jobs behind an aggregator, so a run takes about 1.5 minutes where it now takes about 7, and a docs-only pull request skips the browser job.
+
+**Architecture:** Four jobs: `changes` (is this pull request docs-only), `checks` (install, docsync, pre-commit, pytest, advisory pip-audit), `browser` (Playwright and the frontend gate) and `quality-gate` (the aggregator, the only required check). The two decisions that can produce a wrong green (docs-only classification, aggregation) live in one tested stdlib script, `scripts/dev/ci_jobs.py`, not in inline YAML shell. The ruleset `main-protection` keeps requiring the context `quality-gate`; it needs no change.
+
+**Tech Stack:** GitHub Actions YAML, a stdlib-only Python script, pytest (the script's functions called directly; the workflow read as text only for secrets and the Playwright cache sequence). Actions cannot run locally; acceptance is this pull request's own CI plus one post-merge check.
+
+## Global Constraints
+
+- Owner rulings. O25 (2026-10-31): "splitting the job into parallel jobs with an aggregator is a sound idea. The ruleset can always change, I'm fine with that. The time saving cost from 7 minutes to 1.5 is a big gain". O24: gates are scoped to what changed. O27: PRs may stack; this branch `ci/parallel-jobs` is cut from PR #284's head (`docs/paginate-archives`, `881f00d7`). The owner asked that every doc referencing the CI be checked and updated where the split makes it untrue.
+- `AGENTS.md` and `docs/agents/global-rules.md` bind this work. Stage paths by name; never `.superpowers/`.
+- Triggers unchanged (push to `main` and `wip/**`, `pull_request`, `workflow_dispatch`). Python version, coverage settings (`--cov-fail-under=70`), test selection and `C:/ssw/tools/ci_judge.py` do not change.
+- Every job keeps `permissions: contents: read` and `persist-credentials: false` on every checkout. No provider secret outside a step-level `env:`. Job-level `env: FLASK_ENV: development` goes on each job that runs app code (`checks`, `browser`).
+- Existing comments move with the step they explain; trim only what the split makes untrue.
+- Measured baseline (run 41179864550, one job, about 400 s): install 11 s, docsync preflight 1 s, pre-commit 12 s, pytest with coverage 56 s, Playwright install 23 s, frontend gate 274 s, pip-audit 12 s. The repository is public, so minutes are free.
+- Expected, not defects: `ERROR WT003` and `WARNING WT010` from the worktree hook, the root `BATCH23_DEFINITION.md` warning and the two `WARNING DOC024` lines on the findings archive pages.
+
+## Frozen decisions
+
+1. **`changes`** (`ubuntu-latest`, read-only, runner `python3`, no setup-python): outputs `docs_only` as the string `true` or `false`. Plain git plus `python3 scripts/dev/ci_jobs.py docs-only`; no third-party action. Only a `pull_request` event can be docs-only. A push (to `main` or `wip/**`) and `workflow_dispatch` always output `false`; no diff is computed for them.
+2. **Docs-only is a skip-list, and the whole pull request is diffed against its base.** `true` only when the changed-path list is non-empty and every path matches `docs/**`, `**/*.md` (any depth, including the repository root), `.superpowers/**` or `config/docsync.toml`. Any other path, including a new top-level one, outputs `false`. The classification is `python3 scripts/dev/ci_jobs.py docs-only` (decision 8); the workflow only computes the diff and pipes it in.
+ - The diff uses `--no-renames` so a file moved out of a docs path counts under its old path as well, and `-z` so a path with spaces or quotes is matched whole.
+ - The diff has merge-base semantics: it lists what the pull request changes relative to its base, not what the base gained since the branch was cut. The default `refs/pull/N/merge` checkout with `fetch-depth: 2` and `HEAD^1..HEAD` gives exactly that (`actions/checkout` fetches both parents of the merge commit at depth 2); the implementer may choose another way that keeps the property.
+ - Fail closed: if `HEAD^2` does not resolve, or the diff cannot be computed (shallow history, missing ref, a merge conflict that leaves no merge ref), the step outputs `false` (or the job fails, which the aggregator turns into red). An empty list also prints `false`.
+ - A per-push diff (`before..after`) is rejected: a docs-only commit on top of a code pull request would skip the browser job while the pull request still changes code, a wrong green. Consequence: on any pull request that changes the workflow or code, `docs_only` stays `false` for the pull request's whole life.
+3. **`checks`**: checkout, Python 3.13 with the pip cache, the Tailwind asset cache, dependency install, docsync preflight, pre-commit with `SKIP: worktree-alignment`, the Tailwind digest print, `pytest -m "not browser"` with the same coverage flags, the coverage upload, then the advisory pip-audit step with `continue-on-error: true`. pip-audit stays a step of `checks`, so `advisory-steps` in the `ci` block keeps matching. Step order and comments as today.
+4. **`browser`**: `needs: changes`; `if` runs it unless `needs.changes.outputs.docs_only == 'true'`. It needs its own checkout, Python 3.13 with pip cache, dependency install and (if the gate needs it; confirm by reading `scripts/dev/frontend_gate.py` and `scripts/dev/_frontend_gate*.py`) the Tailwind asset cache. It keeps the runner-image step, the Playwright apt cache restore, install and save sequence (F-B23-57) in that order and unchanged, and the three browser commands in their current order (`pytest -m browser -q`, `results_behavior_tests.py`, `frontend_gate.py`).
+ - The existing `fly.io-deploy` / `flyio-deploy` head-ref condition **stays on the step that runs the three commands, as now**, not on the job. This matters: a job-level skip for those heads would be a "browser skipped for another reason" and the aggregator would fail. The install steps still run for those heads, as today.
+5. **`quality-gate`** (the aggregator, keeping this exact job name): `needs: [changes, checks, browser]`, `if: always()`, `permissions: contents: read`. It checks out (`persist-credentials: false`) and runs `python3 scripts/dev/ci_jobs.py aggregate` with the runner's `python3` (no setup-python), passing the three `needs.*.result` values and `needs.changes.outputs.docs_only` through the step's `env:` (never interpolated into the script). The script exits 0 only when `changes` is `success`, `checks` is `success`, and `browser` is `success`, or `browser` is `skipped` and `docs_only` is `true`. Every other combination exits 1 and prints which input failed: a failed or cancelled `browser`, a `browser` skip while `docs_only` is not `true` (for example `changes` failed, so its output is empty), a failed or cancelled `changes` or `checks`. If the checkout itself fails the job is red: fail closed.
+ - **`if: always()` is deliberate and stays** (not `!cancelled()`): a cancelled run reads red, which is the safe side. The implementer does not change it.
+6. **Docs-only does not need `config/docsync.toml` in the browser job.** Confirmed by grep at plan time and again by the plan review: nothing the browser job executes (`scripts/dev/frontend_gate.py`, `scripts/dev/_frontend_gate*.py`, `scripts/dev/results_behavior_tests.py`, `tests/frontend`) reads `config/docsync.toml`; the only mentions in `scrobblescope/heatmap.py:43` and `static/css/tailwind.src.css:161` are comments. The implementer repeats the grep and stops with NEEDS_CONTEXT if it now finds a read.
+7. **Job count and the watcher block (controller step).** The run has four jobs. When Task 1 lands, the controller (not an implementer; the block is untracked) replaces the workspace `ci` block with: `jobs: 4`; `blocking:` `'quality-gate'` and `'checks'`; `changes` and `browser` advisory to ci_judge (a skipped `browser` is OK; a failed one also fails `quality-gate`, which is blocking); `advisory-steps:` `'Security audit (pip-audit)'`; `scan-log: checks` with the same `extract:` patterns (the pytest counts live in that log); `timeout-min` reviewed against the new run time. The browser job's evidence is its conclusion, and the ci-watcher saves its failed log when it fails. Extracting the frontend-gate line from a second job is a ci-watcher feature request, not part of this pull request.
+8. **`scripts/dev/ci_jobs.py`, frozen interface.** Stdlib only, no side effects at import, functions callable from tests.
+ - `python3 scripts/dev/ci_jobs.py docs-only` reads NUL-separated changed paths on stdin, prints `true` or `false` and exits 0. Empty input, or input made only of NUL separators, prints `false` (fail closed).
+ - `python3 scripts/dev/ci_jobs.py aggregate --changes R --checks R --browser R --docs-only true|false` (each `R` is a `needs..result` value) exits 0 only under decision 5's rule, otherwise exits 1 and prints which input failed it. An empty or unrecognised `--docs-only` value is a failure: it exits 1, never 0.
+ - The workflow computes the diff with git and pipes it in. No YAML string pin guards these two decisions; the script's tests do.
+
+## Delivery sequence
+
+- [x] Commit this plan as the branch's first commit (controller, before Task 1).
+- [x] Task 1: add `ci_jobs.py` with its tests, split the workflow, adapt the workflow tests.
+- [x] Controller step after Task 1 lands: replace the workspace `ci` block per decision 7.
+- [x] Task 2: documentation sweep.
+- [x] Task 3: execution record (docs only, last): this pull request's full-run evidence.
+- [x] Acceptance (a), on this pull request's CI: the head that changes the workflow runs all four jobs and `quality-gate` succeeds.
+- [x] Acceptance (b1), local: the docs-only truth table and the aggregator truth table pass (Task 1).
+- [ ] Acceptance (b2), after merge (controller): on the first docs-only pull request, `browser` is skipped and `quality-gate` succeeds; the controller records it. It cannot be observed on this pull request, because decision 2 diffs the whole pull request, which changes the workflow.
+
+## Task 1: Script, workflow split and tests
+
+**Wave:** 1. **After:** the plan commit. **Mode:** serial, one implementer.
+**Touches:** `scripts/dev/ci_jobs.py` (new), `tests/scripts/dev/test_ci_jobs.py` (new; place and import it the way the neighbouring `tests/scripts/dev` tests import `scripts/dev` modules), `.github/workflows/test.yml`, `tests/test_ci_workflows.py`; plus the side-task log entry and measured docsync counts the commit procedure requires (controller-owned bookkeeping).
+**Gates:** `tests/scripts/dev/test_ci_jobs.py`, `tests/test_ci_workflows.py`, the three suite shards, `pre-commit run --all-files` (its `check yaml` hook parses the workflow), `doc_state_sync.py --check`. The frontend gate is not required: no template, static file or gate script changes.
+
+**Interfaces:** consumes the current single-job workflow; produces the script of decision 8 and the four jobs of decisions 1 to 5 with the step bodies moved, not rewritten.
+
+- [x] **Read and confirm.** Read `.github/workflows/test.yml`, `tests/test_ci_workflows.py` and one neighbouring `tests/scripts/dev` test for the import style. Repeat the decision 6 grep. Read the gate scripts to decide whether `browser` needs the Tailwind cache.
+- [x] **Script tests first (RED).** Write `tests/scripts/dev/test_ci_jobs.py`, calling the script's functions directly, each test with a GIVEN/WHEN/THEN docstring:
+ - One parametrized truth table for `aggregate`: every combination of the result values (`success`, `failure`, `cancelled`, `skipped`) for `changes`, `checks` and `browser` with `docs_only` `true`, `false` and empty, asserting exit 0 only for the two allowed shapes (all three `success`; `changes` and `checks` `success` with `browser` `skipped` and `docs_only` `true`). It must include a failed and a cancelled `changes`, a `browser` skip without docs-only, and a failed `checks` with a green `browser`. It also has a row for an empty and for an unrecognised `--docs-only` value (for example `maybe`), each expected to exit 1 and never 0. A failure message names the offending job.
+ - One parametrized table for `docs-only` (NUL-separated input): a path under `docs/`; a `.md` at the repository root and at depth; a `.superpowers/` path; `config/docsync.toml`; each of those mixed with one code path (`false`); a new top-level path (`false`); a path with a space; empty input (`false`); an input made only of NUL separators (`false`); near-miss negatives that a loose prefix or suffix match would wrongly accept, each `false`: `docs_tools/x.py`, `app/docs/x.py`, `notes.mdx`, `sub/config/docsync.toml`, `config/docsync.toml.bak`.
+ - Run it and see it fail because `scripts/dev/ci_jobs.py` does not exist (the right reason).
+- [x] **Workflow tests, adapt (RED).** Adapt the existing `tests/test_ci_workflows.py` tests to the new layout instead of adding copies. One shared helper returns the lines of a named job; the job-level `env:` reader and the step reader are both built on it (neither returns "the first block in the file").
+ - The no-secret rule holds for every job: the env reader finds `FLASK_ENV` on `checks` and `browser`, and the secret scan keeps reading the whole file. Update the module docstring ("the CI quality-gate job") to say every job.
+ - The Playwright cache test finds its four steps in the `browser` job, in the same order and with the same checks.
+ - No new YAML text pin for the docs-only patterns or the aggregator condition (decision 8). Run the file and see the adapted tests fail against the unchanged single-job workflow (no `browser` job).
+- [x] **Build the script (GREEN).** Write `scripts/dev/ci_jobs.py` per decision 8, the simplest code that passes the tables; the `**/*.md` match must cover a root-level `README.md` (a plain shell `case` does not do this, which is why the logic is in Python).
+- [x] **Build the workflow (GREEN).** Write the four jobs per decisions 1 to 5. `changes` and `quality-gate` call the script as decision 8 says. Keep every existing comment with its step; rewrite only comments the split falsifies (for example "Last on purpose. Starting a browser costs far more than a lint ... so every cheaper gate reports first" is now untrue: the jobs run in parallel, so reword it to say the browser job is the slowest and runs beside the cheaper ones). Re-run both test files to green.
+- [x] **Prove the new tests bite.** In the script, make one temporary change per decision and see the table fail, then undo it: accept a `browser` skip without checking `docs_only` (aggregator); drop `docs/**` from the patterns, or let empty input print `true` (docs-only). Report command and output. No `mutate.py` run unless a `tests/mutants/*.json` is edited, which is not expected.
+- [x] **Gates and commit.** Run the gates; the commit is `ci: Run the quality gate as parallel jobs`, body saying why (about 7 minutes to about 1.5, docs-only pull requests skip the browser job, one required context unchanged). The side-task entry sits directly after the `` marker, untagged, with the measured test count. Push is the controller's.
+
+**Acceptance (task level):** the workflow parses; both test files are green with the tables proven red first; the diff shows the step bodies moved, not changed, apart from the comments named above and the `if` on the three browser commands staying on that step; the two decision-8 invocations in the workflow match the frozen interface.
+
+## Controller step after Task 1
+
+Not an implementer task. When Task 1 lands, the controller edits the untracked workspace `ci` block per decision 7 (`jobs: 4`, blocking `quality-gate` and `checks`, advisory step unchanged, `scan-log: checks`, same `extract:` patterns, timeout reviewed) before the ci-watcher is dispatched for the pushed head.
+
+## Task 2: Documentation sweep
+
+**Wave:** 2. **After:** Task 1. **Mode:** serial, one implementer.
+**Touches:** `DEVELOPMENT.md`, `docs/architecture/documentation-tooling.md`, `docs/architecture/development-cycle.md`, `tests/scripts/dev/test_frontend_gate.py` (one docstring line); bookkeeping as in Task 1.
+**Gates:** `pre-commit run --all-files`, `doc_state_sync.py --check`, the three suite shards (a docstring edit still goes through the same shards). Mermaid diagrams are rendered by the controller, not the implementer.
+
+The hit list is `.superpowers/sdd/2026-10-31-ci-split/sweep-ci-references.md` in the main checkout. Point-in-time records (log entries, dated specs, findings, archives) are not edited.
+
+- [x] **Hits that describe structure, steps or order.** Check each against the new layout and fix where now untrue:
+ - `DEVELOPMENT.md:592-597`: the frontend gate runs in the `browser` job, which is skipped for a docs-only pull request; the coverage step is in `checks`; pip-audit is in `checks`. Keep the pointer to `.github/workflows/test.yml`; name `scripts/dev/ci_jobs.py` as the home of the docs-only and aggregation rules where the paragraph describes them.
+ - `docs/architecture/documentation-tooling.md:468` and `:492`: "CI's explicit Run docsync preflight step" stays true as a step name; add the job (`checks`) only if the sentence would otherwise mislead.
+ - `docs/architecture/development-cycle.md:70-78`: the paragraph says CI runs everything in one sequence. Rewrite to the four jobs: `checks` and `browser` run in parallel, `changes` decides whether `browser` runs, `quality-gate` aggregates, and say which pull requests skip the browser job (those whose whole diff against the base is docs paths).
+ - `docs/architecture/development-cycle.md:33` and `docs/architecture/documentation-tooling.md:104-110` (Mermaid nodes naming the Quality Gate): change only if the node text or edges are now false (for example "runs before PC"). If a diagram changes, list it in the report for the controller to render.
+ - `tests/scripts/dev/test_frontend_gate.py:4`: "which is what the Quality Gate does" is still true of the aggregate; reword to "which is what the CI browser job does" if the implementer judges the old wording misleading.
+ - `tests/test_ci_workflows.py:1` and `:110` were handled in Task 1; confirm they read correctly.
+- [x] **Hits that name the workflow or file only.** Read once, leave if still true: `README.md:12` (badge), `:21`, `:198`, `:714`; `DEVELOPMENT.md:869`; `docs/agents/AGENT_NOTES.md:311`, `:323`, `:326`, `:339`, `:343`. If the badge or a sentence implies one job or one sequence, fix it; otherwise record "read, still true".
+- [x] **Re-sweep.** Grep tracked files for `quality-gate`, `Quality Gate`, `frontend gate` and `Run frontend gate` to catch a mention the sweep list missed; list new finds and decisions in the report.
+- [x] **Untracked items are the controller's, listed in the report only:** the `ci` blocks in workspace `constraints.md` files (done by the controller step after Task 1; confirm no other workspace still says `jobs: 1`).
+- [x] **Commit** `docs(ci): Describe the parallel CI jobs`, with the side-task entry and measured counts.
+
+**Acceptance (task level):** every "describe structure" hit is either corrected or recorded as still true with the reason; no tracked live document still says CI runs one sequence of steps in one job; docsync check passes.
+
+## Task 3: Execution record
+
+**Wave:** 3. **After:** Task 2 and the CI result of the workflow-changing head. **Mode:** serial, docs only.
+**Touches:** this plan (tick checkboxes, add the record) and the PLAYBOOK/log bookkeeping the commit procedure requires. No workflow, code or test file.
+**Gates:** `pre-commit run --all-files`, `doc_state_sync.py --check`, the suite shards.
+
+- [x] Record on the plan the CI run for the head that changed the workflow: four jobs, job durations, and `quality-gate` success (acceptance a). A failed aggregator or a skipped `browser` there is a defect to fix in Task 1's files, not to record.
+- [x] Record that acceptance (b1) passed locally (the two truth tables, with the test counts) and name (b2) as the controller's post-merge check on the first docs-only pull request. Do not try to show a skipped `browser` on this pull request: by decision 2 its diff includes the workflow, so `docs_only` is `false` here and `browser` runs on every head; that is correct behaviour, not a defect.
+- [x] Commit `docs(plan): Record the CI parallel jobs execution`. Tick the delivery sequence boxes that hold (a, b1); leave (b2) open for the controller.
+
+**Acceptance (task level):** the plan holds the full-run evidence of this pull request and names (b2) as the post-merge check; no claim of a skipped browser job on this pull request.
+
+## Definition of done
+
+- Acceptance (a) holds on the pull request's CI with `quality-gate` success; (b1) passes in `tests/scripts/dev/test_ci_jobs.py`; (b2) is recorded by the controller after merge, on the first docs-only pull request.
+- `tests/scripts/dev/test_ci_jobs.py` and `tests/test_ci_workflows.py` are green; pre-commit and `doc_state_sync.py --check` pass with only the expected advisories.
+- The workspace `ci` block was updated by the controller per decision 7.
+- The ruleset still requires `quality-gate` and was not edited.
+- Owner is told: the required context is now the aggregator; a skipped browser job on a docs-only pull request is intended; a push to `main` always runs every job; a pull request that changes any non-docs path runs the browser job on every push.
+
+## Execution record
+
+Pull request #285, branch `ci/parallel-jobs`, stacked on PR #284 (decision O27).
+
+| Commit | Subject | Review outcome |
+|--------|---------|----------------|
+| `47c2a9ba` | `docs(plan): Plan the CI split into parallel jobs` | Reviewed once, then fixed in 2 rounds, the second without its own re-review |
+| `496e3651` | `ci: Run the quality gate as parallel jobs` | Approved after 1 fix round (`fbb6f449`, `test(ci): Tighten the CI split tests after review`) |
+| `3ca1f53b` | `docs(ci): Describe the parallel CI jobs` | Approved |
+
+**Acceptance (a), CI evidence.** Run 41223708194 at head `3ca1f53b`, which includes the workflow change, ran all four jobs and all four succeeded: `changes` 7 s, `checks` 74 s (2997 passed, 4 skipped, 156 deselected), `browser` 313 s, `quality-gate` 4 s. `changes` and `checks` started together, and the whole run took 5 min 32 s, against 6 min 47 s for PR #284's single job (run 41219439839). `browser` ran, as decision 2 requires: this pull request changes the workflow, so `docs_only` is `false` here on every head. That is correct behaviour; this run does not show a skipped `browser`, and it could not.
+
+**Acceptance (b1), local.** `tests/scripts/dev/test_ci_jobs.py` passes (37 tests): the `aggregate` truth table (the full product of `success`, `failure`, `cancelled` and `skipped` for the three jobs with `docs_only` `true`, `false` and empty, accepting only the two allowed shapes) and the `docs-only` table (including the near-miss paths and empty or NUL-only input). With `tests/test_ci_workflows.py` the two files hold 46 tests, all passing.
+
+**Acceptance (b2), open, the controller's post-merge check.** On the first docs-only pull request after merge, confirm `browser` is skipped and `quality-gate` succeeds, and record it here. It cannot be observed on this pull request.
diff --git a/scripts/dev/ci_jobs.py b/scripts/dev/ci_jobs.py
new file mode 100644
index 00000000..eba9bfe4
--- /dev/null
+++ b/scripts/dev/ci_jobs.py
@@ -0,0 +1,67 @@
+"""Decisions the CI workflow delegates to Python so they can be tested.
+
+``docs-only`` reads NUL-separated changed paths on stdin and prints ``true``
+when every path is documentation (a pull request that can skip the browser
+job), else ``false``. ``aggregate`` turns the ``needs.*.result`` values into
+the one verdict the required ``quality-gate`` check reports. Both fail closed.
+"""
+
+from __future__ import annotations
+
+import argparse
+import sys
+
+DOCS_PREFIXES = ("docs/", ".superpowers/")
+DOCS_FILES = ("config/docsync.toml",)
+DOCS_SUFFIX = ".md"
+
+
+def _is_docs_path(path: str) -> bool:
+ return (
+ path.startswith(DOCS_PREFIXES)
+ or path in DOCS_FILES
+ or path.endswith(DOCS_SUFFIX)
+ )
+
+
+def docs_only(raw: bytes) -> bool:
+ """True when the NUL-separated paths are non-empty and all documentation."""
+ paths = [p.decode("utf-8", "surrogateescape") for p in raw.split(b"\0") if p]
+ return bool(paths) and all(_is_docs_path(p) for p in paths)
+
+
+def aggregate(
+ changes: str, checks: str, browser: str, docs_only_flag: str
+) -> tuple[int, str]:
+ """Return (exit code, message) for the three job results and the docs flag."""
+ if docs_only_flag not in ("true", "false"):
+ return 1, f"docs_only is {docs_only_flag!r}, expected 'true' or 'false'"
+ if changes != "success":
+ return 1, f"changes did not succeed: {changes}"
+ if checks != "success":
+ return 1, f"checks did not succeed: {checks}"
+ if browser == "success":
+ return 0, "all jobs succeeded"
+ if browser == "skipped" and docs_only_flag == "true":
+ return 0, "browser skipped for a docs-only pull request"
+ return 1, f"browser did not succeed: {browser} (docs_only={docs_only_flag})"
+
+
+def main(argv: list[str] | None = None) -> int:
+ parser = argparse.ArgumentParser(description=__doc__)
+ sub = parser.add_subparsers(dest="command", required=True)
+ sub.add_parser("docs-only")
+ agg = sub.add_parser("aggregate")
+ for name in ("changes", "checks", "browser", "docs-only"):
+ agg.add_argument(f"--{name}", required=True)
+ args = parser.parse_args(argv)
+ if args.command == "docs-only":
+ print("true" if docs_only(sys.stdin.buffer.read()) else "false")
+ return 0
+ code, message = aggregate(args.changes, args.checks, args.browser, args.docs_only)
+ print(message)
+ return code
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tests/scripts/dev/test_ci_jobs.py b/tests/scripts/dev/test_ci_jobs.py
new file mode 100644
index 00000000..bc1856dc
--- /dev/null
+++ b/tests/scripts/dev/test_ci_jobs.py
@@ -0,0 +1,161 @@
+"""Unit tests for scripts.dev.ci_jobs, the classifier and aggregator the CI uses."""
+
+from __future__ import annotations
+
+import itertools
+
+import pytest
+
+from scripts.dev.ci_jobs import aggregate, docs_only, main
+
+RESULTS = ("success", "failure", "cancelled", "skipped")
+DOCS_ONLY_VALUES = ("true", "false", "", "maybe", "True", "1")
+# Written by hand, not derived from the code: the only shapes quality-gate accepts.
+ACCEPTED = {
+ ("success", "success", "success", "true"),
+ ("success", "success", "success", "false"),
+ ("success", "success", "skipped", "true"),
+}
+
+
+def test_aggregate_passes_only_for_the_accepted_shapes():
+ """GIVEN every combination of the three job results and the docs_only output
+ WHEN aggregate decides
+ THEN it passes exactly for the accepted tuples and fails for all others.
+ """
+ wrong = []
+ for combo in itertools.product(RESULTS, RESULTS, RESULTS, DOCS_ONLY_VALUES):
+ code, _ = aggregate(*combo)
+ if (code == 0) != (combo in ACCEPTED):
+ wrong.append((combo, code))
+ assert wrong == []
+
+
+@pytest.mark.parametrize(
+ "args, culprit",
+ [
+ (("failure", "success", "success", "false"), "changes"),
+ (("cancelled", "success", "success", "false"), "changes"),
+ (("success", "failure", "success", "false"), "checks"),
+ (("success", "success", "failure", "false"), "browser"),
+ (("success", "success", "skipped", "false"), "browser"),
+ (("success", "success", "skipped", "maybe"), "docs_only"),
+ (("success", "success", "success", ""), "docs_only"),
+ ],
+)
+def test_aggregate_failure_message_names_the_offending_job(args, culprit):
+ """GIVEN one job that did not pass
+ WHEN aggregate decides
+ THEN the message names that job.
+ """
+ code, message = aggregate(*args)
+ assert code == 1
+ assert culprit in message
+
+
+def _nul(*paths: str) -> bytes:
+ return b"".join(p.encode() + b"\0" for p in paths)
+
+
+DOCS_ONLY_CASES = [
+ (("docs/guide.txt",), True),
+ (("docs/a/b/c.png",), True),
+ (("README.md",), True),
+ (("a/b/c/notes.md",), True),
+ ((".superpowers/sdd/x/progress.json",), True),
+ (("config/docsync.toml",), True),
+ (("my notes.md",), True),
+ (("docs/a.md", "README.md", "config/docsync.toml"), True),
+ (("docs/a.md", "scrobblescope/app.py"), False),
+ (("README.md", "scripts/dev/x.py"), False),
+ ((".superpowers/x", "tests/test_a.py"), False),
+ (("config/docsync.toml", ".github/workflows/test.yml"), False),
+ (("newtop/file.txt",), False),
+ (("Dockerfile",), False),
+ (("docs_tools/x.py",), False),
+ (("app/docs/x.py",), False),
+ (("notes.mdx",), False),
+ ((".superpowers-old/x.py",), False),
+ (("build.cmd",), False),
+ (("src/my file.py",), False),
+ (("sub/config/docsync.toml",), False),
+ (("config/docsync.toml.bak",), False),
+]
+
+
+@pytest.mark.parametrize("paths, expected", DOCS_ONLY_CASES)
+def test_docs_only_classifies_changed_paths(paths, expected):
+ """GIVEN NUL-separated changed paths
+ WHEN docs_only classifies them
+ THEN it is true only when every path is a documentation path.
+ """
+ assert docs_only(_nul(*paths)) is expected
+
+
+@pytest.mark.parametrize("raw", [b"", b"\0", b"\0\0\0"])
+def test_docs_only_is_false_for_empty_input(raw):
+ """GIVEN empty input or only NUL separators
+ WHEN docs_only classifies it
+ THEN it is false (fail closed).
+ """
+ assert docs_only(raw) is False
+
+
+def test_main_docs_only_reads_stdin_and_prints_the_verdict(capsys, monkeypatch):
+ """GIVEN a docs path on stdin
+ WHEN the docs-only command runs
+ THEN it prints true and returns 0.
+ """
+
+ class _Stdin:
+ buffer = type("B", (), {"read": staticmethod(lambda: b"docs/a.md\0")})()
+
+ monkeypatch.setattr("sys.stdin", _Stdin())
+ assert main(["docs-only"]) == 0
+ assert capsys.readouterr().out.strip() == "true"
+
+
+def test_main_aggregate_returns_one_and_names_the_failure(capsys):
+ """GIVEN a failed checks job
+ WHEN the aggregate command runs
+ THEN it returns 1 and prints the offending job.
+ """
+ argv = [
+ "aggregate",
+ "--changes=success",
+ "--checks=failure",
+ "--browser=success",
+ "--docs-only=false",
+ ]
+ assert main(argv) == 1
+ assert "checks" in capsys.readouterr().out
+
+
+def test_main_aggregate_rejects_an_empty_docs_only_given_as_a_separate_argument(
+ capsys,
+):
+ """GIVEN three green jobs and an empty docs_only (the workflow's separated form)
+ WHEN the aggregate command runs
+ THEN it returns 1 instead of failing argument parsing or passing.
+ """
+ argv = [
+ "aggregate",
+ "--changes=success",
+ "--checks=success",
+ "--browser=success",
+ "--docs-only",
+ "",
+ ]
+ assert main(argv) == 1
+ assert "docs_only" in capsys.readouterr().out
+
+
+def test_main_aggregate_exits_nonzero_when_a_required_flag_is_missing():
+ """GIVEN an aggregate call that omits --browser
+ WHEN the arguments are parsed
+ THEN the command exits non-zero rather than assuming a result.
+ """
+ argv = ["aggregate", "--changes=success", "--checks=success", "--docs-only=true"]
+ with pytest.raises(SystemExit) as exit_info:
+ main(argv)
+ assert exit_info.value.code != 0
diff --git a/tests/scripts/dev/test_frontend_gate.py b/tests/scripts/dev/test_frontend_gate.py
index 1d4c8cec..9f63e9a8 100644
--- a/tests/scripts/dev/test_frontend_gate.py
+++ b/tests/scripts/dev/test_frontend_gate.py
@@ -1,7 +1,7 @@
"""Tests for the repository-owned frontend gate runtime.
Every test here is unit level and starts no browser. The browser behaviour is
-covered by running the gate itself, which is what the Quality Gate does.
+covered by running the gate itself, which is what the CI browser job does.
"""
from __future__ import annotations
diff --git a/tests/test_ci_workflows.py b/tests/test_ci_workflows.py
index 611230fb..2123b621 100644
--- a/tests/test_ci_workflows.py
+++ b/tests/test_ci_workflows.py
@@ -1,4 +1,4 @@
-"""The CI quality-gate job must hold no provider secrets.
+"""Every job in the CI workflow must hold no provider secrets.
conftest.py and frontend_gate.py supply placeholder keys, and no step reads a
real one. A secret set at workflow or job level reaches every step and every
@@ -18,7 +18,7 @@
SECRET_REFERENCE = re.compile(r"\$\{\{\s*secrets\.")
#: A step's own ``env:`` key sits at this indent (`` - name:`` is six, the
-#: step's keys are eight); the workflow ``env:`` is at 0 and the job's at 4.
+#: step's keys are eight); a job's own ``env:`` is at 4.
STEP_ENV_INDENT = 8
@@ -30,14 +30,24 @@ def _indent(line: str) -> int:
return len(line) - len(line.lstrip(" "))
-def _job_level_env(workflow_text: str) -> list[str]:
- """Return the lines of the job-level ``env:`` block (six-space indent)."""
+def _job_lines(workflow_text: str, job: str) -> list[str]:
+ """Return the lines of the named job (two-space ``jobs:`` child)."""
lines = _lines(workflow_text)
- start = next(
- (i for i, line in enumerate(lines) if line == " env:"),
- None,
- )
- assert start is not None, "no job-level env block in test.yml"
+ start = next((i for i, line in enumerate(lines) if line == f" {job}:"), None)
+ assert start is not None, f"no job {job!r} in test.yml"
+ block = []
+ for line in lines[start + 1 :]:
+ if line.strip() and _indent(line) <= 2:
+ break
+ block.append(line)
+ return block
+
+
+def _job_level_env(workflow_text: str, job: str) -> list[str]:
+ """Return the lines of the job's own ``env:`` block (four-space indent)."""
+ lines = _job_lines(workflow_text, job)
+ start = next((i for i, line in enumerate(lines) if line == " env:"), None)
+ assert start is not None, f"no job-level env block in job {job!r}"
block = []
for line in lines[start + 1 :]:
if line.strip() and not line.startswith(" "):
@@ -67,20 +77,26 @@ def _secret_lines_outside_step_env(workflow_text: str) -> list[str]:
return leaked
-def test_test_job_env_passes_no_secret():
+def test_app_jobs_set_flask_env():
text = WORKFLOW.read_text(encoding="utf-8")
- block = _job_level_env(text)
- assert any("FLASK_ENV" in line for line in block), "env block not read"
- leaked = _secret_lines_outside_step_env(text)
+ for job in ("checks", "browser"):
+ block = _job_level_env(text, job)
+ assert any("FLASK_ENV" in line for line in block), f"{job}: env block not read"
+
+
+def test_the_workflow_passes_no_secret_outside_a_step_env():
+ leaked = _secret_lines_outside_step_env(WORKFLOW.read_text(encoding="utf-8"))
assert not leaked, f"the workflow passes secrets outside a step env: {leaked}"
def test_env_reader_flags_a_secret_and_a_missing_block():
text = "jobs:\n a:\n env:\n K: ${{ secrets.K }}\n FLASK_ENV: x\n"
- block = _job_level_env(text)
+ block = _job_level_env(text, "a")
assert [line for line in block if SECRET_REFERENCE.search(line)]
with pytest.raises(AssertionError, match="no job-level env"):
- _job_level_env("jobs:\n a:\n steps: []\n")
+ _job_level_env("jobs:\n a:\n steps: []\n", "a")
+ with pytest.raises(AssertionError, match="no job 'b'"):
+ _job_level_env(text, "b")
STEP = "jobs:\n a:\n steps:\n - name: s\n"
@@ -112,11 +128,11 @@ def test_guard_allows_a_secret_in_a_step_level_env():
APT_ARCHIVES = "/var/cache/apt/archives"
-def _steps(workflow_text: str) -> dict[str, list[str]]:
- """Return each step's lines, keyed by its name, in file order."""
+def _steps(workflow_text: str, job: str) -> dict[str, list[str]]:
+ """Return each step's lines in the named job, keyed by name, in file order."""
steps: dict[str, list[str]] = {}
current = None
- for line in _lines(workflow_text):
+ for line in _job_lines(workflow_text, job):
stripped = line.strip()
if line.startswith(" - name: "):
current = stripped.removeprefix("- name: ")
@@ -166,7 +182,7 @@ def test_playwright_packages_are_restored_seeded_and_saved_around_the_install():
"""The packages are restored before the install, copied into apt's cache
directory before it, copied back after it and saved even when a later
step fails, so a slow mirror is paid for at most once (F-B23-57)."""
- steps = _steps(WORKFLOW.read_text(encoding="utf-8"))
+ steps = _steps(WORKFLOW.read_text(encoding="utf-8"), "browser")
names = list(steps)
for name in (IMAGE_STEP, RESTORE_STEP, INSTALL_STEP, SAVE_STEP):
assert name in names, f"step {name!r} is missing from {names}"