Skip to content

Preserve token-union proposals in Go #900

Open

Description

@tbhb-agent

Problem

The classifier at packages/agents/source/skills/resolve-rebase-conflicts/shared/scripts/conflict_shape.py:140 uses line alignment to find one-line replacements extended with tokens on both sides. Its output is a proposal, not a mechanical resolution. A generic diff algorithm can align repeated lines differently and offer a different proposal.

Part of #588 and #326.

Acceptance criteria

  1. AC1: Given both sides extend an aligned single ancestor line without removing its tokens, when proposal analysis runs, then it identifies the same eligible lines as the frozen classifier.
  2. AC2: Given multiline replacements, ancestor-token deletion, absent versions or identical side token sequences, when proposal analysis runs, then it offers no proposal for those cases.
  3. AC3: Given an eligible line, when its proposal is printed, then ancestor tokens precede new base-side and replayed-side tokens in the frozen order.
  4. AC4: Given indentation, duplicate tokens or byte whitespace, when its proposal is printed, then formatting matches the frozen output.
  5. AC5: Given repeated lines and long repeated sequences, when proposal analysis runs, then alignment and line numbering match the frozen classifier.
  6. AC6: Given a proposal, when it is reported, then it explicitly leaves ordering to the operator.
  7. AC7: Non-functional: proposal analysis never edits or stages a resolution.
  8. AC8: Non-functional: native proposal cases execute without skips on macOS, Linux and Windows.

Scope and non-goals

Scope: token eligibility, line alignment and proposal rendering.

Non-goal: automatic application, operator confirmation machinery, a new diff library, or changes to sorted-union eligibility. Keep shell and coupled Python frozen through N-2, with no new shell logic. Do not switch callers or retire tests in this child.

Approach

Port the observable alignment semantics of the existing Python SequenceMatcher call, including its repeated-line heuristic, rather than substituting Git diff. Render the evidence at packages/agents/source/skills/resolve-rebase-conflicts/shared/scripts/conflict_shape.py:204. The vendored matcher at vendor/github.com/stretchr/testify/internal/difflib/difflib.go:83 is internal to its dependency and is not an importable production API. Budget any local matcher code or newly vendored source in full; do not exclude it from the size. Keep this bounded to the alignment needed for proposals.

Dependencies

Blocked by: #899 (for shared stage interpretation), #753 (before registration).

Size

M. Forecast 720 code lines: 330 alignment/proposal implementation, 350 tests and fixtures, 40 integration. Baseline: the token sections of the 212-code-line helper at packages/agents/source/skills/resolve-rebase-conflicts/shared/scripts/conflict_shape.py:140. Prose allowance: 180 lines.

scc could not run in the isolated checkout. Measured baselines count non-blank lines other than full-line # comments, including Python docstrings and embedded code conservatively. Forecasts include implementation, tests, fixtures and registration; they are estimates, not measured future Go. Generated output is excluded only under packages/agents/claude/.apm/skills/, packages/agents/codex/.apm/skills/, .claude/skills/, .agents/skills/ and tokens.json. The source under packages/agents/source/ and copies anywhere else count. The final diff must be at most 800 code lines and 2,000 prose lines, with no exception; split before implementation if either forecast grows beyond its limit.

Verify plan

  • AC1, AC2, AC3, AC4: compare exact proposals against the frozen helper for eligible and ineligible replacements, token order, indentation and byte whitespace.
  • AC5: fixtures cover repeated lines and sequences on either side of the repeated-line heuristic boundary, with expected aligned line numbers.
  • AC6, AC7: assert the ordering instruction is present and repository/index snapshots are unchanged.
  • AC8: inspect native CI results for all promised platforms.
  • Definition of done: D1 each AC is verified at the merged head, with the commands and results cited in the pull request's Verification. D2 an independent review approves the exact merged head, and every finding has a recorded disposition. D3 required checks pass with no gate loosened. D4 the leak scans the repository specifies are clean, and every post made for this work passes the per-post leak review before it is posted. D5 every commit is signed. D6 the documentation matches the change or the Verification says why there is no impact. D7 every commit has an Assisted-by trailer and the pull request has the provenance:agent-assisted label. D8 the pull request stays within the size limits. D9 follow-ups are filed as issues and listed under Related. D10 the merge closes the issue through a closing reference, the board shows Done, and the final Status: comment names the merge commit.

Risks

Different alignment may suggest the wrong combined line. Copying an entire diff dependency can exceed the limit; split alignment into a prerequisite child before coding if the forecast does not fit. Undo: revert this unused Go implementation.

Operator authority

A choice the operator reserved: token ordering remains a runtime operator decision, as packages/agents/source/skills/resolve-rebase-conflicts/shared/scripts/conflict_shape.py:215 requires; this port grants no automatic application authority.

Activity

  1. tbhb-agent commented on Oct 27, 2026

    @tbhb-agent
    ContributorAuthor

    Refinement: READY — Preserve token-union proposals in Go
    Model: gpt-6-astra

    Child 06 Preserve token-union proposals in Go

    Verdict: READY

    Checked: Child 05’s clarification leaves stage interpretation, token alignment and proposal rendering unchanged. The 720-line inclusive forecast and mandatory split if matcher scope exceeds the limit remain explicit.

    Gaps: None.

    Split: None required on current evidence.

    Definition of done

    The definition of done for this issue (Feature). Tick each item and give its evidence.

    • D1 The author verified each AC on the merged head, and the Verification section of the pull request cites each AC ID with its evidence: the command and its result, or a link.
    • D2 An independent reviewer approved the exact merged head, and the author resolved each finding or filed it as a follow-up.
    • D3 The required checks pass on that head, and any loosened gate has the owner's approval of that exact head.
    • D4 The leak scans come back clean: gitleaks, devtools' check-leaks.sh with the repository's private-strings list, and the leak review of each post.
    • D5 The author signed each commit, the squash included.
    • D6 The docs match the change (README, docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.
    • D7 The commits and the squash have Assisted-by trailers, and the pull request has the provenance:agent-assisted label.
    • D8 The pull request stays within the size limits, or the owner approved its exact head over the hard limit.
    • D9 The author files follow-ups and deferred findings as issues with at least a Problem and numbered AC and lists them under the Related section of the pull request. Any work left in the code links its issue.
    • D10 The merge closes the issue through a closing reference and the board shows Done. The final Status: comment names the merge commit.
    • devtools-1 mise run check is green, and so are the coverage floors mise run cover-go-check and mise run cover-py-check, which check doesn't run.
    • devtools-2 A change to skill sources under packages/agents/source/ commits what mise run generate-skills, then mise run skill-tokens, then apm install rewrite, in that order, and check-generated-skills (part of lint) passes.
    • devtools-3 A consumer-visible change (the vendored payload, a skill, a reusable workflow, a task or a pin) has its consumer steps in docs/agent-skills-migration.md or the adoption docs, or the PR's Verification says "No consumer impact" and why.

    Round: 2 of 3

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

    refinement:readyPassed the Definition of Ready; may be picked up

    Fields

    Priority

    None yet

    Work type

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions