Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .claude/SESSION_CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down Expand Up @@ -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.
<!-- DOCSYNC:STATUS-END -->

Expand Down Expand Up @@ -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
Expand Down
112 changes: 105 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
12 changes: 8 additions & 4 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</picture>
</h1>

Last updated: 2026-10-30
Last updated: 2026-10-31

<p align="center"><strong>Your Last.fm listening habits, visualized.</strong></p>

Expand All @@ -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)**

Expand Down
2 changes: 1 addition & 1 deletion config/docsync.toml
Original file line number Diff line number Diff line change
Expand Up @@ -739,4 +739,4 @@ allow_files = ["docs/history/*", "docs/logarchive/*", "docs/superpowers/*", "CLA
grandfathered = []

[test_count]
pinned = 3120
pinned = 3158
2 changes: 1 addition & 1 deletion docs/agents/FINDINGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading
Loading