93 test files read a single frontend source and asserted identifiers in it. The
MapWorkspace split showed what that costs: 24 tests went red for a move that
changed no behaviour at all. A contract belongs to the feature — a container,
its hooks, its domain layer — not to whichever file currently holds it.
232 read sites now resolve through read_feature(). The distinction that makes
this safe is direction: a *positive* contract ("this is wired") may widen,
because the identifier must still exist somewhere in the feature; a *negative*
one ("this component performs no transport") is a statement about one file, and
widening it would quietly weaken the check. The 73 single-file reads that
remain are exactly those, and a guard now enforces the rule for new tests.
Verified rather than assumed: of the 732 migrated positive assertions, 644 still
match exactly one module — as specific as before — and the other 86 already
spanned a container and its hook by nature. Two apparent misses are an artefact
of the checking regex reading an escaped newline literally.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
81 lines
3.5 KiB
Python
81 lines
3.5 KiB
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from tests.frontend_contract import read_feature
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_export_center_exposes_final_handoff_surfaces() -> None:
|
|
export_center = read_feature("exports")
|
|
|
|
assert 'className="export-center"' in export_center
|
|
assert 'className="export-center-shell"' in export_center
|
|
assert 'className="export-summary-surface"' in export_center
|
|
assert 'aria-label="Export summary"' in export_center
|
|
assert 'className="export-handoff-surface"' in export_center
|
|
assert 'aria-label="Export handoff readiness"' in export_center
|
|
assert 'className="export-actions-surface"' in export_center
|
|
assert 'aria-label="Export artifact actions"' in export_center
|
|
assert 'className="export-state-stack"' in export_center
|
|
assert 'className="export-history-surface export-history-disclosure"' in export_center
|
|
assert 'aria-label="Export history"' in export_center
|
|
|
|
|
|
def test_provider_panel_exposes_final_system_surfaces() -> None:
|
|
provider_panel = (ROOT / "frontend" / "src" / "components" / "providers" / "ProviderPanel.tsx").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
|
|
assert 'className="system-provider-panel"' in provider_panel
|
|
assert 'className="system-provider-shell"' in provider_panel
|
|
assert 'className="system-provider-state-stack"' in provider_panel
|
|
assert 'className="system-provider-capability-surface"' in provider_panel
|
|
assert 'aria-label="Provider capability registry"' in provider_panel
|
|
assert 'className="provider-provenance-grid"' in provider_panel
|
|
assert 'className="provider-provenance-card"' in provider_panel
|
|
assert 'className="provider-detail-stack"' in provider_panel
|
|
|
|
|
|
def test_export_system_preserves_existing_workflow_controls() -> None:
|
|
export_center = read_feature("exports")
|
|
provider_panel = (ROOT / "frontend" / "src" / "components" / "providers" / "ProviderPanel.tsx").read_text(
|
|
encoding="utf-8"
|
|
)
|
|
|
|
assert "onExportDataset" in export_center
|
|
assert "onExportDetectionRun" in export_center
|
|
assert "onExportSegmentationRun" in export_center
|
|
assert "onExportProjectMetadata" in export_center
|
|
assert "onExportProjectReport" in export_center
|
|
assert "onPreviewContent" in export_center
|
|
assert "onDownload" in export_center
|
|
assert "exportTypeFilter" in export_center
|
|
assert "exportStatusFilter" in export_center
|
|
assert "exportSearchQuery" in export_center
|
|
assert "system-provider-list" in provider_panel
|
|
assert "system-provider-card" in provider_panel
|
|
assert "provider-layer-chip" in provider_panel
|
|
assert "provider.not_configured_reason" in provider_panel
|
|
|
|
|
|
def test_export_system_density_css_contracts() -> None:
|
|
css = (ROOT / "frontend" / "src" / "styles" / "app.css").read_text(encoding="utf-8")
|
|
|
|
assert ".export-center-shell" in css
|
|
assert ".export-summary-surface" in css
|
|
assert ".export-handoff-surface" in css
|
|
assert ".export-actions-surface" in css
|
|
assert ".export-state-stack" in css
|
|
assert ".export-history-surface" in css
|
|
assert ".export-center-shell .quality-summary-grid" in css
|
|
assert ".system-provider-shell" in css
|
|
assert ".system-provider-state-stack" in css
|
|
assert ".system-provider-capability-surface" in css
|
|
assert ".provider-detail-stack" in css
|
|
assert ".provider-provenance-grid" in css
|
|
assert ".provider-provenance-card" in css
|
|
assert "grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));" in css
|
|
assert "background: linear-gradient(180deg, #ffffff, #f7fbf8);" in css
|