Skip to content

Report analysis-invariant violations instead of silently repairing them #140

Description

@imnasnainaec

The model documents invariants ("at most one approved link per token") as the caller's responsibility with no runtime enforcement. The WebView silently repairs violations (e.g. findLast over multi-approved links, filtering dangling analysisIds), which masks corruption in production.

  • Add a validateTextAnalysis(analysis) pass (extend type-guards.ts) that reports: multiple approved links per target, links whose analysisId has no payload, payloads referenced by zero links, and invalid enum values (Confidence, AssignmentStatus are currently unchecked).
  • Run it on draft/project load and before save; log violations with counts (no user-facing noise), keeping the existing tolerant rendering behavior.
  • Route all approved-status mutations through the existing slice reducers (already effectively the case) and document that as the enforcement point.

Size: S

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions