refactor(lints): walk only what git does not ignore

link-check and render-check each held a byte-identical pages() that
walked the filesystem, so gitignored HANDOFF.md could redden a repo-wide
gate — 024 had to carry "clear HANDOFF.md first" as a run condition, and
a handoff had to be written link-free.

Both now import a shared pages() from _pages.py, whose census comes from
git ls-files --cached --others --exclude-standard: tracked plus
untracked-but-not-ignored is exactly not-ignored, so a page is walked
before it is ever added. Where git cannot answer — not a repo, no git on
PATH — the walk falls back to the old rglob rather than shrinking to
nothing, and the catch is narrow so an unnamed git failure still
surfaces.

023 and 019 each state the old walk in their Contract, so both take
superseded-by-026; their Contract and Verify are untouched, per 022.
023 also cited the docstring the walk moved out of, so that cite follows
it to _pages.py — a cite is a working pointer at every status, per 022 —
and _pages.py words that docstring on one line, because a cite symbol
that wraps never resolves.

026 passed its muster gate (matches: yes) and flips to implemented. Its
Justification loses three lines to fit the tally: block; its Contract and
Verify are byte-identical.

blueprint 026
This commit is contained in:
Łukasz Boryń 2026-07-31 16:40:18 +02:00
parent 4c96a80836
commit 38eae57e6f
8 changed files with 102 additions and 54 deletions

View File

@ -1,6 +1,6 @@
--- ---
type: Blueprint type: Blueprint
status: implemented status: superseded-by-026
traces-to: ROADMAP.md phase 11 traces-to: ROADMAP.md phase 11
sounded: 2026-07-30 sounded: 2026-07-30
cites: cites:

View File

@ -1,13 +1,13 @@
--- ---
type: Blueprint type: Blueprint
status: implemented status: superseded-by-026
traces-to: ROADMAP.md phase 12 traces-to: ROADMAP.md phase 12
sounded: 2026-07-31 sounded: 2026-07-31
cites: cites:
- OKF/ROADMAP.md - OKF/ROADMAP.md
- OKF/ARCHITECTURE.md:Cross-links - OKF/ARCHITECTURE.md:Cross-links
- OKF/blueprints/002-extract-why-register.md:ADR-FORMAT.md - OKF/blueprints/002-extract-why-register.md:ADR-FORMAT.md
- skills/loop/write-OKF/scripts/render-check:dot-directories and blueprints out - skills/loop/write-OKF/scripts/_pages.py:dot-directories and blueprints out
- OKF/blueprints/019-add-a-render-lint-over-the-loop-shape.md:Why a third script - OKF/blueprints/019-add-a-render-lint-over-the-loop-shape.md:Why a third script
- OKF/blueprints/017-add-a-line-cap-lint-over-skills.md:Why a sibling script - OKF/blueprints/017-add-a-line-cap-lint-over-skills.md:Why a sibling script
- OKF/decisions/016-one-okf-check-validator.md:One `okf-check` validator - OKF/decisions/016-one-okf-check-validator.md:One `okf-check` validator

View File

@ -1,6 +1,6 @@
--- ---
type: Blueprint type: Blueprint
status: locked status: implemented
traces-to: user request 2026-07-31 traces-to: user request 2026-07-31
sounded: 2026-07-31 sounded: 2026-07-31
cites: cites:
@ -12,6 +12,10 @@ cites:
- OKF/blueprints/022-validate-every-cite-at-every-status.md:its Contract and Verify are not touched - OKF/blueprints/022-validate-every-cite-at-every-status.md:its Contract and Verify are not touched
- OKF/ROADMAP.md - OKF/ROADMAP.md
muster: true muster: true
review-base: yommvsuw
tally:
intent: share one git-aware walk so an ignored page cannot redden a gate
matches: yes
--- ---
# 026 — walk only what git does not ignore # 026 — walk only what git does not ignore
@ -19,31 +23,28 @@ muster: true
## Justification ## Justification
**A repo-wide gate reddens on a file the repo does not own.** `HANDOFF.md` is **A repo-wide gate reddens on a file the repo does not own.** `HANDOFF.md` is
gitignored, and both `link-check` and `render-check` walk it anyway, so a gitignored, yet both lints walk it, so scratch prose can fail the tree. The
session's scratch prose can fail the tree. The cost is already paid: cost is paid: [024](024-rename-the-spine-and-give-chart-its-ferry-edge.md)
[024](024-rename-the-spine-and-give-chart-its-ferry-edge.md) had to carry carries *clear gitignored `HANDOFF.md` first* as a **run condition**, and a
*clear gitignored `HANDOFF.md` first* as a **run condition** on its own Verify, handoff must be written link-free, quoting no lint constant. 024 §Out of scope
and a handoff must be written around both lints — link-free, quoting no lint declines it *"but that Contract is sealed — the fix is a supersession, not a
constant. 024's §Out of scope declines the fix in place *"but that Contract is line in a rename."*
sealed — the fix is a supersession, not a line in a rename."* This is it.
**The measured census, not the remembered one.** Exactly **one** `.md` in the **The measured census.** Exactly **one** `.md` in the walk is ignored —
walk is ignored — `HANDOFF.md`; nothing else is ignored, nothing untracked. `HANDOFF.md`; nothing untracked. **Zero** of 516 relative links sit inside
**Zero** of 516 relative links on live pages sit inside inline-code spans. So inline-code spans, so [023](023-add-a-link-lint-over-relative-md-links.md)'s
[023](023-add-a-link-lint-over-relative-md-links.md)'s ruling that inline-code ruling that inline-code spans are unreal holds for every page left once the
spans are unreal stays true of every page remaining once the ignored one ignored one goes — the only page wanting one is the only ignored page. The
leaves — the only page wanting a link in backticks is the only ignored page. backtick rule earns nothing, failing
The backtick rule is not adopted: it would earn nothing, failing [sieve](../../skills/engineering/sieve/SKILL.md)'s Real test.
[sieve](../../skills/engineering/sieve/SKILL.md)'s Real test as 023 found.
**Why both lints.** `pages()` is **byte-identical** in the two, `SKIP` **Why both lints.** `pages()` is **byte-identical** in the two, `SKIP`
included, and `render-check` carries a retired-form constant a handoff cannot included, and `render-check` holds a retired-form constant a handoff cannot
quote either. Ruling the walk for one and leaving its twin is the quote either. Fixing one and leaving its twin is the shape this repo has
prose-failed-to-hold shape this repo has mechanised three times — mechanised three times — [017](017-add-a-line-cap-lint-over-skills.md),
[017](017-add-a-line-cap-lint-over-skills.md), [019](019-add-a-render-lint-over-the-loop-shape.md) and
[019](019-add-a-render-lint-over-the-loop-shape.md), [020](020-enforce-the-prune-and-validate-every-cite.md). `okf-check` and
[020](020-enforce-the-prune-and-validate-every-cite.md). `okf-check` (`OKF/`) `skill-check` cannot reach an ignored page.
and `skill-check` (`skills/*/*/SKILL.md`) cannot reach an ignored page.
## Contract ## Contract

View File

@ -41,14 +41,14 @@ your task needs. Humans welcome too.
- [016](blueprints/016-pull-two-skills-under-cap-and-level-commit-twins.md) — pull two skills under the line cap and level the commit twins — implemented - [016](blueprints/016-pull-two-skills-under-cap-and-level-commit-twins.md) — pull two skills under the line cap and level the commit twins — implemented
- [017](blueprints/017-add-a-line-cap-lint-over-skills.md) — add a line-cap lint over skills/ — implemented - [017](blueprints/017-add-a-line-cap-lint-over-skills.md) — add a line-cap lint over skills/ — implemented
- [018](blueprints/018-own-the-loop-shape-in-flow-1.md) — own the loop's shape in ARCHITECTURE flow 1 — implemented - [018](blueprints/018-own-the-loop-shape-in-flow-1.md) — own the loop's shape in ARCHITECTURE flow 1 — implemented
- [019](blueprints/019-add-a-render-lint-over-the-loop-shape.md) — add a render lint over the loop's shape — implemented - [019](blueprints/019-add-a-render-lint-over-the-loop-shape.md) — add a render lint over the loop's shape — superseded-by-026
- [020](blueprints/020-enforce-the-prune-and-validate-every-cite.md) — enforce the roadmap prune and validate every page's cites — superseded-by-022 - [020](blueprints/020-enforce-the-prune-and-validate-every-cite.md) — enforce the roadmap prune and validate every page's cites — superseded-by-022
- [021](blueprints/021-align-validator-and-doctrine.md) — align the validator and the doctrine on splits, prefixes and cites — implemented - [021](blueprints/021-align-validator-and-doctrine.md) — align the validator and the doctrine on splits, prefixes and cites — implemented
- [022](blueprints/022-validate-every-cite-at-every-status.md) — enforce the roadmap prune and validate every cite at every status — implemented - [022](blueprints/022-validate-every-cite-at-every-status.md) — enforce the roadmap prune and validate every cite at every status — implemented
- [023](blueprints/023-add-a-link-lint-over-relative-md-links.md) — add a link lint over relative markdown links — implemented - [023](blueprints/023-add-a-link-lint-over-relative-md-links.md) — add a link lint over relative markdown links — superseded-by-026
- [024](blueprints/024-rename-the-spine-and-give-chart-its-ferry-edge.md) — rename the spine to chart and rig, and give chart its ferry edge — implemented - [024](blueprints/024-rename-the-spine-and-give-chart-its-ferry-edge.md) — rename the spine to chart and rig, and give chart its ferry edge — implemented
- [025](blueprints/025-rule-muster-on-every-blueprint.md) — rule muster on every blueprint — implemented - [025](blueprints/025-rule-muster-on-every-blueprint.md) — rule muster on every blueprint — implemented
- [026](blueprints/026-walk-only-what-git-does-not-ignore.md) — walk only what git does not ignore — locked - [026](blueprints/026-walk-only-what-git-does-not-ignore.md) — walk only what git does not ignore — implemented
## Ferries ## Ferries

View File

@ -31,3 +31,12 @@ status: live
by two columns leaves the right-hand column and its arrows misaligned in by two columns leaves the right-hand column and its arrows misaligned in
all three at once and the check still passes. Re-pad the trailing columns all three at once and the check still passes. Re-pad the trailing columns
by hand. Source: rig of B-024. by hand. Source: rig of B-024.
- Believed: superseding a blueprint costs one status word, so extracting
shared code cannot touch the page it supersedes. True: a `cites:` symbol
is a substring of *a named file*, so moving the cited lines into a new
helper breaks the cite — `okf-check` went red on B-023 for a docstring
that had moved to `_pages.py`, after the diff was already sealed. Per
B-022 a cite is a working pointer at every status, so the pointer
follows the symbol. Repointing has a trap of its own: the phrase wrapped
across two lines in its new home, and a wrapped symbol never resolves,
so the obvious repoint stays red. Source: rig of B-026.

View File

@ -0,0 +1,56 @@
"""The lints' shared walk over the repo's markdown pages.
A helper, not a fifth lint: no `main`, no argv contract. `link-check` and
`render-check` held a byte-identical `pages()` each; ruling the walk for
one and leaving its twin is the shape this repo has mechanised against
three times, so the walk lives here and both import it.
A page git ignores is not the repo's to gate. `HANDOFF.md` is written
per session and gitignored, and a walk that reads it lets scratch prose
redden a repo-wide check.
"""
import subprocess
from pathlib import Path
SKIP = ("OKF/blueprints/",)
def unignored(root):
"""Every `*.md` git does not ignore, relative to the root.
`--cached --others --exclude-standard` is tracked plus
untracked-but-not-ignored, which is exactly *not ignored*: a page is
walked before it is ever added, so this is a `.md` census and not a
staging gate.
Returns None where git cannot answer — not a repo, no git on PATH.
The caller falls back to the whole tree rather than shrinking to
nothing: a lint that goes quiet is worse than one that over-reports.
The catch is narrow for the same reason, so a git failure this does
not name still surfaces instead of passing as a silent full walk.
"""
try:
listed = subprocess.run(
["git", "-C", str(root), "ls-files", "-z", "--cached",
"--others", "--exclude-standard", "--", "*.md"],
capture_output=True, text=True, check=True).stdout
except (OSError, subprocess.CalledProcessError):
return None
return {Path(name) for name in listed.split("\0") if name}
def pages(root):
"""Every `*.md` under the root that git does not ignore.
Sorted, dot-directories and blueprints out, as `(page, rel)`.
"""
live = unignored(root)
for page in sorted(root.rglob("*.md")):
rel = page.relative_to(root)
if live is not None and rel not in live:
continue
if any(part.startswith(".") for part in rel.parts):
continue
if rel.as_posix().startswith(SKIP):
continue
yield page, rel

View File

@ -14,14 +14,16 @@ surfaces as a failed read, not an error, so the signal has to be static.
Fenced blocks are skipped: there a link is illustration, not navigation. Fenced blocks are skipped: there a link is illustration, not navigation.
`OKF/blueprints/` is skipped for its siblings' reason — a locked `OKF/blueprints/` is skipped for its siblings' reason — a locked
blueprint is append-only, so a rename cannot repair a link inside one. blueprint is append-only, so a rename cannot repair a link inside one.
A page git ignores is skipped too: the walk is `_pages.py`'s.
""" """
import re import re
import sys import sys
from pathlib import Path from pathlib import Path
from _pages import pages
LINK = re.compile(r"\]\(([^)]*)\)") LINK = re.compile(r"\]\(([^)]*)\)")
EXTERNAL = ("http://", "https://", "mailto:", "#") EXTERNAL = ("http://", "https://", "mailto:", "#")
SKIP = ("OKF/blueprints/",)
def targets(text): def targets(text):
@ -40,17 +42,6 @@ def targets(text):
yield number, target yield number, target
def pages(root):
"""Every `*.md` under the root, dot-directories and blueprints out."""
for page in sorted(root.rglob("*.md")):
rel = page.relative_to(root)
if any(part.startswith(".") for part in rel.parts):
continue
if rel.as_posix().startswith(SKIP):
continue
yield page, rel
def main(argv): def main(argv):
if len(argv) != 2: if len(argv) != 2:
print("usage: link-check <repo-root>", file=sys.stderr) print("usage: link-check <repo-root>", file=sys.stderr)

View File

@ -13,15 +13,17 @@ matches them both.
`OKF/blueprints/` is skipped. A locked blueprint's Contract is immutable, `OKF/blueprints/` is skipped. A locked blueprint's Contract is immutable,
so a rule that could turn one red would be unfixable by design, and so a rule that could turn one red would be unfixable by design, and
blueprints quote retired forms as record. blueprints quote retired forms as record. A page git ignores is skipped
too: the walk is `_pages.py`'s.
""" """
import sys import sys
from pathlib import Path from pathlib import Path
from _pages import pages
OWNER = "OKF/ARCHITECTURE.md" OWNER = "OKF/ARCHITECTURE.md"
SENTINEL = "substrate (rare) write-OKF — scaffold, or refresh when stale" SENTINEL = "substrate (rare) write-OKF — scaffold, or refresh when stale"
RETIRED = "chart → blueprint" RETIRED = "chart → blueprint"
SKIP = ("OKF/blueprints/",)
def render_sites(text): def render_sites(text):
@ -58,17 +60,6 @@ def diverges(site, canon):
return min(len(site), len(canon)) + 1 if len(site) != len(canon) else 0 return min(len(site), len(canon)) + 1 if len(site) != len(canon) else 0
def pages(root):
"""Every `*.md` under the root, dot-directories and blueprints out."""
for page in sorted(root.rglob("*.md")):
rel = page.relative_to(root)
if any(part.startswith(".") for part in rel.parts):
continue
if rel.as_posix().startswith(SKIP):
continue
yield page, rel
def main(argv): def main(argv):
if len(argv) != 2: if len(argv) != 2:
print("usage: render-check <repo-root>", file=sys.stderr) print("usage: render-check <repo-root>", file=sys.stderr)