Skip to content

Semantic merge check: a blind Jev score of each output-changing PR's semantic diff against main #1334

Closed

Description

@DrunkOnJava

Every PR that changes decoder output gets a semantic diff of its exports against main, scored blind by Jev (TypeSafe's judgment API). A change that moves meaning is then visible before the PR is armed, not only that bytes moved. Measure stays the byte-level oracle; this sits above it.

Decided (2026-11-04)

  • Advisory check. The verdict is a check run on the PR's head commit, with the verdict in its summary. It is not a required check, and nothing is posted as a PR comment. Agents fix a fail before arming, and answer a warn in the PR body. Merging still waits only on full / CI passed.
  • What Jev reads. Element-level diffs come only from openly licensed models: Core Interior, Einhoven, RE1 (MIT), the BIM4LCA office (CC BY-SA) and the Revit 2025 models (Apache-2.0). Autodesk's samples and the held-out, spent and BIMcollab models contribute counts only, and nothing of theirs is sent.

Design

  1. Extractor. The MCP server's semantic dump (MCP server: rvt-rs-mcp, a stateless stdio server over the decoded model (MCP 2026-07-28) #1324, Measure: score the MCP server's answers against the export and Revit's IFC #1327): every element's id, category, class, name, type, storey, phase where read, property sets, a geometry summary (body kind, bounding box, profile count, no vertices), trust markers and provenance (Provenance for every element: carrier, stream, record offset, class and release #1325 where available), plus the diagnostics. Measure runs it on both sides.
    • It is deterministic: sorted output, floats at fixed precision, no timestamps.
    • It is the same layer as the MCP answers, not a new copy.
  2. Normalizer (tools/re/semantic_diff.py). It reads two dumps and writes one diff:
    • elements added, removed and changed, with before and after values;
    • offsets that shift for unrelated reasons are dropped;
    • identical bulk changes are collapsed into one line ("400 walls: +property X");
    • per-category totals are included.
      It writes the human-readable summary itself. It is a pure function of two JSON files, so a few fast tests of its failure modes are allowed (pure-helper exception): a cosmetic-looking change that is semantic (0.35 vs 0.3500001 ft), a reorder with no change, and a bulk collapse that hides a different value.
  3. Scoring. Jev answers yes/no, choice and rating questions with probabilities, and reads at most 16,000 characters per question.
    • The diff is scored per chunk, by category or by finding, with neutral framing: "two decoders, labels A and B, randomised per run; is the meaning different, and how much would an importer notice?"
    • The check's score is aggregated from the chunks' probabilities. Jev's findings are the normalizer's lines, each with Jev's probability attached.
    • Model jev-1.13.0 is pinned, as the PR queue pins it.
  4. CI.
    • The job that runs PR code (Measure's export) holds no secret.
    • A separate job, triggered by workflow_run on Measure's completion or as a later job that only downloads the dump artifacts, calls Jev with TYPESAFE_API_KEY and writes the check run on the PR head.
    • Fork PRs get no secret, and the check reports NOT MEASURED.
    • Dumps are cached by content hash, with the same exclusions as the score cache (no held-out, spent or BIMcollab outputs).
  5. Cost. Jev is billed at $0.042 per million input tokens. A diff of a few hundred kilobytes costs well under a cent. The monthly credit running out (HTTP 402) reports NOT MEASURED, never a pass.

Calibration

Score the recent output-changing PRs retroactively: #1314 (wall corners), #1316 (2015–2023 Areas), #1328 (rooms outside the export phase), and #1329 (byte-identical, so it should score as equivalent). Measure the false-positive rate before relying on the check.

Done when

  • The check runs on an output-changing PR from a Measure run with base=main.
  • It scores the calibration set as expected.
  • Its inputs never include a held-out, spent, BIMcollab or Autodesk sample element.

Depends on #1324 (the server) and #1331 (the shared export pipeline). Refs #1327.

Activity

  1. added
    area:ci
    priority:P2
    type:feature
    on Nov 4, 2026
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

    area:cipriority:P2type:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions