Skip to content

refactor(planning): simplify session.py part 1 of 4 - #15002

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14677-42764498177-1
Nov 10, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14677

Summary

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

Simplified functions that start in lines 1-1719 (range 1 of 4 of the 6876-line plugins/planning/shared/session.py) without changing behavior. mention_texts now reuses the existing _answers and _flat helpers; cross_field_errors counts questions per round with collections.Counter; _live_folder and _asset_source share a new _resolved helper for resolving path and root; _thumb and _report_image share a new _data_url helper for base64 decoding and the jpeg->jpg kind; _text folds its duplicate 'empty' refusal into the existing one; _file_name reuses _DROPPED_KINDS; _bad_links_and_assets reads doc['session'] once. Every message, status code, error order and public name is unchanged. I chose small reuse/dedupe edits inside the range over larger restructuring, which the issue reserves for a later pass.

Not verified

  • plugins/planning/shared tests (test_session.py and others) were not run: this lane allows no interpreter, so the suites are left to the PR's CI
  • tidy recorded as skipped: the ai-slop pass ran only its judgment rubric on the changelog fragment (no findings); its detector script detect.sh is not among the wrappers this lane may run
  • ci-status green is a PR check, left to the PR's CI
  • git status lists untracked dotfiles at the checkout root (.bash_profile, .bashrc, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) that this run did not create; they look like sandbox artifacts and should be left out of the patch

Fix

  • plugins/planning/shared/session.py: behavior-preserving simplification of mention_texts, cross_field_errors, _live_folder, _bad_links_and_assets, _text, _asset_source, _file_name, _thumb and _report_image; added private helpers _resolved and _data_url (net about 3 lines shorter, duplicated…
  • .changes/planning/work-resolve-issue-issue-14677-42764498177-1-92482f9b.md: patch fragment created by new-changelog-fragment, body '### Changed' with 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 14 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 differences found in any hunk (return values, exception type/status/code/message/field, ordering, public names); no test in plugins/planning patches anything the change bypasses
  • range check: file is 6876 lines, range 1 is lines 1-1719; every edited function starts before line 1180, and the new helpers sit beside the functions they serve
  • tidy-diff: simplify, comment, residue and write-for-humans passes found nothing further to change
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42764498177

Left out: the items under Not verified.

Related

#14677

Merge-Risk: unrated reason=no-rating

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15002 (refactor(planning): simplify session.py part 1 of 4)

No security issues found.

I read both changed files in full. Neither matches a trusted-path glob. Neither touches a trust control, a merge hold, a plugin manifest or a standing instruction. The PR has no embedded directives aimed at this lane.

I checked each security-relevant hunk in plugins/planning/shared/session.py against the head file. Each one behaves the same as the code it replaces:

  • Path containment (_live_folder, _asset_source → new _resolved). Both paths are still resolved with resolve(strict=True), so links are followed and a missing path is refused. The same OSError/RuntimeError refusal raises the same field and message. The is_relative_to(staging) / is_relative_to(base) checks and the hidden-part checks that follow are unchanged. Containment is not weakened.
  • Base64 data URLs (_thumb, _report_image → new _data_url). Decoding still uses validate=True, and the message is the same (f"{field} is not base64.", with field="thumb" for thumbs). In _report_image, the size cap still runs before the magic-byte check. Computing kind earlier has no side effects. The magic-byte check UPLOAD_KINDS[kind][1](data[:64]) is still there.
  • Upload file names (_file_name). (*_DROPPED_KINDS, "Cn") expands to ("Cc","Cf","Co","Cs","Cn") (_DROPPED_KINDS is defined at session.py#L821). That is the same set as before, so control, bidi, private-use, surrogate and unassigned characters are still dropped.
  • Text fields (_text). A missing, non-optional field now becomes "" and goes through _visible(...).strip(). It is then refused with the same DomainError(400, "empty", ...), or "" is returned when empty_ok is set. The result matches the old early returns, and the type check on values that are not strings still runs.
  • Document validation (cross_field_errors, mention_texts, _bad_links_and_assets). The per-round count loop never skipped a question (it has no continue), so collections.Counter over doc["questions"] gives the same counts. collections is already imported at L21. mention_texts now calls the existing _answers and _flat helpers, which use the same filters. Reading doc["session"] once does not change which URL, repo or commit validation runs.

The .changes/ fragment is changelog text only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read every hunk of both changed files: plugins/planning/shared/session.py and the changelog fragment. For each hunk I compared the old and new code to check that behavior is unchanged.

Hunk by hunk

  • mention_texts: The removed people_cards comprehension matches _answers(cards) exactly. The cleared, suggestions and discussions generators match _flat (session.py:610). Order is unchanged.
  • cross_field_errors: The per-round count moved out of the for q in doc["questions"] loop into collections.Counter. The loop has no continue or early exit, so every question was already counted. collections is imported at line 21. The round errors still come after the loop and are still sorted.
  • _resolved (shared by _live_folder and _asset_source): It catches the same exceptions and raises with the same field and message as before.
  • _bad_links_and_assets: This only moves where sess is first assigned.
  • _text: A None value now becomes "" and goes through the existing check. _visible("") returns "". With empty_ok, it still returns "", since the too-long check can't fire on an empty string. Without it, the error is the same DomainError(400, "empty", f"{field} is empty.", field=field) as before. optional still returns None first.
  • _file_name: (*_DROPPED_KINDS, "Cn") equals the old tuple (_DROPPED_KINDS is defined at line 821).
  • _data_url (shared by _thumb and _report_image): Called with "thumb", it gives the same "thumb is not base64." message as before. In _report_image, a bad base64 value still fails before the size check, and working out the kind has no side effects, so the order of errors is unchanged.

Closing issue #14677 acceptance criteria

  • Behavior unchanged: met, by my reading of each hunk above. No public name changes.
  • Only the listed file and changelog fragments are edited: met.
  • At most 400 changed lines and 15 files: met (2 files, about 50 lines).
  • ci-status green: I can't check this from here. It's left to the PR's CI. The PR author says the test suites weren't run; I didn't run them either.
  • Changelog fragment is patch with body ### Changed and the required line: met.
  • Only functions that start in range 1 (lines 1–1719) change: met. Every edited function starts before line 1180.

I didn't run any tests. The checks listed in the PR (changelog-fragment and changed-skills checks passing) are the author's claims and I haven't verified them.

There are no plugin manifest changes and no prior findings, and this is the first review of the PR.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 92a6df3 Nov 10, 2026
75 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14677-42764498177-1 branch November 10, 2026 07:00
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 92a6df3a39657828ed652a4bffe84cee358d279b; 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 1 of 4)

0 participants