Skip to content

refactor(session-flow): move audit-sessions epoch, positive-int and store-dir helpers into census.py - #15575

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15539-43214003413-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #15539

Summary

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

census.py now holds one epoch timestamp parser and one _positive argparse type. collect.py, friction_scan.py, sweep.py and audit-friction's friction.py call them instead of keeping their own copies, and collect.py calls census.store_dir in place of its deleted duplicate. The shared type keeps the name _positive, because argparse puts the type function's name in its error (invalid _positive value: 'abc'), so each CLI's error text stays byte-identical. The epoch helper is public (census.epoch) because no such constraint applies to it. No import became unused. One side effect: collect.py's collector digest hashes the bytes of collect.py, census.py and friction_scan.py, so the next collect run re-ingests stored sessions once. Any edit to those files does this, and the record contents stay the same.

Not verified

  • Pytest suites in audit-sessions/scripts/tests/ and audit-friction/scripts/, and audit-friction.test.sh: this lane runs no interpreter or test runner, so they are left to the PR's CI
  • scripts/run-ruff.sh check on the changed files was not run directly, because this lane runs only its named wrappers. check-affected passed 13 checks without naming them, and the review subagent found no unused or undefined names under the configured E4/E7/E9/F rules. Left to the PR's CI
  • ci-status green: a PR CI check, left to the PR's CI
  • Tidy pass 5 (ai-slop:audit fix on the changelog fragment) could not run its detector, because the lane runs only its named wrappers. A manual read of the one-line fragment found no catalog tells. Passes 1-4 ran and made no edits
  • Changes are left uncommitted in the working tree, as the runner instructs; the runner turns them into the patch

