fix: a changed functional requirement is reached through its components

The change-case check asked for a changed Check whose source is the changed
requirement. A functional requirement is carried by the components that
serve it, so it is reached through a Check on an Element realising one.

Plans record the first Change request with real models: a retention change
made in 18 minutes for a third of its Baseline's tokens, touching seven
Checks on one Element and nothing else, and the regression runs of cases
02, 03 and 04, all at 100%. Iteration 7 is complete.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-09 13:50:18 +01:00
parent 5ef434d00e
commit 59a641fded
6 changed files with 89 additions and 11 deletions

View File

@@ -476,6 +476,12 @@ def score_change(
old_sources = {
item.get("id"): item.get("source") for item in _graph_data(baseline)["checks"]
}
serving: dict[str, set[str]] = {}
for component in read_list(
deliverables, "technical_decomposition", COMPONENTS_FILE
):
for requirement in component.get("requirements") or ():
serving.setdefault(str(requirement), set()).add(str(component.get("id")))
unreached = []
for item in requirements:
identifier = item["id"]
@@ -484,8 +490,20 @@ def score_change(
reaches = any(old_sources.get(c) == identifier for c in removed_checks)
reaches = reaches or identifier not in old_sources.values()
else:
# A constraint is the source of its Checks. A functional requirement is
# carried by the components that serve it, so it is reached through a
# Check on an Element that realises one of them.
realising = {
element.get("id")
for element in graph["elements"]
if element.get("component") in serving.get(identifier, ())
}
reaches = any(
check.get("id") in touched and check.get("source") == identifier
check.get("id") in touched
and (
check.get("source") == identifier
or check.get("applies_to") in realising
)
for check in graph["checks"]
)
if not reaches: