Skip to content

feat(cli): adjudicate --json for machine-readable verdicts (#137, Slice 2a)#161

Merged
jasonssdev merged 1 commit into
mainfrom
feat/adjudicate-json
Jul 24, 2026
Merged

feat(cli): adjudicate --json for machine-readable verdicts (#137, Slice 2a)#161
jasonssdev merged 1 commit into
mainfrom
feat/adjudicate-json

Conversation

@jasonssdev

Copy link
Copy Markdown
Owner

Part of the #139#137 curation-output arc (Slice 2a). Advances #137.

What

Gives adjudicate a non-destructive path to action: a --json flag emits the verdicts as a pretty-printed JSON array on stdout, so a user or wrapper can pipe SAME pairs into openkos merge. This establishes the project's first --json convention.

Schema (one object per group):

[{ "member_ids": ["a", "b"], "okf_type": "person", "tier": "HIGH", "verdict": "SAME", "rationale": "..." }]

Locked convention decisions (precedent-setting)

  • confidence omitted — consistent with bug: adjudicate reports a flat 0.95 confidence and marks part-whole pairs as SAME #138 (uncalibrated flat value; a JSON number revives misleading precision).
  • No survivor/absorbed field — no heuristic exists; the consumer decides which id survives (merge is pairwise; HIGH groups can have >2 members).
  • --same-only composes: all verdicts by default; --json --same-only filters to SAME.
  • Empty → [] (valid JSON), never the plain-text no-candidates message.
  • Pretty indent=2, deterministic results order.
  • Short-circuits after the Ollama error handlers → a degraded run still exits 1 on stderr with no JSON.

Scope

Verification

  • Full suite: 2002 passed; ruff/format/mypy clean.
  • Strict TDD, +9 tests (payload builder, --json wiring, --same-only composability, empty→[] on both guards, error-path emits no JSON).
  • Independent verify: PASS (0 critical). Bounded reliability review: 1 WARNING (a docstring that wrongly claimed --same-only was ignored) — fixed in this branch; serializability, error-path isolation, and enum rendering (tier.name uppercase) all confirmed clean.

Diff: main.py +52/-2, tests +311.

Give adjudicate a non-destructive path to action: a --json flag emits the
verdicts as a pretty-printed JSON array on stdout, so a user or wrapper can
pipe SAME pairs into openkos merge. Establishes the project's first --json
convention (Slice 2a of the #139->#137 arc).

- pure builder _adjudication_payload(results, *, same_only) -> list[dict]
- schema per group: member_ids, okf_type, tier (HIGH/LOW via .name), verdict
  (SAME/DIFFERENT/UNCERTAIN), rationale
- confidence omitted (consistent with #138: uncalibrated, misleading precision)
- no survivor/absorbed field (no heuristic exists; the consumer decides)
- emits all verdicts by default; --same-only filters the array to SAME
- empty results -> [] (valid JSON), never the plain-text no-candidates message
- short-circuits after the Ollama error handlers, before all human output, so
  a degraded run still exits 1 on stderr with no JSON

Additive flag only: the non-json human path (incl. #139 tally/legend/Next) is
byte-identical. No verdict/merge/ledger changes. Interactive/batch apply are
deferred to later slices (batch gated on #138 verdict quality).
@jasonssdev
jasonssdev merged commit e751601 into main Jul 24, 2026
6 checks passed
@jasonssdev
jasonssdev deleted the feat/adjudicate-json branch July 24, 2026 23:04
jasonssdev added a commit that referenced this pull request Jul 24, 2026
Merge the adjudicate --json delta into the entity-resolution-adjudication spec
(7 new requirements: schema, human-output suppression, --same-only composability,
empty->[], deterministic pretty-print, error-path isolation, non-json byte-parity;
#139 requirements preserved) and move the change folder to archive/. Implementation
shipped in #161. #137 stays open for future apply slices.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant