Skip to content

refactor(session-flow): simplify save_point.py range 3 of 3 - #15365

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14734

Summary

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

Simplified the functions that start in range 3 of 3 of plugins/session-flow/scripts/save_point.py (lines 2668-4000 of 4000 when this part started, cmd_amend through main) without changing behavior. The two git subprocess calls now share one _git_stdout helper. The shape-2 and shape-3 skeleton builders share one _this_session_lines helper, build_skeleton_3 drops its local slot() alias of _fill, and build_skeleton writes its repeated Amended slot once. cmd_new reuses the existing _same_file check and parses an existing hop file once instead of twice, and cmd_memory_root and cmd_new share one NO_MEMORY_ROOT message. Net 29 lines shorter. Every output, exit code, message, flag and name that other files call is unchanged; _git_toplevel keeps its signature for tidy_work.py.

Not verified

  • The session-flow Python test suites (scripts/tests/test_save_point.py, test_tidy_work.py) were not run here: the lane allows no interpreter or test runner. They are left to the PR's CI.
  • No Python formatter or linter (ruff/black) could run in this lane; the edits follow black's layout by hand. Left to the PR's CI.
  • ci-status green is a PR check, left to the PR's CI.
  • tidy-diff pass 5 (/ai-slop:audit fix on the changelog fragment) was skipped: the lane's Bash permits only the named wrappers, so detect.sh and digest-guard.sh could not run. A manual read of the fragment's one body line found no catalog tell. Passes 1-4 ran and made no edits.
  • tidy-diff proposal not applied: _git_origin is now a one-line wrapper over _git_stdout; it stays because its caller sits outside the listed lines and the name states what it reads.

Fix

  • plugins/session-flow/scripts/save_point.py: added _git_stdout and used it in _git_toplevel and _git_origin; added _this_session_lines and used it in build_skeleton and build_skeleton_3; build_skeleton_3 calls _fill directly in place of its local slot() alias; build_skeleton's section helper is one…
  • .changes/session-flow/work-resolve-issue-issue-14734-43025267971-1-36b86417.md: patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 10 fragments under .changes/ 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 over 2 changed files (run before and after tidy)
  • git-read diff --unified=0: every hunk falls inside a function that starts at or after line 2668 (cmd_amend at 2679 is the first changed function)
  • fresh-context review subagent over the whole diff: no findings; each of the 16 hunks judged behavior-preserving, including the hop-file parse reuse and the _git_stdout None/empty handling
  • grep for callers: only tidy_work.py calls a changed name (_git_toplevel), and its signature and return values are unchanged
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43025267971

Left out: the items under Not verified.

Related

#14734

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

Security review: PR #15365, a refactor of save_point.py

I found no security issues. I read every hunk in both changed files: plugins/session-flow/scripts/save_point.py and the changelog fragment .changes/session-flow/work-resolve-issue-issue-14734-43025267971-1-36b86417.md. Neither file matches a trusted path. Neither is a plugin manifest or an instruction file, and the diff changes no trust control.

The changes that touch something security-relevant all behave the same as before:

  • Predecessor containment check (cmd_new). The check that a predecessor file must live in the handoffs directory now calls the existing _same_file. That function (save_point.py#L494-L497) runs the same normcase(realpath(...)) comparison the deleted inline code ran, so the path check is no weaker.
  • Hop-file overwrite guard (cmd_new). The guard now parses the hop file once instead of twice. When the parse fails (OSError or UnicodeDecodeError), existing is None still leads straight to _die. A mismatched session_id still refuses the write. A file belonging to another session is still never overwritten.
  • _git_stdout helper. It runs git with a list of arguments (no shell) and fixed subcommands, so nothing new can be injected. It returns None on OSError, on a nonzero exit, or on empty output, which matches both _git_toplevel and _git_origin before the change.
  • _tag_carried. _trim_blank returns a new slice (L648-L654). Dropping the list() copy therefore leaves the caller's body unmodified. rest[m.end():] is the same as rest[len(m.group(0)):] for a match at position 0.
  • The rest (_this_session_lines, the inlined slot() alias, the amended slot and NO_MEMORY_ROOT) only moves text the script writes, with no change to inputs or what reaches them.

The PR context file contains no text addressed to the review lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

I read both changed files in full: plugins/session-flow/scripts/save_point.py and the session-flow changelog fragment. I also read the code each changed line depends on. Every hunk keeps behavior the same:

  • cmd_amend writes: original is still bound in the comprehension and still used by its if payload != original filter. The staging loop never read the third element, and nothing else reads writes.
  • _git_stdout: _git_toplevel returns None in the same cases as before: OSError, a non-zero exit, or empty stdout. It still returns a resolved Path otherwise, and its signature is unchanged for its three callers in tidy_work.py. _git_origin keeps its old contract exactly.
  • _tag_carried: _trim_blank returns a slice, which is already a new list (save_point.py#L648-L654). Dropping list(...) therefore never mutates the caller's body. TAG_RE.match anchors at 0, so m.end() equals len(m.group(0)).
  • Skeletons: _fill is a pure f-string, so building amended early and the shared _this_session_lines() produce the same text. Inlining slot → _fill and the one-line section helper are also equivalent.
  • NO_MEMORY_ROOT: both error messages are unchanged byte for byte.
  • _same_file: it is the same normcase(realpath(a)) == normcase(realpath(b)) comparison (L494-L497).
  • Hop-file parse reuse: Doc is a plain dataclass with no __bool__ or __len__, so if existing is true exactly when the parse succeeded. A failed parse still exits 1 with "belongs to session unknown". Before, a failed parse gave owner = "", and session_id is always a non-empty, validated UUID by then (L3663-L3674). So the old and new code fail on the same inputs.

Closing issue #14734, acceptance criteria:

  • Behavior unchanged; only the listed file and fragments edited; within 400 lines / 15 files: met.
  • Fragment body: met. It has bump: patch, ### Changed, and "Internal simplification, no behavior change."
  • Only functions starting in range 3 of 3 changed: met. The first changed function is cmd_amend, after line 2668.
  • ci-status green: the author left this to CI. I did not verify it, and I did not run the tests or linters, which the author also left to CI.

No settled threads apply, and there are no prior findings: this is the first review of this pull request (blocking only: no). The PR context contains no embedded directives. I found no .claude/rules/ path-scoped rules, no plugin manifest changes and no paved-path citations relevant to this change.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for e08f1c9

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-15365-e08f1c9af7090e5f3e9d96cd90c90ecb24dffb20, 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 4633005 Nov 11, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14734-43025267971-1 branch November 11, 2026 13:31
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 4633005e09116267853c5fc8eebc7bd14c501fb8; 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 save_point.py session-flow plugin code (part 3 of 3)

0 participants