Skip to content

refactor(session-flow): simplify resume_cases.py without behavior change - #15310

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14742

Summary

Opened by the work-resolve-issue lane from work-resolve-issue/issue-14742-42716246523-1, which an earlier run left with commits and no report. A summary-only model pass read the branch's diff and the issue, changed nothing, and wrote:

The diff refactors plugins/session-flow/scripts/harness/resume_cases.py and adds the required patch changelog fragment for session-flow. It removes repeated code by adding small helpers (_render, _final), a HOT_SLOTS constant, and a reuse of _section_span in _section_body. It also makes _injection_items return the first and rest groups separately. This matches the issue's scope: one listed file, no tests, evals or fixtures touched, and a small diff of about 10 KB. One thing for a reviewer to check is that _build no longer runs out_dir = Path(out_dir). If any caller passes a string for out_dir, out_dir / ".work" would fail, so confirm every caller passes a Path. I did not run the code or CI, so I can't confirm that behavior is unchanged or that ci-status is green. The diff has no text aimed at steering a reviewer.

Fix

  • resume_cases.py: add HOT_SLOTS constant and use it in _fill instead of an inline slot tuple
  • resume_cases.py: add _render helper (pick template and format with fields); use it in _entry, _did_left and the decisions in _fill_3
  • resume_cases.py: add _final helper for final-hop text; use it in _hot, _did_left and _fill_3
  • resume_cases.py: _injection_items now returns (first, rest) lists; _injections and _fill_3 consume it directly
  • resume_cases.py: _fill uses str.removesuffix and a list comprehension, and sums generated lengths in one step
  • resume_cases.py: id_lines in _fill_3 uses an inner injected() helper instead of two duplicate loops
  • resume_cases.py: _section_body reuses _section_span; _section_span uses a generator with next()
  • resume_cases.py: drop the redundant Path(out_dir) conversion in _build (check that callers pass a Path)
  • .changes/session-flow: add patch changelog fragment 'Internal simplification, no behavior change.'

Files the branch changes, from the compare listing; a denied path, which the merge lane refuses, is marked and listed first:

  • .changes/session-flow/work-resolve-issue-issue-14742-42716246523-1-457c9338.md
  • plugins/session-flow/scripts/harness/resume_cases.py

Verification

The earlier run reported no checks here, and the summary pass ran none.

The runner ran each check from the base copy against 968e3d0:

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

The runner's leak scan read everything the branch changes since its merge base with the default branch and found nothing credential-shaped.

Left out: every check the earlier run would have reported; ci-status, pr-verify and the security review lane check the head before it merges.

Related

#14742

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

Security review: no security issues found

I read every hunk of both changed files:

  • .changes/session-flow/work-resolve-issue-issue-14742-42716246523-1-457c9338.md is a new patch changelog fragment. It holds prose only.
  • plugins/session-flow/scripts/harness/resume_cases.py is a refactor of a test-harness script that builds resume test cases. It adds the helpers _render and _final and the HOT_SLOTS constant. _injection_items now returns a (first, rest) tuple. _section_body now reuses _section_span, and _section_span now uses a generator. The redundant Path(out_dir) call in _build is gone.

Neither file matches a trusted-path glob, and neither touches a trust control, a merge hold, a workflow, a token, a kill switch, a plugin manifest or a standing instruction surface. The script only generates fixture text and writes it to paths it builds from its own inputs. The diff adds no new input source, subprocess, shell, network call or path built from untrusted input. Its only effect is how the existing local fixture files are put together, so there is nothing a pull request author could exploit.

I found no embedded instructions in the PR context. The closing issue's body was left out by the wrapper.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings

This PR refactors plugins/session-flow/scripts/harness/resume_cases.py and adds a session-flow patch changelog fragment. I read every hunk of both changed files and checked each refactor against the code it calls. None of them changes behavior.

  • _render / _final / HOT_SLOTS: Each one replaces inline code that was identical. _render still calls _pick and _fields with the same keys, so the generated text is unchanged. _final returns {} before the final hop, the same as the old hop == hops and final.get(...) guard. _fill_3 already used this logic.
  • _injection_items returning (first, rest): It has three callers: _injections, id_lines and the amendments list. All three now unpack the tuple, and [*firsts, *rest] gives the same order as the old concatenated list. In id_lines, new_id is still called in the same order (firsts, then generated, then rest), so the R/Q/D ids are unchanged.
  • _fill: removesuffix("-new") matches the old slice. The entries are produced in the same order, and sum(map(len, texts)) gives the same total as the old per-entry +=.
  • _section_body via _section_span: lines[start : start + count - 1] gives the same slice as the old lines[start:end], both when a next heading exists and at end of file. The new conditional in _section_span parses as (== until) if until else startswith("## "), which matches the old branch logic.
  • Dropped out_dir = Path(out_dir) in _build: The PR author asked reviewers to check this. The only caller is build_predecessor_chain, which already passes Path(out_dir) (resume_cases.py#L722), so the second conversion was redundant.

Closing issue #14742 acceptance criteria

  • Behavior unchanged: met. plugins/session-flow/scripts/harness/test_resume_cases.py builds predecessor chains from the eval cases and compares the bytes of two builds of re-stale-github-fact (shape 2) and re-superseded-rule (shape 3), so these paths are tested. I did not run the tests.
  • Only the listed file plus a changelog fragment edited: met.
  • Within 400 changed lines and 15 files: met (2 files, about 100 lines).
  • ci-status green: not verified by this lane. The PR body says it was not run; the merge gate checks it.
  • Fragment with bump: patch, ### Changed, and "Internal simplification, no behavior change.": met. The runner reports that scripts/check-changelog-fragments.sh --check passed; that is the author's claim and I did not confirm it.

No plugin manifests changed, no changed file matches a trusted path, and neither the PR context nor the prior-findings file contains embedded instructions. There are no prior findings, so this was a full review, not blocking-only.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 968e3d0

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-15310-968e3d09755717f8c063af673313c40d63fba171, 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 202f373 Nov 11, 2026
64 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14742-42716246523-1 branch November 11, 2026 09:29
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 202f3735c1e7849b25dbaf7b467ff81628fbbaf9; 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 resume_cases.py session-flow plugin code

0 participants