Fix

  • plugins/session-flow/skills/audit-sessions/scripts/census.py: added epoch (moved from the three _epoch copies, same body plus a docstring) and _positive (moved from the three copies, name kept for argparse's error text), the argparse and datetime, timezone imports they need, and a mention…
  • plugins/session-flow/skills/audit-sessions/scripts/collect.py: deleted store_dir, _epoch and _positive; the callers now use census.store_dir, census.epoch and census._positive
  • plugins/session-flow/skills/audit-sessions/scripts/friction_scan.py: deleted _epoch; the caller uses census.epoch
  • plugins/session-flow/skills/audit-sessions/scripts/sweep.py: deleted _epoch and _positive; the callers use census.epoch and census._positive
  • plugins/session-flow/skills/audit-friction/scripts/friction.py: deleted _positive; mine --days uses census._positive
  • .changes/session-flow/work-resolve-issue-issue-15539-43214003413-1-776697d2.md: new patch fragment, ### Changed, "Internal restructuring, no behavior change."

Verification

The runner ran each check from the base copy against 5f6626d:

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

The run reports:

  • check-changelog-fragments: all 3 fragments valid (run before and after tidy)
  • check-changed-skills: audit-friction and audit-sessions PASS, 0 errors (its warnings are existing SKILL.md size warnings in files this change did not touch)
  • check-affected: 13 passed, 6 skipped over 6 changed files (run before and after tidy)
  • Grep over the repository: no remaining reference to collect.store_dir, collect._epoch, collect._positive, sweep._epoch, sweep._positive, friction_scan._epoch or friction._positive; tests already use census.store_dir
  • Fresh-context review subagent over the whole diff: no confirmed findings. The moved helpers behave the same as the removed copies, every call site resolves, no import is unused or missing under ruff's E4/E7/E9/F set, census.py imports only stdlib, and no test pins the collector digest value
  • Diff size: 6 files, 117 changed lines, all in plugins/session-flow and .changes/session-flow, within the issue's 400-line and 15-file limits
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43214003413

Left out: the items under Not verified.

Related

#15539

Follow-ups

  • Pre-existing (advisory): **Advisory: no test covers the argparse error-text criterion.** (thread)

Merge-Risk: max=LOW demote=false head=5f6626da6efa8e52f739bc7c84943c8d43bd47b3 rubric=8.4.11 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 5f6626da6efa8e52f739bc7c84943c8d43bd47b3: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #15575

No security issues found.

I read every hunk of all 6 changed files. This is a refactor confined to plugins/session-flow and one changelog fragment:

  • Moved helpers. census.py now holds the shared helpers epoch and _positive. Their bodies match the copies removed from collect.py, friction_scan.py, sweep.py and audit-friction/scripts/friction.py. collect.py's duplicate store_dir is replaced by census.store_dir, which builds the same path.
  • Imports. The only new imports are stdlib (argparse, datetime, timezone). friction.py already imported census through its existing sys.path insert (friction.py#L50-L52), so no new load path is added.
  • Input handling. Timestamps from session records are still parsed with datetime.fromisoformat inside the same ValueError guard, and CLI integers still go through the same < 1 check. No new parsing, shell call, file path or network surface appears.
  • Scope of the change. No changed file matches a trusted-path glob. The diff touches no trust control, plugin manifest, workflow or token scope, and deletes no standing instruction.
  • PR text. The PR context contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 5f6626da6efa8e52f739bc7c84943c8d43bd47b3; the summary is in this lane's pull request comment.

claude-lane: claude-review

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 5f6626da6efa8e52f739bc7c84943c8d43bd47b3: read 6 of 6 changed file(s); 1 finding(s), 1 as inline comments.

Code review: #15575 (refactor: shared audit-sessions helpers in census.py)

I found no correctness problems. I read all 6 changed files in full and checked each moved helper against the copies it replaces:

  • census.epoch has the same body as the three deleted _epoch copies in collect.py, friction_scan.py and sweep.py. Each call site now goes through the census. module attribute. The _iso(epoch: …) parameter in collect.py does not shadow it.
  • census._positive has the same body as the three deleted copies. Its __name__ stays _positive, so argparse errors still read invalid _positive value: ….
  • census.store_dir has the same path as the deleted collect.store_dir. The tests already call census.store_dir.
  • Imports: none became unused. datetime and timezone are still used in collect.py (lines 182 and 860), friction_scan.py (line 194) and sweep.py (line 482). census.py adds argparse and datetime, timezone, which the new helpers need. The repository has no remaining reference to the deleted private names.
  • Changelog fragment: a bump: patch fragment with "Internal restructuring, no behavior change." matches the issue.

Closing issue #15539, acceptance criteria:

  • Each helper exists once in census.py and the four scripts use it: met.
  • Behavior unchanged, including argparse errors: met when read against the code, but no test would catch a regression in the argparse error text. Details in the inline comment.
  • Only the listed files edited; at most 400 lines and 15 files: met (6 files, all from the issue's list).
  • Ruff, the pytest suites, audit-friction.test.sh and ci-status green: I did not run these; this lane has no shell. The PR body lists them as left to CI. They are unverified here.

The PR body also notes one side effect: the collector digest hashes census.py and collect.py, so the next collect run re-ingests the stored sessions once. That is expected for any edit to those files and does not change the records.

I saw no embedded instructions in the PR context. No plugin manifest changed. This is the first review of this PR, so it is not limited to blocking findings.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

pr-unblock / address-feedback finished round 1 of max 4 on 5f6626d.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5f6626d

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-15575-5f6626da6efa8e52f739bc7c84943c8d43bd47b3, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 77d64f0 Nov 12, 2026
86 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15539-43214003413-1 branch November 12, 2026 12:32
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/session-flow/skills/audit-friction/scripts/friction.py 0 1 0 0 0 0
plugins/session-flow/skills/audit-sessions/scripts/census.py 2 2 0 0 0 0
plugins/session-flow/skills/audit-sessions/scripts/collect.py 1 0 0 0 0 0
plugins/session-flow/skills/audit-sessions/scripts/sweep.py 1 0 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/session-flow/skills/audit-sessions/scripts/census.py:83 other productive input-gap
plugins/session-flow/skills/audit-sessions/scripts/census.py:84 other productive input-gap
plugins/session-flow/skills/audit-friction/scripts/friction.py:621 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 77d64f0dd1a957819ecd6fd4cdc7c742461c70cd; 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.

Move the audit-sessions epoch, positive-int and store-dir helpers into census.py

0 participants