687c98086d
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>
108 lines
3.7 KiB
Python
108 lines
3.7 KiB
Python
"""Tests for tools/verify_adr_lang_pairs.py."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(_REPO_ROOT / "tools"))
|
|
|
|
import verify_adr_lang_pairs as v # noqa: E402
|
|
|
|
|
|
def _make_adr(
|
|
path: Path,
|
|
title_id: str,
|
|
title_text: str = "Some Title",
|
|
status: str = "Accepted",
|
|
) -> None:
|
|
path.parent.mkdir(parents=True, exist_ok=True)
|
|
path.write_text(
|
|
f"# ADR-{title_id}: {title_text}\n\n"
|
|
f"## Status\n\n{status}\n\n"
|
|
f"## Context\n\nbody\n",
|
|
encoding="utf-8",
|
|
)
|
|
|
|
|
|
def test_complete_pairs_pass(tmp_path: Path) -> None:
|
|
_make_adr(tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0001", "Foo EN")
|
|
_make_adr(tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md", "0001", "Foo KO")
|
|
assert v.verify(tmp_path) == []
|
|
|
|
|
|
def test_empty_dirs_pass(tmp_path: Path) -> None:
|
|
assert v.verify(tmp_path) == []
|
|
|
|
|
|
def test_missing_ko_fails(tmp_path: Path) -> None:
|
|
_make_adr(tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0001")
|
|
errs = v.verify(tmp_path)
|
|
assert any("missing KO" in e and "ADR-0001-foo-bar.md" in e for e in errs)
|
|
|
|
|
|
def test_orphan_ko_fails(tmp_path: Path) -> None:
|
|
_make_adr(tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md", "0001")
|
|
errs = v.verify(tmp_path)
|
|
assert any("orphan KO" in e and "ADR-0001-foo-bar.md" in e for e in errs)
|
|
|
|
|
|
def test_status_mismatch_fails(tmp_path: Path) -> None:
|
|
_make_adr(tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0001", status="Accepted")
|
|
_make_adr(tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md", "0001", status="Proposed")
|
|
errs = v.verify(tmp_path)
|
|
assert any("Status block mismatch" in e for e in errs)
|
|
|
|
|
|
def test_title_id_mismatch_fails(tmp_path: Path) -> None:
|
|
_make_adr(tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0002")
|
|
_make_adr(tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md", "0001")
|
|
errs = v.verify(tmp_path)
|
|
assert any("EN title ADR-ID" in e for e in errs)
|
|
|
|
|
|
def test_multiline_status_with_parenthetical_passes(tmp_path: Path) -> None:
|
|
"""Real ADRs like ADR-0001 have multi-line Status with revision notes."""
|
|
multiline_status = (
|
|
"Accepted (Revision 2 - 2026-04-27: concrete bit layout,\n"
|
|
"Supersedes ADR-0031.)"
|
|
)
|
|
_make_adr(
|
|
tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0001", status=multiline_status
|
|
)
|
|
_make_adr(
|
|
tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md", "0001", status=multiline_status
|
|
)
|
|
assert v.verify(tmp_path) == []
|
|
|
|
|
|
def test_crlf_normalization(tmp_path: Path) -> None:
|
|
"""KO has CRLF, EN has LF; Status content is otherwise identical -> pass."""
|
|
en = tmp_path / "docs/adr/ADR-0001-foo-bar.md"
|
|
ko = tmp_path / "docs/adr-ko/ADR-0001-foo-bar.md"
|
|
en.parent.mkdir(parents=True, exist_ok=True)
|
|
ko.parent.mkdir(parents=True, exist_ok=True)
|
|
en.write_bytes(
|
|
b"# ADR-0001: Foo\n\n## Status\n\nAccepted\n\n## Context\n\nbody\n"
|
|
)
|
|
ko.write_bytes(
|
|
b"# ADR-0001: Foo\r\n\r\n## Status\r\n\r\nAccepted\r\n\r\n## Context\r\n\r\nbody\r\n"
|
|
)
|
|
assert v.verify(tmp_path) == []
|
|
|
|
|
|
def test_underscore_in_slug_recognized(tmp_path: Path) -> None:
|
|
"""ADR-0013 uses an underscore in its slug; the regex must accept it."""
|
|
_make_adr(tmp_path / "docs/adr/ADR-0013-ver-verification_strategy.md", "0013")
|
|
_make_adr(tmp_path / "docs/adr-ko/ADR-0013-ver-verification_strategy.md", "0013")
|
|
assert v.verify(tmp_path) == []
|
|
|
|
|
|
def test_main_exit_codes(tmp_path: Path, capsys) -> None:
|
|
assert v.main(["--root", str(tmp_path)]) == 0
|
|
_make_adr(tmp_path / "docs/adr/ADR-0001-foo-bar.md", "0001")
|
|
assert v.main(["--root", str(tmp_path)]) == 1
|
|
out = capsys.readouterr().out
|
|
assert "FAILED" in out
|