Skip to content

ci(design): run contracts.py in lint and re-anchor the post-#1051 contracts - #1075

Merged
wei18 merged 4 commits into
mainfrom
ci/1064-design-contracts
Sep 13, 2026
Merged

wei18 merged 4 commits into
mainfrom
ci/1064-design-contracts

Conversation

@wei18

@wei18 wei18 commented Sep 13, 2026 •

Copy link
Copy Markdown
Owner

Closes #1064
part of #1014

What

scripts/design/contracts.py has printed RESULT: FAIL on main since #1051, and no CI job or mise task ran it. This PR fixes the four broken anchors and wires the gate into CI so the next broken anchor fails its PR.

File Change
scripts/design/contracts.py C-4 / C-5 / C-25 / C-29: STATS → PROGRESS (4 lines)
mise-tasks/scan/design_contracts new task scan:design_contracts (bash wrapper, stdlib python, gate mode)
.github/workflows/lint.yml new job 7 design-contracts (ubuntu-latest) + job index / count in the header

Re-anchoring: checked row by row, not a blind rename

contracts.py's one-line descriptions are the only change-table text for these IDs. design.md §9 and prototype.html only give counts. I read each row against the retired ## STATS section (git show 8867b583^:docs/screen-contracts.md) and the current ## PROGRESS section:

ID Change Where it lives in ## PROGRESS
C-4 rename to PROGRESS + record display Section header: "STATS is retired … replaced by this contract". The element inventory is the record display (design.md §3.3).
C-5 "no forward navigation" no longer holds STATS said "Per-interaction outcome: none". PROGRESS has a per-interaction outcome table: Achievements / Leaderboards → native GC dashboard, or the signed-out alert. Nuance: these are presentations, not route pushes (PROGRESS says so explicitly), but the "no interactive outcome" claim is gone, and this table is where C-5 lives.
C-25 6 tiles → personal bests + streak calendar Element inventory: 3 PersonalBestRows merging Daily + Practice, plus the month StreakCalendarView.
C-29 the two PROGRESS rows' copy is bound to official GC terms Element inventory: Achievements row "HIG-mandated term, never Trophies/Awards/Medals"; Leaderboards row.

All four have a valid home; none had to be forced. With PROGRESS now counted as touched, the coverage output is byte-identical to design.md Appendix A (19/23 sections, same untouched list), which was measured while ## STATS still existed. So PROGRESS is the section Appendix A was counting.

Local before / after

Before (origin/main b92ad5e), python3 scripts/design/contracts.py:

contract anchoring gate
  repo root: <repo>
==============================================================================
canonical shape
  screen-contracts.md : 23 slug sections (expected 23)
  navigation-flows.md : 38 rows  S=7 M=8 N=23  (expected S=7 M=8 N=23, total 38)

anchors

coverage
  change entries      : 36 screen-contracts (40 anchor rows), 28 navigation-flows (32 anchor rows)
  canonical touched   : 19/23 slug sections, 24/38 nav rows
  untouched sections  : CLEAR-CACHE-DIALOG, PROGRESS, REMINDER-DENIED, REMINDER-PRIMER, UMP-CONSENT
  NOT YET ANCHORED    : 2 screen (C-16, C-27), 7 nav (N-A, N-B, N-C, N-X, N-Y, N-Z, N-AB)
                        (these describe new sections or prose-level model changes;
                         anchoring them is the remaining spec-PR work item)

FAILURES (4):
  C-4 anchors to '## STATS' which does not exist in screen-contracts.md
  C-5 anchors to '## STATS' which does not exist in screen-contracts.md
  C-25 anchors to '## STATS' which does not exist in screen-contracts.md
  C-29 anchors to '## STATS' which does not exist in screen-contracts.md

RESULT: FAIL
exit=1

After (this branch):

contract anchoring gate
  repo root: <repo>
==============================================================================
canonical shape
  screen-contracts.md : 23 slug sections (expected 23)
  navigation-flows.md : 38 rows  S=7 M=8 N=23  (expected S=7 M=8 N=23, total 38)

anchors

coverage
  change entries      : 36 screen-contracts (40 anchor rows), 28 navigation-flows (32 anchor rows)
  canonical touched   : 19/23 slug sections, 24/38 nav rows
  untouched sections  : CLEAR-CACHE-DIALOG, REMINDER-DENIED, REMINDER-PRIMER, UMP-CONSENT
  NOT YET ANCHORED    : 2 screen (C-16, C-27), 7 nav (N-A, N-B, N-C, N-X, N-Y, N-Z, N-AB)
                        (these describe new sections or prose-level model changes;
                         anchoring them is the remaining spec-PR work item)

RESULT: PASS — canonical shape matches, every stated anchor resolves
exit=0

mise tasks ls lists scan:design_contracts, and mise run scan:design_contracts exits 0.

CI mode

The job runs the script's default gate mode (no args). For the record, --coverage would not have been a silent bypass either: main() returns 1 on any failure before the coverage_only branch, so the flag only changes the PASS message. The job still uses the default mode, as the issue asked.

Negative test (CI)

Commit What Lint → Design contract anchoring gate (#1064)
f4ebeb09 the fix ✅ success, https://github.com/wei18/Sudoku/actions/runs/34732032758 (all 7 jobs green)
ac67ed23 temporary break: C-4 → PROGRES ❌ failure, https://github.com/wei18/Sudoku/actions/runs/34732052909/job/103656526240. Log: C-4 anchors to '## PROGRES' which does not exist in screen-contracts.md / RESULT: FAIL / Process completed with exit code 1. The other 6 jobs stayed green, so the red comes from this gate alone.
8d49dff2 git revert of the break (tree identical to f4ebeb09) ✅ success, https://github.com/wei18/Sudoku/actions/runs/34732104029/job/103656665701 (all 7 jobs green)

Squash-merge collapses the break and revert commits, so neither lands on main.

Not verified

  • shellcheck on the new task: the binary has no version set on this machine, so it didn't run. The script is a 3-line set -euo pipefail / cd / exec wrapper, the same shape as store_baseline_orphans.
  • actionlint isn't installed. lint.yml parses as YAML (Ruby YAML.load_file: 7 jobs, design-contracts on ubuntu-latest), and the CI runs below exercise it for real.

🤖 Generated with Claude Code

wei18 and others added 3 commits September 13, 2026 10:02
…tracts

scripts/design/contracts.py has been RESULT: FAIL on main since #1051
renamed `## STATS` to `## PROGRESS` in docs/screen-contracts.md, and no
CI job or mise task ran it, so nobody noticed.

- Re-anchor C-4 / C-5 / C-25 / C-29 to `## PROGRESS`, each checked
  against the section text: C-4 (PROGRESS replaces the retired STATS
  contract, record display), C-5 (STATS' "per-interaction outcome: none"
  no longer holds, PROGRESS has an outcome table for its GC rows), C-25
  (6 tiles -> merged personal-best rows + streak calendar), C-29
  (Achievements / Leaderboards rows bound to HIG terms). Output is now
  byte-identical to design.md Appendix A.
- Add `mise run scan:design_contracts` (gate mode, exit 1 on a broken
  anchor or canonical drift).
- Add lint.yml job 7 `design-contracts` on ubuntu-latest.

Closes #1064
part of #1014

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Negative test for #1064: C-4 now anchors to a non-existent `## PROGRES`.
The design-contracts job must fail on this commit. Reverted in the next
commit.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…te goes red"

Negative test for #1064 recorded (design-contracts job red on ac67ed2).
Restore C-4's anchor to `## PROGRESS`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18
wei18 marked this pull request as ready for review September 13, 2026 02:05
…mment

CR (sonnet) on #1075: only 2 merges landed on main between #1051 and the
filing of #1064 (26cec63, 32b1f5b); the "six" was inherited from the
issue body. Reword without a count.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@wei18

wei18 commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Dual CR + fresh-context acceptance: ACCEPT

Two independent read-only reviewers (sonnet and haiku) ran the same prompt. Each also served as the fresh-context acceptance check against the 6 done-when criteria of #1064. Both read the PR head via git show, ran the gate from a temp copy of the head files, and re-checked the CI runs themselves.

Reviewer CR Acceptance Findings
sonnet APPROVE-WITH-NITS ACCEPT 1 MINOR in scope, fixed; 4 MINOR out of scope (below)
haiku APPROVE ACCEPT none

In-scope MINOR (fixed in ceb7f6c8): mise-tasks/scan/design_contracts:9-10 said the gate stayed red "through six merges". The two reviewers disagreed here, so I re-checked with git log --first-parent 714a58c9..b92ad5e2. Only 2 merges landed between #1051 and the filing of #1064 (26cec630, 32b1f5ba); the "six" came from the issue body. The comment is now reworded without a count. Lint run on the new head: all 7 jobs green, https://github.com/wei18/Sudoku/actions/runs/34733082840

Verified by both reviewers:

  • The PR head exits 0, and its output is byte-identical to design.md Appendix A.
  • A broken C-4 anchor exits 1 in both the default mode and --coverage.
  • design_contracts is mode 100755 and uses exec, so the script's exit code reaches CI.
  • lint.yml has 7 job keys, matching its header.
  • Run 34732052909 failed only in the design-contracts job, with the PROGRES line.
  • git diff f4ebeb09 8d49dff2 is empty.
  • Title, Closes #1064 / part of #1014, and the squash-only setting check out.

Out-of-scope drift (pre-existing; this PR does not touch these docs; follow-up candidate): these anchors still resolve for the gate, but the prose still describes the retired HOME entry points.

  • docs/screen-contracts.md:78 and :90: ## HOME still points to ## STATS / "push → STATS".
  • docs/screen-contracts.md:1227: GC-DASHBOARD entry points still say "HOME leaderboard card".
  • docs/navigation-flows.md:202: S5 still starts at HOME(Leaderboard…), although N-F says the GC entry moved to PROGRESS.
  • docs/navigation-flows.md:280: N14 still cites "reachable from HOME leaderboard card", although N-Q says the same.

contracts.py only checks that anchors declared in its tables resolve, not what inline prose says, so it cannot catch these.

Not verified: shellcheck / actionlint (not available locally); branch-protection required-check wiring for the new job.

🤖 Generated with Claude Code

@wei18
wei18 merged commit 26e1b3a into main Sep 13, 2026
7 checks passed
@wei18
wei18 deleted the ci/1064-design-contracts branch September 13, 2026 02:29
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.

test(design): scripts/design/contracts.py has been RESULT: FAIL on main since #1051 — and nothing runs it

1 participant