feat(cli): adjudicate --apply interactive merge walk (#137, Slice 2b-ii)#165
Merged
Conversation
Give adjudicate a path to action: --apply walks the SAME verdicts and, per eligible group, previews what will fuse then prompts before merging. Final slice (2b-ii) of the #139->#137 arc; reuses the 2b-i prepare_merge/merge_core blocks verbatim (no change to merge/unmerge or the destructive core). - eligible = verdict SAME AND exactly 2 members; survivor = member_ids[0] (alphabetical-first), absorbed = member_ids[1] - N>2 SAME groups: skipped (N>2, merge manually) - per group: stale-id pre-check (_resolve_concept_path) -> prepare_merge preview -> prompt 'Merge <absorbed> into <survivor>? [y/N/skip]' (only y/yes applies; empty/n/skip/other decline) -> merge_core -> per-merge autocommit - stale-id guard: a member absorbed by an earlier merge this run is skipped (member already merged), never crashes - mid-run merge_core/prepare_merge failure stops the run (exit 1); prior per-merge commits remain and are unmerge-reversible - --apply + --json rejected (exit 2); --apply + --same-only is a no-op - end summary: applied X, skipped Y (N>2 / already-merged / declined) Additive: non---apply adjudicate (plain / --json / --same-only) byte-identical. Destructive but reversible via unmerge. Only SAME 2-member groups ever merge. Guarded batch (--apply-same, no confirm) remains deferred, gated on #138.
jasonssdev
added a commit
that referenced
this pull request
Jul 25, 2026
Merge the adjudicate --apply delta (12 requirements: interactive merge walk, eligibility, prompt semantics, stale-id guard, per-merge commit, mid-run failure, --apply/--json exclusivity, summary) into entity-resolution-adjudication (#139 + Slice-2a requirements preserved) and move the change folder to archive/. Implementation shipped in #165. #137 stays open for the deferred batch slice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the #139→#137 curation-output arc (Slice 2b-ii, final slice). Advances #137.
What
Gives
adjudicatea path to action:--applywalks theSAMEverdicts and, per eligible group, previews what will fuse then prompts before merging. Reuses the 2b-iprepare_merge/merge_coreblocks verbatim — the destructive core is untouched.Per eligible group: stale-id pre-check →
prepare_mergepreview →Merge <absorbed> into <survivor>? [y/N/skip]→merge_core→ per-merge autocommit.Guardrails (destructive, but reversible via
unmerge)verdict SAMEAND exactly 2 members. DIFFERENT/UNCERTAIN never merge. N>2 SAME groups →skipped (N>2, merge manually).member_ids[0](alphabetical-first), absorbed =member_ids[1].y/yesapplies; empty/n/skip/other decline.skipped (member already merged), never crashes.prepare_mergeormerge_core) stops the run (exit 1); prior per-merge commits remain and are unmerge-reversible.--apply+--jsonrejected (exit 2, before any read);--apply+--same-onlyis a no-op.applied X, skipped Y (N>2 / already-merged / declined).Scope
--applyadjudicate (plain /--json/--same-only) is byte-identical. Onlyadjudicate+ tests touched;merge/unmerge/prepare_merge/merge_coreunchanged (diff is +142/-0 inmain.py).--apply-same, no confirm), gated on bug: adjudicate reports a flat 0.95 confidence and marks part-whole pairs as SAME #138 verdict quality; N>2 merging; survivor heuristics beyond alphabetical.Verification
--applytests incl. accept→merge→ledger, unmerge round-trip, stale-id guard (overlapping groups), each prompt answer, mid-run failure (bothprepare_mergeandmerge_core),--apply --jsonrejection, summary counts.member_ids = tuple(sorted(...))), preview==apply (samepreparedobject), partial-failure recoverable, destructive core untouched. The one coverage WARNING (prepare_mergefailure branch) is now closed by an added test.