{
  "batch": "Governance & Contracts",
  "batch_index": 3,
  "assessments": {
    "cross_module_architecture": 82.0,
    "test_strategy": 74.0
  },
  "dimension_notes": {
    "cross_module_architecture": {
      "evidence": [
        "`internal/quality/types.go` defines a typed status contract (`type Status string` with constants like `StatusOpen`, `StatusFixed`, `StatusWontfix`).",
        "`internal/quality/types.go` also defines `Scorecard.StatusByType map[string]int`, which bypasses the typed status contract at the module boundary.",
        "`internal/quality/scoring_test.go` asserts raw string keys (`\"open\"`, `\"fixed\"`) instead of using `Status` constants, reinforcing stringly-typed cross-component coupling.",
        "`README.md` claims quality features include tracking resolution states, but the in-code state transport for scorecards is weakly typed."
      ],
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor",
      "confidence": "high"
    },
    "test_strategy": {
      "evidence": [
        "`internal/quality/narrative_test.go` validates exact headline/action prose and directly tests internal helper behavior (e.g., `determinePhase`, `generateHeadline`, `classifyDimension`), creating high implementation-coupling.",
        "`internal/quality/scoring_test.go` similarly focuses on exact internal scoring details and string key literals, which makes refactors noisy and discourages safe design changes.",
        "`pkg/rustdocs/parser_test.go` is heavily happy-path: it checks successful parses and minimal field presence but has no malformed-input/error-path cases for parser resilience.",
        "`README.md` marks parts of the CLI as unstable/stubbed, but assigned tests do not provide cross-module contract/integration safety nets for those runtime boundaries."
      ],
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor",
      "confidence": "high"
    }
  },
  "findings": [
    {
      "dimension": "cross_module_architecture",
      "identifier": "status_contract_string_map_boundary",
      "summary": "Scorecard state uses string keys instead of shared Status type, weakening module contracts.",
      "related_files": [
        "internal/quality/types.go",
        "internal/quality/scoring_test.go",
        "README.md"
      ],
      "evidence": [
        "`internal/quality/types.go` defines `Status` constants but `Scorecard.StatusByType` is `map[string]int`.",
        "`internal/quality/scoring_test.go` asserts `card.StatusByType[\"open\"]` and `card.StatusByType[\"fixed\"]` directly.",
        "README promises resolution-state tracking, but this boundary is not type-safe."
      ],
      "suggestion": "Change `Scorecard.StatusByType` to `map[Status]int` (or a dedicated typed struct), update serialization adapters if needed, and update tests to assert using `StatusOpen`/`StatusFixed` constants.",
      "confidence": "high",
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "test_strategy",
      "identifier": "brittle_private_and_copy_assertions_in_quality_tests",
      "summary": "Quality tests are tightly coupled to private helpers and exact copy text, reducing refactor safety.",
      "related_files": [
        "internal/quality/narrative_test.go",
        "internal/quality/scoring_test.go"
      ],
      "evidence": [
        "`narrative_test.go` directly asserts exact strings for generated headlines/actions and tests helper internals rather than stable external behavior.",
        "`scoring_test.go` anchors on specific internal weighting outputs and literal status strings, which can fail on benign internal redesigns."
      ],
      "suggestion": "Shift to contract-level tests against exported APIs with invariant assertions (phase category, presence of required fields, monotonic score behavior), and keep only a small set of snapshot/copy tests for user-facing text.",
      "confidence": "high",
      "impact_scope": "module",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "test_strategy",
      "identifier": "rust_parser_missing_negative_and_boundary_cases",
      "summary": "Rust parser tests miss malformed-input and degradation-path coverage.",
      "related_files": [
        "pkg/rustdocs/parser_test.go",
        "README.md"
      ],
      "evidence": [
        "`parser_test.go` cases are successful parses with valid fixture HTML and only basic assertions.",
        "No tests verify behavior for malformed HTML, missing selectors, empty documents, or unsupported result rows.",
        "README positions docs ingestion as core functionality, so parser failure behavior is a critical path."
      ],
      "suggestion": "Add table-driven negative tests for malformed/partial HTML, empty search blocks, and missing headings; assert stable fallback behavior (explicit error or safe zero-value output) for each parser entrypoint.",
      "confidence": "high",
      "impact_scope": "module",
      "fix_scope": "single_edit"
    }
  ]
}