feat(loop): lint the loop's rendered shape with render-check
Per blueprint 019. ROADMAP phase 11 paired 018's ownership move with a lint "so the copies cannot diverge again", and phase 11 did not verify until it landed. Divergence already happened once — six sites, three forms — and what held them together was 018's Verify, a sed range typed into a blueprint, which expires with it. That check also carried a live defect: `CANON=$(sed -n ...)` yields the empty string on a file missing the block, so both copies compared empty-to-empty and printed `match`. A check that cannot fail is not a check; the script errors on a missing owner block instead. A third script rather than a widened sibling: README.md sits at the repo root, outside `okf-check <okf-dir>` and `skill-check <skills-dir>` both, and widening either one's root changes the argv contract 017 built skill-check to mirror. - feat(write-OKF): add scripts/render-check <repo-root> — OKF/ARCHITECTURE.md is the named owner, copies are discovered by walking *.md, and a file with no such fence is a pointer, which phase 11 declares legal. Three error legs: no owner block (or more than one), a copy diverging byte-for-byte after per-line trailing-whitespace strip, and the retired flat form surviving anywhere. OKF/blueprints/ is skipped — a locked Contract is immutable, so a rule that could turn one red would be unfixable, and blueprints quote retired forms as record. - docs(write-OKF): SKILL.md's done-criterion names both scripts, one line for one line — the page sits at the 110-line cap. - docs(okf): append the learning — a Contract carrying a byte-exact artifact eats the blueprint cap. LEARNINGS.md lands at exactly 110. - docs(okf): phase 11 ticked and pruned to the verified form per 013. implements blueprint 019
This commit is contained in:
parent
111d34da1f
commit
bc2d3c971e
@ -103,3 +103,8 @@ status: live
|
||||
**target** exists (does `### 6` resolve?), not pattern-match the citing
|
||||
text, and must range over every file that cites, not only the ones being
|
||||
edited. Source: weave of blueprint 016.
|
||||
- Believed: a blueprint whose Contract fixes a byte-exact artifact keeps
|
||||
room for its own defects. True: 018 crossed the 150-line cap five times
|
||||
in drafting — every fix prose, never the artifact — and then had no room
|
||||
to absorb the false-green in its own Verify; 019 carries it. Price the
|
||||
cap before writing the artifact in. Source: weave of blueprint 019.
|
||||
|
||||
@ -58,17 +58,8 @@ indexed in [index.md](index.md).
|
||||
decision, or NO with its reason — and `grep -rn '\bADR\b' skills/
|
||||
OKF/` returns only the trigger-alias uses `CONTEXT.md` preserves.
|
||||
|
||||
11. **the loop's shape stops being a hand-copied string** — the spine is
|
||||
written out in six sites in three divergent forms, and a flat string
|
||||
cannot state cadence: write-OKF fires on drift, a request routes
|
||||
through architect, `moor` closes only a ferry-traced chain.
|
||||
[ARCHITECTURE.md](ARCHITECTURE.md) flow 1 becomes the single owner
|
||||
of the shape, `CONTEXT.md`'s entry points at it, and `steer` renders
|
||||
the routing fork instead of a list — paired with a lint so the
|
||||
copies cannot diverge again. **Verify:** every site rendering the
|
||||
spine either matches the declared rendering byte-for-byte or is a
|
||||
pointer to flow 1, checked by script; `okf-check OKF/` 0 errors;
|
||||
caps hold.
|
||||
11. **the loop's shape stops being a hand-copied string** — ✅ verified
|
||||
2026-07-30, [019](blueprints/019-add-a-render-lint-over-the-loop-shape.md).
|
||||
|
||||
## Risks & gotchas
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
type: Blueprint
|
||||
status: locked
|
||||
status: implemented
|
||||
traces-to: ROADMAP.md phase 11
|
||||
sounded: 2026-07-30
|
||||
cites:
|
||||
|
||||
@ -40,7 +40,7 @@ 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
|
||||
- [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
|
||||
- [019](blueprints/019-add-a-render-lint-over-the-loop-shape.md) — add a render lint over the loop's shape — locked
|
||||
- [019](blueprints/019-add-a-render-lint-over-the-loop-shape.md) — add a render lint over the loop's shape — implemented
|
||||
- [020](blueprints/020-enforce-the-prune-and-validate-every-cite.md) — enforce the roadmap prune and validate every page's cites — locked
|
||||
|
||||
## Ferries
|
||||
|
||||
@ -80,9 +80,9 @@ contract: [okf-layout.md](okf-layout.md).
|
||||
judgement.
|
||||
|
||||
## Output / done criteria
|
||||
- **`scripts/okf-check <okf-dir>` run and its output pasted**, exiting 0.
|
||||
Invoke it by this skill's own base directory — `skills/loop/...`
|
||||
resolves only inside octobot. A claim of conformance is not a gate.
|
||||
- **`scripts/okf-check <okf-dir>` and `scripts/render-check <repo-root>`
|
||||
run and output pasted**, exiting 0 — invoke by this skill's own base
|
||||
directory, `skills/loop/...` being octobot-only. Claims are not gates.
|
||||
- `OKF/` matches [okf-layout.md](okf-layout.md) including its
|
||||
conformance block; `index.md` links every page that exists.
|
||||
- `AGENTS.md` carries the hook block.
|
||||
|
||||
105
skills/loop/write-OKF/scripts/render-check
Executable file
105
skills/loop/write-OKF/scripts/render-check
Executable file
@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Validate the rendered loop shape. Usage: render-check <repo-root>
|
||||
|
||||
Errors (exit 1): the owner page carrying no loop block or more than one,
|
||||
a render site diverging from the owner, the retired flat form surviving.
|
||||
Nothing warns yet; the tally keeps the siblings' shape.
|
||||
|
||||
`OKF/ARCHITECTURE.md` flow 1 is the sole owner of the shape; every other
|
||||
site is a byte-copy of it or a pointer to it, and a pointer is legal. A
|
||||
missing owner block is an error rather than a silent pass because a check
|
||||
that cannot fail is not a check: comparing two copies against a vacuum
|
||||
matches them both.
|
||||
|
||||
`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
|
||||
blueprints quote retired forms as record.
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
OWNER = "OKF/ARCHITECTURE.md"
|
||||
SENTINEL = "substrate (rare) write-OKF — scaffold, or refresh when stale"
|
||||
RETIRED = "architect → blueprint"
|
||||
SKIP = ("OKF/blueprints/",)
|
||||
|
||||
|
||||
def render_sites(text):
|
||||
"""Fenced blocks opening on the sentinel, as (line number, lines).
|
||||
|
||||
The line number is the fence's, 1-based, so an error reads as a cite.
|
||||
"""
|
||||
sites, start, block = [], 0, None
|
||||
for number, line in enumerate(text.splitlines(), 1):
|
||||
if line.startswith("```"):
|
||||
if block is None:
|
||||
start, block = number, []
|
||||
else:
|
||||
if block and block[0].rstrip() == SENTINEL:
|
||||
sites.append((start, block))
|
||||
block = None
|
||||
elif block is not None:
|
||||
block.append(line)
|
||||
return sites
|
||||
|
||||
|
||||
def diverges(site, canon):
|
||||
"""First 1-based line at which a copy departs from the owner.
|
||||
|
||||
Trailing whitespace is stripped per line and nothing else is
|
||||
normalised: the block is box-drawing art whose column positions carry
|
||||
the fork, so a reflowed copy is a broken diagram, not a variant.
|
||||
"""
|
||||
site = [line.rstrip() for line in site]
|
||||
canon = [line.rstrip() for line in canon]
|
||||
for number, (copied, owned) in enumerate(zip(site, canon), 1):
|
||||
if copied != owned:
|
||||
return number
|
||||
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):
|
||||
if len(argv) != 2:
|
||||
print("usage: render-check <repo-root>", file=sys.stderr)
|
||||
return 2
|
||||
root = Path(argv[1]).resolve()
|
||||
if not root.is_dir():
|
||||
print(f"not a directory: {root}", file=sys.stderr)
|
||||
return 2
|
||||
|
||||
errors = []
|
||||
owner = root / OWNER
|
||||
owned = render_sites(owner.read_text()) if owner.exists() else []
|
||||
if len(owned) != 1:
|
||||
errors.append(f"{OWNER}: {len(owned)} loop blocks, expected 1")
|
||||
|
||||
for page, rel in pages(root):
|
||||
text = page.read_text()
|
||||
if RETIRED in text:
|
||||
errors.append(f"{rel}: retired flat form: {RETIRED}")
|
||||
if len(owned) != 1 or page == owner:
|
||||
continue
|
||||
for number, site in render_sites(text):
|
||||
line = diverges(site, owned[0][1])
|
||||
if line:
|
||||
errors.append(f"{rel}:{number}: diverges from {OWNER} at block line {line}")
|
||||
|
||||
for line in errors:
|
||||
print(f"ERROR {line}")
|
||||
print(f"{len(errors)} error(s), 0 warning(s)")
|
||||
return 1 if errors else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv))
|
||||
Loading…
x
Reference in New Issue
Block a user