Skip to content

refactor(session-flow): simplify parse_transcript.py - #15157

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14750

Summary

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

Simplified plugins/session-flow/skills/retro/scripts/parse_transcript.py with no behavior change. _normalize_path is collapsed to one normalization and str.removeprefix. The Skill-name regex is compiled once, and each tool_use input is read once. The six hand-written aggregate accumulators in build_multi_session_output become one _AGGREGATE_TOTALS table summed in a loop and spread into the aggregate in the same key order. Subagent tagging is one extend, and a redundant list() copy is gone. Every module-level name and CLI flag is kept, and the JSON output, key order, exit codes and printed text are unchanged.

Not verified

  • Python test suites (test_parse_transcript.py, parse-transcript.test.sh, test_parse_transcript_golden.py) were not executed: 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 1-4 ran with no edits needed. In pass 5, the ai-slop detector script (detect.sh) is not a wrapper this lane may run, so only the rubric read ran on the fragment and found no tells.
  • Build/lint of the Python file (e.g. ruff, pyright) could not run in this lane; left to the PR's CI.

Fix

  • plugins/session-flow/skills/retro/scripts/parse_transcript.py: _normalize_path collapsed (one cwd normalization, removeprefix); _PLUGIN_SKILL compiled regex and a single tool_input read in _count_tools_and_extract_paths; _AGGREGATE_TOTALS table replaces six accumulators in…
  • .changes/session-flow/work-resolve-issue-issue-14750-42883454051-1-d0460052.md: new patch fragment from new-changelog-fragment, body '### Changed' plus 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 3 fragments under .changes/ valid (run before and after tidy)
  • check-changed-skills: retro PASS, 0 errors, 4 pre-existing warnings in files this change does not touch
  • check-affected: 13 passed, 6 skipped (none failed) over 2 changed files
  • fresh-context review subagent over the whole diff and file: no input found on which old and new behavior differ. The six _AGGREGATE_TOTALS pairs match build_session_data, aggregate key order matches the docstring and the golden fixture sessions-multi.json, and no consumer imports a removed name…
  • git-read diff --numstat HEAD: 1 code file + 1 fragment, 70 changed lines, within the issue's 400-line / 15-file limit
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42883454051

Left out: the items under Not verified.

Related

#14750

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

Security review: PR #15157 (head c71fe1a)

No security issues found. I read every hunk of both changed files. Neither matches a trusted-path glob.

  • plugins/session-flow/skills/retro/scripts/parse_transcript.py is a local transcript parser for the retro skill, and this change only refactors it:

    • _normalize_path now uses str.removeprefix.
    • The skill-name regex is compiled once as a module constant.
    • Each tool input is read once.
    • The six aggregate counters are now summed from one _AGGREGATE_TOTALS table.
    • Subagent tagging is now a single extend.
    • A redundant list() copy is gone.

    The change adds no subprocess, shell, network, file-write or path-traversal surface, and no secrets or tokens are involved. The _AGGREGATE_TOTALS (section, field) pairs are fixed constants, never built from input.

  • .changes/session-flow/...md is a new changelog fragment containing only prose. It holds no instructions.

Out of scope for this lane:

  • No trust controls, merge holds, workflows, plugin manifests or standing instructions are touched, so the manifest and instruction-surface lenses do not apply.
  • The PR context contains no embedded directives.
  • Spend: none beyond this review run.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15157, a refactor that simplifies parse_transcript.py (closes #14750)

No findings. I read every hunk of both changed files and compared each refactor with the code at head. Each change keeps the old behavior:

  • _normalize_path: I checked empty path, None or empty cwd, cwd /, path equal to cwd, and path under cwd. Every case gives the same result as before. Callers only pass str paths: str(fpath_key) and a file_path that has passed an isinstance(..., str) check.
  • _PLUGIN_SKILL and the single tool_input read: the regex is the same one, now compiled once. _as_dict(item.get("input")) is still read once for each tool_use item, as before.
  • _AGGREGATE_TOTALS: the six (section, field) pairs match the keys build_session_data emits (turns.assistant, turns.human_messages, tokens.total_input, tokens.total_output, compactions.count, tools.rejection_count). The key order is unchanged, and **totals is still spread before all_tools. So the aggregate's JSON key order and the summary text stay the same.
  • Subagent tagging: {**sub, "session_id": sid} matches dict(sub) followed by setting session_id. Subagents always come from parse_subagents, which builds plain dicts.
  • list(ns.sessions) → ns.sessions: _parse_legacy_or_argparse already makes ns.sessions a new list. build_multi_session_output reassigns session_ids (list(dict.fromkeys(...))) and never changes the caller's list.

Acceptance criteria (#14750):

  • Behavior unchanged: met, based on the reading above. The existing golden and unit tests (test_parse_transcript_golden.py, test_parse_transcript.py) would fail if it broke. I did not run them; I have no interpreter in this lane.
  • Only the listed file and a changelog fragment are edited: met.
  • Within 400 changed lines and 15 files: met (about 70 lines, one code file).
  • ci-status green: left to CI. I did not verify it.
  • Fragment: met. bump: patch, body ### Changed plus "Internal simplification, no behavior change."

The PR body reports test, lint and check results. Those are the author's claims, and I did not verify them.

No plugin manifest changed, so there are no manifest lines. There were no prior findings and no settled threads to apply. The PR context contains no embedded instructions aimed at this lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c71fe1a

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-15157-c71fe1a4517219b5c0da1e127b88ff3f5d1bde3c, expires on 2026-12-10.

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 10, 2026
Merged via the queue into main with commit f5dfb55 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14750-42883454051-1 branch November 10, 2026 20:26
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 6, survived 1, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 86%; mutation score 86%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/session-flow/skills/retro/scripts/parse_transcript.py 6 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/session-flow/skills/retro/scripts/parse_transcript.py:117 other productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

0 participants