Skip to content

docs: deterministic external-analyzer quality output and per-gap function attribution #497

Backlog

Description

@jflowers

Gaze's external-analyzer quality output changed in a user-facing way (unbound-force/gaze#448): gap ordering is now deterministic across runs, and gap rows name the function that owns each gap. The website's Gaze documentation should mirror the updated reference docs so consumers of reading-stone, snake-eyes, and other test_mapping-capable analyzers see the current behavior.

What changed

Two defects in external-analyzer quality reports are fixed for tests whose mappings reference more than one target function (observed on zero-dot-force/reading-stone, where three runs of gaze report --analyzer --format=markdown produced two different gap orders):

  • Deterministic gap order. Identical analyzer responses now produce byte-identical JSON, text, HTML, and gaze report --analyzer --format=markdown output. Gaps are grouped by owning target in (package, function) order, each target's effects kept in analysis-result order; report-level ties (same-named tests in different files, equal contract-coverage percentages) break by test function, then test location. Previously the unioned effect list was assembled from Go map iteration, so gap order randomized run to run.
  • Per-gap function attribution. A single test's mappings can reference several target functions, and its gaps belong to different functions. Gap rows now name the owning function per gap — text gap lines carry an [owner] prefix, HTML gap items carry an owner prefix, and the markdown coverage-gaps table's Target column names the owner — instead of labeling every gap with the report's first mapped target. When attribution is absent (Go-native path, malformed payloads), output falls back to the report-level target label.
  • New schema field. The quality JSON schema gains an optional gap_targets array (FunctionTarget[], index-parallel to gaps), populated only on the external-analyzer path, carrying each gap's owning function.

Why it matters

  • Deterministic output makes quality reports diffable. CI jobs, golden-file comparisons, and scripted consumers can compare output byte-for-byte instead of working around ordering noise.
  • Correct attribution makes gaps actionable. A reader sees which function each unasserted effect belongs to, instead of a label inherited from an unrelated target.
  • Go-native output is unchanged (byte-identical rendering), so existing Go-based examples and walkthroughs remain accurate.

Pages that need updating

  • content/docs/projects/gaze.md — mirror the "External Analyzer Mode" section from gaze's docs/reference/cli/quality.md into the Test Quality / External Analyzers coverage: per-gap attribution in text, HTML, JSON, and markdown output; the fallback to the report-level target label; and the deterministic-output guarantee with the canonical gap order. Record the optional gap_targets field in the page's JSON-output area (where the language / language_version changes are documented), mirroring the gap_targets row and example in gaze's docs/reference/json-schemas.md.
  • content/docs/zero-dot-force/_index.md (optional) — describes reading-stone, where the nondeterminism was observed. The page documents no output format, so no update is required; mention the determinism guarantee only if it fits the page's scope.

Not affected: content/blog/gaze-in-practice.md (Go-native walkthrough; Go-native output renders byte-identical to before) and content/docs/getting-started/quality-gates.md (conceptual, no output-format detail).

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions