feat: keep an unchanged description, list conditions, review coverage with Jev

After case 02 (completed at 100%, but with two Revisions of the Target
architecture for gaps validation found one pass at a time):

- A Deliverable stands while what it was written from is unchanged. The
  architecture description is written from the Elements and Relationships,
  so a Revision that only adds or rewords Checks no longer runs the describer.
- Non-functional requirements and recommendations list their conditions,
  one entry per separate thing that must be true; submission requires them.
- A coverage review at submission (JEV_COVERAGE_REVIEW, off by default):
  for each condition, Jev chooses which Check verifies it, or none. Asked as
  one broad yes-or-no per requirement it could not tell a complete design
  from one with known gaps; asked as a choice per condition it raised all
  four known gaps of case 02 and nothing on the complete graph. An opt-in
  live test (LIVE_JEV=1) repeats that.
- The validator is told to report every gap in its first pass.

Plans record the case 02 run and both forms of the review with figures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 20:58:38 +01:00
parent f1f6f1b83a
commit 5adc911a82
29 changed files with 1687 additions and 16 deletions

View File

@@ -7,7 +7,8 @@ outcome.
from __future__ import annotations
from collections.abc import Mapping, MutableMapping, Sequence
import logging
from collections.abc import Awaitable, Callable, Mapping, MutableMapping, Sequence
from typing import Any
from app.adk.runtime import (
@@ -46,6 +47,7 @@ from app.workflows.target_architecture import (
)
ORCHESTRATOR = "orchestrator"
logger = logging.getLogger(__name__)
_TARGET = DeliverableKind.TARGET_ARCHITECTURE
CLOUD_READ = "cloud_read"
@@ -259,6 +261,7 @@ def specialist_tools(
upstream: Mapping[str, Mapping[str, Any]] | None = None,
working: MutableMapping[str, Any] | None = None,
library: Mapping[str, Mapping[str, Any]] | None = None,
review: Callable[[Mapping[str, str]], Awaitable[Sequence[str]]] | None = None,
) -> list[ToolSpec]:
"""A Specialist's tools: submit, ask, its working copy, and its role's tools with
the cloud-read gate.
@@ -267,10 +270,13 @@ def specialist_tools(
along the Requirements chain are checked. `working` is the Deliverable's working
memory, where its working copy is kept. `library` is the earlier Deliverables
given to the Specialist as data files alone, to read whole when it needs one.
`review` looks at the meaning of a structurally complete submission; what it
raises is returned to the Specialist once per run, and never a second time.
"""
working = {} if working is None else working
is_graph = kind is DeliverableKind.TARGET_ARCHITECTURE
own_files = DEPENDENCY_GRAPH[kind].working_copy is kind
reviewed = False
async def submit_deliverable(content: str, attachments: Any = None) -> ToolResult:
try:
@@ -295,11 +301,28 @@ def specialist_tools(
)
if own_files:
working_files(working).update(attachments)
if is_graph:
keep_graph(working, attachments[GRAPH_ATTACHMENT])
nonlocal reviewed
if review and not reviewed:
reviewed = True
try:
concerns = await review(attachments)
except Exception: # a review must never stop a submission
logger.exception("The submission review failed; accepting")
concerns = ()
if concerns:
return ToolResult(
"Not submitted. A review found: "
+ "; ".join(concerns)
+ ". Look at each one: add what is missing, or leave it when "
"it is already covered. This review runs once, so your next "
"submission is accepted."
)
if is_graph:
# The tables and the diagram are views of the graph, so the engine
# writes them: they cannot disagree with it.
graph = parse_graph(attachments[GRAPH_ATTACHMENT])
keep_graph(working, attachments[GRAPH_ATTACHMENT])
content = content.rstrip() + "\n\n" + render_tables(graph)
attachments[DIAGRAM_ATTACHMENT] = render_mermaid(graph)
return ToolResult(f"Submitted {kind}.", Submitted(content, attachments))