Skip to content

refactor(planning): simplify session.py part 2 of 4 without behavior change - #15251

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14678-42949564762-1
Nov 11, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14678-42949564762-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14678

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified the Session methods that start in range 2 of 4 of plugins/planning/shared/session.py (lines 1719-3437 of the 6874-line file: act_on_join through _locked_card), with no behavior change. Changes: answer and pick share one new _place_card helper for their identical card-placement tail; _merge's three copies of the 'src gives way to dst' voter loop share one local merged() helper; cancel_round and reset_round share a new _reopen_round; _drop_card no longer removes votes by hand right before _unback, which already removes them; _reference handles diagram and image captions in one place; heartbeat's empty pass branch and set_role's two notify calls are folded. Every new helper sits inside range 2, so no function outside the range changed.

Not verified

  • The planning plugin's Python test suites (plugins/planning/shared/tests) were not run: this lane cannot start an interpreter. Left to the PR's CI.
  • ruff/pyflakes was not run directly (no interpreter allowed here); the review subagent read the changed code for unused and undefined names and found none. Left to the PR's CI lint.
  • ci-status green is a PR CI check; left to the PR's CI.
  • tidy: passes 1-3 ran with no edit. Proposal not applied: delete the # drops its votes too comment at session.py:2900, which restates _unback's docstring; no COMMENT-ONLY proof could be made because that needs a scratch copy of a 378 KB file. Passes 4-5 (markdown) skipped because the issue fixes…

Fix

  • plugins/planning/shared/session.py: in range 2 only, added the _place_card and _reopen_round helpers and a local merged() in _merge; removed duplicate vote removal from _drop_card; folded branches in heartbeat, set_role and _reference (48 lines added, 71 removed)
  • .changes/planning/work-resolve-issue-issue-14678-42949564762-1-5c1a5965.md: new patch fragment, body ### Changed / - Internal simplification, no behavior change.

Verification

The runner ran each check from the base copy against c89e099:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 24 fragments valid (run before and after tidy)
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy)
  • check-affected: 13 passed, 6 skipped, rest CI-only, over 2 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff: no behavior change found in any hunk; it checked return values, which error fires first, dict key order and mutation order, found no test that patches a changed method, and found no unused or undefined name; its one caveat (the suggestionVotes `if…
  • range bound: 6874 lines / 4 gives range 2 = lines 1719-3437; every edited function (heartbeat 1866, set_role 1987, _merge 2191, cancel_round/reset_round 2429/2437, _reference 2484, _drop_card 2913, answer 3005, pick 3072) starts in it, and the new _place_card and _reopen_round sit inside it
  • diff size: 2 files, about 126 changed lines, within the 400-line and 15-file limits
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42949564762

Left out: the items under Not verified.

Related

#14678

Merge-Risk: max=MEDIUM demote=false head=c89e09919eb64975be37a84156868f2c4e73c5dd rubric=8.4.1 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

Copy link
Copy Markdown
Contributor

claude-security-review reviewed c89e09919eb64975be37a84156868f2c4e73c5dd: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15251 (head c89e099)

I found no security issues in this pull request.

Scope: I read every hunk of both changed files:

  • plugins/planning/shared/session.py
  • .changes/planning/work-resolve-issue-issue-14678-42949564762-1-5c1a5965.md, a changelog fragment

Neither file matches a trusted-path glob. The diff touches no trust control, workflow, plugin manifest or standing instruction.

What I checked

  • Access checks on actions are unchanged.
    • cancel_round and reset_round now share _reopen_round. It passes the same action name ("cancel" / "reset") to self._step(action, pid), so each one still runs its own step check, then writes the same event as before.
    • set_role only folds its two _notify calls into one. The status check and role assignment above it are untouched.
  • Cleanup when a card is removed still happens.
    • _drop_card now relies on _unback to remove votes. _unback (session.py:3197-3201) runs the same loop over state["votes"][qid] that was removed, and it also removes backings.
    • The new _place_card gets the list from self._cards(qid) (session.py:2739-2740), which returns the same state["cards"][qid] list the callers used.
  • _merge's new merged() helper keeps the same rule. It still skips src's entry when dst already has one, then renames voters. The filters that stop people voting for their own answers or suggestions (own, authors.get(s) != v) still run after it.
  • _reference checks uploads the same way. Diagram and image references still go through self._asset with the same SVG_ASSET and image=True limits, and rect still goes through _rect.

PR context: The description is a plain account of the refactor. It contains no instructions aimed at the review.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed c89e09919eb64975be37a84156868f2c4e73c5dd: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #15251 (refactor, session.py part 2 of 4)

No findings. I read every hunk of both changed files, along with the unchanged helpers the changed lines call.

For each simplification, I checked by reading that the result matches what main does. I ran nothing: this lane has no interpreter, so the test suite was not run here.

  • heartbeat: the empty pass branch now sits under if "focusAt" in old:. The two inner branches and at come out the same.
  • set_role: the two _notify calls became one call that picks its text with a conditional. Same arguments.
  • _merge / merged(): swap, src and dst are already bound when the closure runs.
    • Votes: refs are remapped through moved before merged() runs. The dst in by test sees the same keys, and key order is unchanged.
    • Reactions: swap(v) can only collide when both src and dst are present, and src is skipped then. Comprehension (last wins) versus setdefault (first wins) therefore makes no difference.
    • suggestionVotes: now computed only when qid in st["suggestionVotes"]. The old code built a dict it then threw away, and swap has no side effects.
  • _reopen_round: cancel_round and reset_round pass the same _step action and event names as before.
  • _reference: the caption and return now shared by the diagram and image branches match the two paths they replace.
  • _drop_card: the removed vote loop is identical to the first lines of _unback (session.py#L3199-L3201). It also ran just before that call, so the order is unchanged.
  • _place_card: self._cards(qid) is setdefault, so it returns the same list object that answer and pick already hold. Nothing between those lookups replaces that list.
    • In answer, the _is_other(mine) → _unback step still runs after the card is placed.
    • In pick, the was_other → _unback step is unchanged.

Closing issue #14678 acceptance criteria

  • Behavior unchanged: met by the reading above.
  • Only the listed file and a fragment are edited: met.
  • Within 400 lines and 15 files: met (about 119 changed lines, 2 files).
  • Fragment is bump: patch with body ### Changed / "Internal simplification, no behavior change.": met.
  • Only functions starting in range 2 are changed: met. Every edited function and both new helpers sit between lines 1719 and 3437.
  • ci-status green: the author says CI will check this. I could not see it from this lane.

The author's verification (fragment and skill checks, the subagent's review) is their own claim, and I have not confirmed it.

There were no plugin manifest changes, no .claude/rules path matches and no earlier findings to compare against.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head c89e09919eb64975be37a84156868f2c4e73c5dd, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c89e099

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-15251-c89e09919eb64975be37a84156868f2c4e73c5dd, expires on 2026-12-11.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit 86187bd Nov 11, 2026
75 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14678-42949564762-1 branch November 11, 2026 03:38
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 86187bda80381de9673fbdfb7264cec5a3cf8116; later checks count it verified from this comment.

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.

Simplify the session.py planning plugin code (part 2 of 4)

0 participants