Skip to content

refactor(planning): simplify the last quarter of shared session.py - #15276

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14682

Summary

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

Simplified functions that start in range 4 of 4 of plugins/planning/shared/session.py (lines 5146-6860 of its 6860 lines). The round-size check that _op_open_round and _op_close_round each repeated is now one _check_round_room method, and the report-additions view that _report_view and _my_report_view each repeated is now one _adds_view helper. _late_acts and _digest_disagreements now call _named once per item instead of twice. Rank sorting in _format_outcome uses a position map instead of list.index. _public_chat filters reactions in one pass. _settings_patch merges the guestPopups and prototypeTiers branches into one mapping-driven branch. Outputs, error messages, key order and exported names stay the same.

Not verified

  • Python and shell test suites covering session.py (plugins/planning/shared/tests/test_owner_ops.py, test_people_proposals.py, test_schema_shapes.py, ui-a/align-*.test.sh) were not run here: this lane runs no interpreter. Left to the PR's CI.
  • ci-status green is a PR CI check, left to the PR's CI.
  • tidy passes 4-5 (docs-hygiene write-for-humans, ai-slop fix) skipped for the changelog fragment: the issue requires its body verbatim ('### Changed' plus 'Internal simplification, no behavior change.'), so it cannot be rewritten.
  • Further range-4 candidates left untouched to keep the diff small and low-risk: the repeated masking expressions in snapshot, and the duplicated precheck and write in read_inbox.

Fix

  • plugins/planning/shared/session.py: in range-4 functions only: extracted _check_round_room (used by _op_open_round and _op_close_round) and _adds_view (used by _report_view and _my_report_view); _late_acts and _digest_disagreements call _named once per item via :=; _format_outcome rank sorting uses…
  • .changes/planning/work-resolve-issue-issue-14682-42968750423-1-264f12a2.md: new planning patch fragment, created with new-changelog-fragment, body '### Changed' plus 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 6b8383a:

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

The run reports:

  • check-changelog-fragments: all 8 fragments valid (run before and after tidy/review)
  • check-changed-skills: no changed skills, nothing to gate (run before and after tidy/review)
  • check-affected: 13 passed, 6 skipped (shellcheck, typos not installed, three validate-plugins steps that run tree code, changed-skills), the rest CI-only (run before and after tidy/review)
  • range check: the file has 6860 lines, so range 4 is lines 5146-6860; every edited function (report_image, _report_view, _my_report_view, _notify_mentions, _digest_disagreements, _late_acts, _format_outcome, _op_open_round, _op_close_round, _public_chat, _settings_patch) starts at or after line…
  • shared-copies check: scripts/shared-copies.txt lists only shared/session_bridge.py for planning, so session.py is not a generated copy
  • fresh-context review subagent over the full diff: no behavior differences found; it confirmed _named and _mentioned have no side effects, walrus scoping is valid, sort order and error messages are identical, and dict key order is preserved
  • tidy-diff over the 18 changed hunks: passes 1-3 made no edits; no class-A comments found
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42968750423

Left out: the items under Not verified.

Related

#14682

Merge-Risk: max=MEDIUM demote=false head=6b8383a41561a6c0d6da9ca2016730288e9cca46 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 6b8383a41561a6c0d6da9ca2016730288e9cca46: read 2 of 2 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15276 (refactor of plugins/planning/shared/session.py)

No security issues found. I read every hunk of both changed files: the changelog fragment and session.py. No trusted path is touched. The pull request changes no manifest, workflow, token, trust control or instruction surface.

I checked each refactor for a behaviour change that would matter for security. None changes what is exposed or what is checked:

  • _adds_view, used by _report_view and _my_report_view: the new helper still drops each addition's image value, which is where the picture is saved, and returns only a true/false flag. The saved location stays hidden in both views. The other fields in _my_report_view are unchanged.
  • report_image pic index: pic is still checked against [1-MAX_REPORT_IMAGES] before int(pic or 1) runs. The bounds check i <= len(pics) is the same as before.
  • _notify_mentions: it now calls _mentioned(before, actor) even when before is empty. _mentioned turns its input into str(text or ""), so empty input gives an empty set, and it has no side effects (session.py:5651-5657). The notification behaviour is the same.
  • _digest_disagreements and _late_acts: these still filter on _active(pid), on d["pid"] == pid, and on _named(...) is not None. The new := assignments set the variable in the function itself, and each one is set before it is read. People who are no longer active stay filtered out.
  • _public_chat: it filters reactions to active people and drops empty lists in one pass. The result is the same.
  • _settings_patch: the guestPopups and prototypeTiers branches are now one branch driven by a mapping. The allowlist check (every value allowed, no repeats) and the order of stored values are unchanged.
  • _check_round_room: the MAX_ROUND check moved into a helper that both callers still call before anything changes.

I found no embedded instructions in the PR context.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15276 (refactor(planning): simplify the last quarter of shared session.py)

No findings. I read every hunk in both changed files: the changelog fragment and plugins/planning/shared/session.py. For each edit I compared the old and new code by reading them. I did not run any tests.

Behavior equivalence, edit by edit

  • report_image: i = int(pic or 1) is computed once and gives the same index and bounds check as before.
  • _adds_view (new staticmethod): its expression is identical to the one _report_view and _my_report_view both repeated, and the key order of either view is unchanged.
  • _notify_mentions: the if before else set() guard was dropped. This is safe because _mentioned already turns a falsy value into "" through str(text or "") (session.py#L5654), so before="" or None still gives an empty set. _mentioned has no side effects.
  • _digest_disagreements / _late_acts: the walrus (:=) bindings sit inside method bodies, not a class-body comprehension, so the scoping is valid. Each if clause runs before its element expression, so said is always bound when it is used. Output order and keys are unchanged, and _named is now called once per item instead of twice.
  • _format_outcome (rank): labels comes from self._options(q), a dict (its .items() is used on the multi path just above). Its keys are unique, so place[o] equals the old ids.index(o). An unknown option in a ballot would still raise an error: before, points[o] already raised KeyError first.
  • _check_round_room: the loop moved unchanged out of _op_open_round and _op_close_round, and it still runs at the same point in each, before anything changes.
  • _public_chat: filtering and dropping empty reaction lists now happen in one dict comprehension; the result and its key order are the same.
  • _settings_patch: the ordered map gives the same check, the same error text ({k} is a list of …, each at most once.) and the same ordered write-back for guestPopups and prototypeTiers. The branch is still checked before SETTING_VALUES, as it was.

Closing issue #14682 acceptance criteria

  • Behavior unchanged: met, based on my reading above. The existing suites named in the PR body (test_owner_ops.py, test_people_proposals.py, test_schema_shapes.py, ui-a/align-*.test.sh) cover these paths. I did not run them, and the PR says the authoring lane did not either; that is left to CI.
  • Only the listed file plus fragments edited: met.
  • Within 400 changed lines / 15 files: met (about 60 changed lines, 1 hand-edited file).
  • ci-status green: not something this lane can check; left to the PR's CI.
  • Fragment with ### Changed and "Internal simplification, no behavior change.": met, and bump: patch fits a no-behavior-change refactor.
  • Only functions starting in range 4 (lines 5146–6860) changed: met. report_image starts at L5261, _report_view at L5290, _late_acts at L5827, _public_chat at L6579 and _settings_patch at L6825; all the other edited functions also start after L5146.

No plugin manifest changed. The PR context file contained no embedded instructions aimed at the review. The fragment check and test results quoted in the PR body are the author's claims, and I did not verify them.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 6b8383a

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-15276-6b8383a41561a6c0d6da9ca2016730288e9cca46, 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 ac3c67c Nov 11, 2026
75 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14682-42968750423-1 branch November 11, 2026 07:10
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 4 of 4)

0 participants