ADR housekeeping: category prefixes, lifecycle folders, retroactive 0034-0037
Filename + lifecycle:
- ADR rename to ADR-NNNN-<cat>-title.md with 8 3-letter category prefixes
(dev / mem / lat / prog / algo / par / api / ver). Numbers stay immutable.
- ADR Lifecycle split into 3 folders, documented in CLAUDE.md Part 2:
docs/adr/ (Accepted), docs/adr-proposed/ (Proposed/Stub/Draft),
docs/adr-history/ (Superseded/Merged). Status field gains "Draft" for
retroactive docs pending verification.
Merges (one ADR per topic, no change-history annotations):
- ADR-0017 absorbs ADR-0019 (Cube NOC + per-PE HBM connectivity, 10 D-items)
- ADR-0014 absorbs ADR-0021 (PE pipeline execution model, 8 D-items incl.
TileToken self-routing and multi-op composite epilogue scope)
- ADR-0023 absorbs docs/ipcq-dma-codesign-hw.md as new "HW Realization
Notes (Informative)" section (D16-D23 + Open HW Questions). codesign-hw.md
deleted; ADR-0019/0021 moved to adr-history with one-line stub status
Retroactive documentation (G4 closures, code-verified):
- ADR-0037 forwarding component (TransitComponent: first-flit overhead,
serial worker, path-based routing, single impl/multiple names)
- ADR-0036 IO_CPU component (target_start_ns global barrier stamping,
per-cube fan-out, response aggregation)
- ADR-0035 M_CPU & M_CPU.DMA component (3 fan-out paths, DMA Resources,
target_start_ns passthrough)
- ADR-0034 HBM controller internal design (per-PC state, address-based
selection, flit-aware per-flit commit, async finalize, command-only
fallback path)
Content updates:
- ADR-0010 expanded to full CLI surface (run/probe/web), retitled
"Command Line Interface and Execution Semantics"
- ADR-0007 D2 rewritten to current state; ADR-0015 supersession notes pruned
- ADR-0005 wrapped in Decision header with D1-D5; ADR-0022 metadata
block replaced with standard Status header
- ADR-0024 trimmed to rank=SIP launcher essentials (D1-D4);
ADR-0027 cleaned of supersession history
- ADR-0033 D6 cleanup: address-based PC selection moved out of future-work
(now documented in ADR-0034 D3); related D1/D3 wording realigned
- Cross-references back-filled in 5 ADRs (G3 gaps closed)
Onboarding docs split:
- docs/onboarding/ created
- moved: hw-architecture-overview.md, latency-model.md, di-presentation.md,
ccl-author-guide{,.en}.md
- references updated in README, ADR-0023{,.en}, src/kernbench/ccl/__init__.py
Source / test / yaml: ADR-NNNN cross-references in docstrings and YAML
comments updated after the merges (ADR-0021->0014 D6, ADR-0019->0017 D8).
No behavior change.
Tooling:
- tools/verify_adr_lang_pairs.py + tests/test_verify_adr_lang_pairs.py
(ADR EN/KO pair invariant checker)
- .claude/commands/report.md tracked (/report slash command)
- .gitignore: allow .claude/commands/*.md while keeping settings files ignored
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
"""Verify ADR language pair invariants.
|
||||
|
||||
Policy (see CLAUDE.md Part 2 -> ADR Translation Discipline):
|
||||
docs/adr/ : English canonical
|
||||
docs/adr-ko/ : Korean translation (1:1 mirror)
|
||||
docs/adr-history/: frozen, not checked (transitional)
|
||||
docs/adr-proposed/: language-free, not checked
|
||||
|
||||
Checks:
|
||||
- every docs/adr/<X>.md has a matching docs/adr-ko/<X>.md
|
||||
- every docs/adr-ko/<X>.md has a matching docs/adr/<X>.md (no orphans)
|
||||
- title line `# ADR-NNNN:` of each pair matches the filename's NNNN
|
||||
- `## Status` block content is byte-equal (after CRLF/LF normalization)
|
||||
between EN and KO
|
||||
|
||||
Exit code: 0 if all OK, 1 if any mismatch.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ADR_FILENAME_RE = re.compile(r"^ADR-(\d{4})-[a-z0-9_-]+\.md$")
|
||||
TITLE_RE = re.compile(r"^# ADR-(\d{4}):")
|
||||
|
||||
|
||||
def _normalize(text: str) -> str:
|
||||
return text.replace("\r\n", "\n").replace("\r", "\n")
|
||||
|
||||
|
||||
def find_adr_files(adr_dir: Path) -> dict[str, Path]:
|
||||
if not adr_dir.is_dir():
|
||||
return {}
|
||||
return {
|
||||
p.name: p
|
||||
for p in sorted(adr_dir.iterdir())
|
||||
if p.is_file() and ADR_FILENAME_RE.match(p.name)
|
||||
}
|
||||
|
||||
|
||||
def extract_title_id(text: str) -> str | None:
|
||||
lines = _normalize(text).splitlines()
|
||||
if not lines:
|
||||
return None
|
||||
m = TITLE_RE.match(lines[0])
|
||||
return m.group(1) if m else None
|
||||
|
||||
|
||||
def extract_status_block(text: str) -> str | None:
|
||||
"""Return content between `## Status` and the next `## ` heading, stripped.
|
||||
|
||||
Returns None if no `## Status` heading exists.
|
||||
"""
|
||||
lines = _normalize(text).splitlines()
|
||||
in_status = False
|
||||
collected: list[str] = []
|
||||
for line in lines:
|
||||
if line.strip() == "## Status":
|
||||
in_status = True
|
||||
continue
|
||||
if in_status and line.startswith("## "):
|
||||
break
|
||||
if in_status:
|
||||
collected.append(line)
|
||||
if not in_status:
|
||||
return None
|
||||
return "\n".join(collected).strip()
|
||||
|
||||
|
||||
def verify(root: Path) -> list[str]:
|
||||
errors: list[str] = []
|
||||
en_dir = root / "docs" / "adr"
|
||||
ko_dir = root / "docs" / "adr-ko"
|
||||
|
||||
en_files = find_adr_files(en_dir)
|
||||
ko_files = find_adr_files(ko_dir)
|
||||
|
||||
for name in en_files:
|
||||
if name not in ko_files:
|
||||
errors.append(f"missing KO translation: docs/adr-ko/{name}")
|
||||
for name in ko_files:
|
||||
if name not in en_files:
|
||||
errors.append(f"orphan KO (no canonical EN): docs/adr-ko/{name}")
|
||||
|
||||
for name in sorted(en_files.keys() & ko_files.keys()):
|
||||
m = ADR_FILENAME_RE.match(name)
|
||||
assert m is not None
|
||||
expected_id = m.group(1)
|
||||
|
||||
en_text = en_files[name].read_text(encoding="utf-8")
|
||||
ko_text = ko_files[name].read_text(encoding="utf-8")
|
||||
|
||||
en_id = extract_title_id(en_text)
|
||||
ko_id = extract_title_id(ko_text)
|
||||
if en_id != expected_id:
|
||||
errors.append(
|
||||
f"{name}: EN title ADR-ID {en_id!r} != filename {expected_id!r}"
|
||||
)
|
||||
if ko_id != expected_id:
|
||||
errors.append(
|
||||
f"{name}: KO title ADR-ID {ko_id!r} != filename {expected_id!r}"
|
||||
)
|
||||
|
||||
en_status = extract_status_block(en_text)
|
||||
ko_status = extract_status_block(ko_text)
|
||||
if en_status is None:
|
||||
errors.append(f"{name}: EN missing `## Status` section")
|
||||
if ko_status is None:
|
||||
errors.append(f"{name}: KO missing `## Status` section")
|
||||
if en_status is not None and ko_status is not None and en_status != ko_status:
|
||||
errors.append(
|
||||
f"{name}: Status block mismatch\n"
|
||||
f" EN: {en_status!r}\n"
|
||||
f" KO: {ko_status!r}"
|
||||
)
|
||||
|
||||
return errors
|
||||
|
||||
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
p = argparse.ArgumentParser(description=__doc__)
|
||||
p.add_argument(
|
||||
"--root",
|
||||
type=Path,
|
||||
default=Path.cwd(),
|
||||
help="Repository root (default: cwd)",
|
||||
)
|
||||
args = p.parse_args(argv)
|
||||
|
||||
errors = verify(args.root)
|
||||
if errors:
|
||||
print("ADR language pair verification FAILED:")
|
||||
for e in errors:
|
||||
print(f" - {e}")
|
||||
return 1
|
||||
print("ADR language pair verification OK")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user