You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove the Architecture surface's pre-snapshot file_tree fallback and the fabricated line/complexity metrics, so Architecture behaves like every other consumer: it returns a sealed-snapshot payload or an explicit missing_snapshot state. No analytical number may be displayed without a snapshot fact or an explicit, named heuristic with truth class.
Rationale
The 2026-07-27 PARTHA audit (§7, CQ-H1) found the flagship Architecture surface violates the product's core "evidence before confidence" contract:
apps/backend/app/analysis/architecture.py:133 publishes estimated_lines = max(len(module.files) * 80, 20) — invented from file count, not measured code.
apps/backend/app/analysis/architecture.py:185 falls back to _persisted_file_paths(record.file_tree) when no snapshot exists, producing modules/nodes/layers from a parallel representation instead of the canonical ri.v1 engine.
This directly contradicts the roadmap's honesty doctrine and the merge gate (no fabricated/placeholder data on any surface). It also creates a canonical-source bypass flagged in the audit's Repository Intelligence reuse assessment (score 6/10). Fixing it is a P0 because it is the most reputationally damaging gap — it makes users trust numbers that do not exist.
References
Audit §7 "Repository Intelligence Engine reuse assessment" and §16 P0 remediation row "Remove pre-snapshot Architecture facts and invented metrics".
Evidence (current dev @ 7d03f4f): apps/backend/app/analysis/architecture.py:71,75,118,133,140,147,181,185.
AGENTS.md: "Authentic data only — never mock, dummy, or placeholder data."
Implementation Notes
Delete estimated_lines / file-count "complexity" computation in _nodes_for_modules (architecture.py:118-140); if the schema must retain the fields, set them to an explicit measurement_state (e.g. not_computed) — never a synthesized value.
Remove the record.file_tree fallback in _modules_from_facts (architecture.py:181-185); when no sealed snapshot is present, return the same missing_snapshot contract the dependencies/review/insights consumers use (see SnapshotQueryService absent-snapshot path).
Keep ArchNode schema fields but mark them not_computed when unsupported; do not drop fields that break the OpenAPI contract without a coordinated schema-version note.
Non-goal: do not add new metrics here. Real metrics come only from sealed snapshot facts or a later, explicitly-modeled heuristic with formula + truth class.
Acceptance Criteria
Architecture returns an explicit missing_snapshot (or equivalent 4xx/empty-with-state) when no sealed ri.v1 snapshot exists — no 200 fallback graph.
No Architecture payload can contain a numerical estimated_lines/complexity value not backed by a snapshot fact or a named heuristic with truth class.
A new contract test fails if any consumer reads RepositoryRecord.file_tree or repo_metadata for analytical output (extends audit §7 required guard).
Existing frontend tests (productSurfaces.test.tsx, accessibility.test.tsx) still pass; the missing-snapshot state renders via the established honest-limit UI pattern.
npm run build:frontend and backend pytest pass; test_openapi_contract.py unchanged or updated with a coordinated note.
Task
Remove the Architecture surface's pre-snapshot
file_treefallback and the fabricated line/complexity metrics, so Architecture behaves like every other consumer: it returns a sealed-snapshot payload or an explicitmissing_snapshotstate. No analytical number may be displayed without a snapshot fact or an explicit, named heuristic with truth class.Rationale
The 2026-07-27 PARTHA audit (§7, CQ-H1) found the flagship Architecture surface violates the product's core "evidence before confidence" contract:
apps/backend/app/analysis/architecture.py:133publishesestimated_lines = max(len(module.files) * 80, 20)— invented from file count, not measured code.apps/backend/app/analysis/architecture.py:185falls back to_persisted_file_paths(record.file_tree)when no snapshot exists, producing modules/nodes/layers from a parallel representation instead of the canonicalri.v1engine.This directly contradicts the roadmap's honesty doctrine and the merge gate (no fabricated/placeholder data on any surface). It also creates a canonical-source bypass flagged in the audit's Repository Intelligence reuse assessment (score 6/10). Fixing it is a P0 because it is the most reputationally damaging gap — it makes users trust numbers that do not exist.
References
dev@ 7d03f4f):apps/backend/app/analysis/architecture.py:71,75,118,133,140,147,181,185.Implementation Notes
estimated_lines/ file-count "complexity" computation in_nodes_for_modules(architecture.py:118-140); if the schema must retain the fields, set them to an explicitmeasurement_state(e.g.not_computed) — never a synthesized value.record.file_treefallback in_modules_from_facts(architecture.py:181-185); when no sealed snapshot is present, return the samemissing_snapshotcontract the dependencies/review/insights consumers use (seeSnapshotQueryServiceabsent-snapshot path).ArchitecturePagealready hasnot_assessed/PreviewBannerpatterns (see bug: AI Workspace is inert without a provider and admits it reads legacy context, contradicting the sealed-snapshot model #177/bug: backend validation errors are collapsed to a generic "Request validation failed" in the UI #180 work) — reuse them for the missing-snapshot state instead of rendering a fallback graph.ArchNodeschema fields but mark themnot_computedwhen unsupported; do not drop fields that break the OpenAPI contract without a coordinated schema-version note.Acceptance Criteria
missing_snapshot(or equivalent 4xx/empty-with-state) when no sealedri.v1snapshot exists — no 200 fallback graph.estimated_lines/complexity value not backed by a snapshot fact or a named heuristic with truth class.RepositoryRecord.file_treeorrepo_metadatafor analytical output (extends audit §7 required guard).productSurfaces.test.tsx,accessibility.test.tsx) still pass; the missing-snapshot state renders via the established honest-limit UI pattern.npm run build:frontendand backend pytest pass;test_openapi_contract.pyunchanged or updated with a coordinated note.Priority
P0 - Critical