Skip to content

Commit e9890e1

Browse files
authored
Normalize modeled decision surface paths (#233)
* Normalize modeled decision surface paths * Refresh AGENTS mesh after decision route update * Require modeled surfaces to be explicit lists
1 parent 554ad39 commit e9890e1

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

docs/decisions/AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ docs thematic cleanup, also read `docs/guardrails/THEMATIC_DISTRICT_PROTOCOL.md`
2121
- Keep provenance, dates, and source relationships explicit.
2222
- Route current mechanic doctrine to `mechanics/<slug>/` packages when a package owns the material.
2323
- Route owner-local truth to the owner repository instead of expanding the center.
24+
- Keep `modeled_surfaces` in `docs/decisions/indexes/index_contract.yaml` as a top-level list of normalized repo-relative paths under `docs/decisions/`; do not use it for root non-record Markdown.
2425

2526
## Decision Review Gate
2627

docs/decisions/indexes/index_contract.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ generated_indexes:
1010
- docs/decisions/indexes/by-center-facet.md
1111
- docs/decisions/indexes/by-mechanic.md
1212
- docs/decisions/indexes/by-guard.md
13-
modeled_surfaces:
13+
modeled_surfaces: []
1414
fields:
1515
decision_id:
1616
required: true

generated/agents_mesh.min.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

scripts/docs_districts/decision_indexes.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,19 +395,24 @@ def modeled_decision_lane_surfaces(
395395
contract: dict[str, object],
396396
issues: list[tuple[str, str]],
397397
) -> set[str]:
398-
modeled = contract.get("modeled_surfaces", [])
398+
modeled = contract.get("modeled_surfaces")
399399
if modeled is None:
400+
issues.append((INDEX_CONTRACT_PATH.as_posix(), "modeled_surfaces must be a list of repo-relative docs/decisions paths"))
400401
return set()
401402
if not isinstance(modeled, list) or not all(isinstance(item, str) for item in modeled):
402403
issues.append((INDEX_CONTRACT_PATH.as_posix(), "modeled_surfaces must be a list of repo-relative docs/decisions paths"))
403404
return set()
404-
prefix = f"{DECISIONS_DIR.as_posix()}/"
405405
allowed: set[str] = set()
406406
for item in modeled:
407-
if not item.startswith(prefix):
407+
relative = Path(item)
408+
if relative.is_absolute() or ".." in relative.parts:
409+
issues.append((INDEX_CONTRACT_PATH.as_posix(), f"modeled_surfaces entry must be a normalized repo-relative path under {DECISIONS_DIR.as_posix()}: {item}"))
410+
continue
411+
try:
412+
relative.relative_to(DECISIONS_DIR)
413+
except ValueError:
408414
issues.append((INDEX_CONTRACT_PATH.as_posix(), f"modeled_surfaces entry must live under {DECISIONS_DIR.as_posix()}: {item}"))
409415
continue
410-
relative = Path(item)
411416
if relative.parent == DECISIONS_DIR and relative.suffix == ".md" and not FULL_ID_FILENAME_RE.match(relative.name):
412417
issues.append((INDEX_CONTRACT_PATH.as_posix(), f"modeled_surfaces must not include root non-record Markdown: {item}"))
413418
continue

0 commit comments

Comments
 (0)