Skip to content

refactor(planning): simplify the second half of round.py - #15121

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14696

Summary

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

Simplified functions that start in the second half of plugins/planning/surface/round.py (range 2 of 2: line 1775 on, of the 3547 lines at the start), with no behavior change. The ledger sync and ledger edit paths now share one replace_text helper (temp file, then rename), placed beside write_text. record_ledger_sync's row-key regex no longer uses an empty-regex fallback. apply_ops_file's loop variable no longer shadows its name parameter. print_latency builds its JSON stats in one comprehension. cmd_ensure_running drops two one-use temporaries. I considered and backed out two other edits: a setattr loop in cmd_add_round (it hides attribute names from grep) and reusing the loaded responses in cmd_validate (it would depend on the tuple order).

Not verified

  • Python test suite (plugins/planning/surface/test_round.py) and a Python lint/compile pass were not run here; this lane runs no interpreter. Left to the PR's CI.
  • ci-status green on the PR: a PR CI check, left to the PR's CI
  • tidy pass 5 (ai-slop:audit fix): detect.sh is not runnable in this lane, so only the rubric read ran on the changelog fragment (no tells found)
  • Untracked runner-environment files in the checkout (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) are not part of this change and were left alone

Fix

  • plugins/planning/surface/round.py: added replace_text beside write_text, now used by write_synced_ledger and edit_ledger, keeping the same .<name>.sync and .<name>.edit temp names; record_ledger_sync gets its row key from a single regex match with an explicit 'order' fallback;…
  • .changes/planning/work-resolve-issue-issue-14696-42835728798-1-e98d0923.md: new patch fragment from new-changelog-fragment planning patch, with body '### Changed' and '- Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 9 fragments valid (run before and after tidy and review)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 13 passed, 6 skipped over 2 changed files (final run after review fixes)
  • git-read diff --numstat HEAD: round.py 25 added / 25 removed; every hunk is in a function that starts at or after line 1775 (cmd_add_round is unchanged in the final diff)
  • fresh-context review subagent over the whole diff: no behavior changes found (it covered non-dict JSON, empty drift, regex edge cases, and the test_round.py:4163 fixture that makes .<ledger>.sync a directory, which still raises inside replace_text and is still caught); its two readability…
  • grep across plugins/planning: no test or other file references the changed local names or the old inline temp-file code
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42835728798

Left out: the items under Not verified.

Related

#14696

Merge-Risk: unrated reason=unreadable

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

Copy link
Copy Markdown
Contributor

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

Security review: PR #15121 (head a3a1d27)

No security issues found.

I read every hunk of both changed files. Neither file matches a trusted-path glob. The PR changes no trust control, plugin manifest or standing instruction.

  • .changes/planning/…-e98d0923.md: a new changelog fragment containing only a patch bump and one prose line. It has no security surface.
  • plugins/planning/surface/round.py: the refactor keeps the same behaviour on every path I checked.
    • replace_text: the new helper writes a temp file and then renames it over the target. The temp names stay .<name>.sync and .<name>.edit, built with path.with_name in the same directory, just as before. The target path comes from the same caller-supplied path as before, so the path handling is unchanged.
    • record_ledger_sync row key: the old re.match(r"", line).group() or "order" fallback always gave "order" when the line didn't start with Q<N>. The new m.group() if m else "order" gives the same result. No new regex input or backtracking surface.
    • apply_ops_file: only the loop variable was renamed (name → op_name). The OP_ARGS allowlist check still runs before ops_schema["$defs"][op_name] is looked up, so ops-file validation is unchanged.
    • print_latency and cmd_ensure_running: a comprehension and inlined temporaries. They read the same values and call the same validators (emoji_flag, pacing_value).

No embedded directives in the PR context. There were no prior findings and this is the first review of this PR, so the review was not blocking-only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15121 — refactor(planning): simplify the second half of round.py

No findings. I read every hunk of both changed files: plugins/planning/surface/round.py and the changelog fragment. For each edit I compared the old and new code against the surrounding function at head:

  • apply_ops_file: before this change, the loop variable name shadowed the parameter of the same name. It is now op_name. After the loop (L2304–2333), the function never reads name again. The only place that reads the parameter is the cannot read ops file {name} message, which runs before the loop. So the rename removes the shadowing and changes no output.
  • print_latency: the variable lines is renamed history and nothing else reads it. The JSON stats dict is now built by a comprehension that produces the same keys and values in the same order, and the function returns straight after.
  • record_ledger_sync: before, the code fell back to re.match(r"", line).group(), which gives "", and then to or "order". Now it uses m.group() if m else "order". The two match the same inputs. A successful Q\d+\b match always contains at least Q plus a digit, so it is never empty, and a line with no match gives "order" either way. Order and deduplication through dict.fromkeys are unchanged.
  • replace_text: this new helper writes the same .<name>.sync and .<name>.edit temp files and calls the same write_text and os.replace as the inline code it replaces. Both callers pass a Path, which both of them already relied on. Errors (for example, the temp path being a directory) are raised from the same place as before.
  • cmd_ensure_running: the one-use temporaries flag and pacing are inlined. Neither name is used later in the function (L3036–3097).

Closing issue #14696, acceptance criteria:

  • Behavior unchanged; no flags, exported names or files renamed: met, by my reading above. The existing tests (test_round.py pacing, ledger sync and edit, and ops cases) exercise these paths. They are author-claimed as not run in the lane and left to CI. I ran nothing myself.
  • Diff edits only the listed file plus fragments: met.
  • Within 400 lines / 15 files: met (2 files, about 25 lines changed each way).
  • ci-status green: not verifiable from this lane; left to CI.
  • Fragment with ### Changed and "Internal simplification, no behavior change.": met (bump: patch).
  • Only functions that start in range 2 of 2 are changed: every changed function starts at about L2276 or later, which is past the L1775 boundary the PR states. replace_text is new and placed beside write_text in that range.

Path-scoped rules: .claude/rules/ruff-pin.md matches **/*.py. It describes how to run lint and makes no claim about this code. The PR context says lint was left to CI (author-claimed).

Paved paths: I did not resolve a paved-path index row for this change, so I report nothing about paved paths.

Embedded text: none found that tries to direct the lane.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for a3a1d27

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-15121-a3a1d27f37afd0ee68d70bef4586dfabe58ef828, 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 d75ba15 Nov 10, 2026
69 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14696-42835728798-1 branch November 10, 2026 15:25
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit d75ba15fc2ce90f51078dad5fcd09b62bd29be94; 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 round.py planning plugin code (part 2 of 2)

0 participants