Skip to content

refactor(harness-ops): simplify observability prune, clean and dashboard scripts - #15036

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14576

Summary

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

Simplified three of the seven listed observability files without changing behavior. prune-otel-store.sh gets a time_field helper shared by filter_file and line_sizes, a shorter resolve_repo_root, and byte caps computed once instead of at four call sites. clean.sh turns each value flag's --flag=value form into --flag value before one case per flag, which removes six duplicate arms, and reads find output with mapfile. build-dashboard.mjs passes asText to map directly and shares one messageOf helper between its two error paths. session-compare.sql, hook-latency.sh, hook-transcript-timing.sh and item-rollup.sh were reviewed and left unchanged: their remaining repetition (sql_path, store resolution, die) is shared with other files, and the issue puts deduping across files out of scope.

Not verified

  • Test suites (clean.test.sh, prune-otel-store.test.sh, build-dashboard.test.sh, claude-observability.test.sh) were not run here: this lane has no test runner wrapper. Left to the PR's CI.
  • ci-status green on the PR: a PR CI check, left to the PR's CI.
  • Tidy skipped its markdown passes 4 and 5 (docs-hygiene and ai-slop) on the changelog fragment, whose text the issue dictates word for word. Passes 1-3 ran over the code lines and found nothing more to change.
  • No changes to session-compare.sql, hook-latency.sh, hook-transcript-timing.sh or item-rollup.sh: no simplification was found that stays within one file. Their shared duplication (sql_path, store path resolution, die) belongs to the sub-epic's restructuring pass across files.

Fix

  • plugins/harness-ops/skills/observability/otel/prune-otel-store.sh: added a time_field helper used by filter_file and line_sizes, shortened resolve_repo_root to the same CLAUDE_PROJECT_DIR, then git toplevel, then pwd order, and computed hot_max_bytes and hot_total_max_bytes once in main instead of…
  • plugins/harness-ops/skills/observability/scripts/clean.sh: a pre-case turns --keep-days=, --hook-root=, --skill-usage-scope=, --skill-usage-dir=, --skill-usage-data-root= and --keep-skill-usage-days= into the two-argument form, so each flag has one case arm instead of two; the two find-to-array…
  • plugins/harness-ops/skills/observability/scripts/build-dashboard.mjs: texts() uses .map(asText), and runCheck and runBuild share a private messageOf(error) helper.
  • .changes/harness-ops/work-resolve-issue-issue-14576-42778917943-1-a32f6b56.md: new patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 25240fa:

  • 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.
  • check-changed-skills: observability PASS, 0 errors, 4 warnings, all about SKILL.md size and description length, none of which this change touches.
  • check-affected (run before and after tidy): 13 passed, 6 skipped (typos not installed, ruff had no .py files, validate-plugins and changed-skills subchecks that run code from the checked tree), over 4 changed files.
  • Fresh-context review subagent over git-read diff HEAD: found no behavior difference in prune-otel-store.sh, clean.sh or build-dashboard.mjs, including --flag= with an empty value, --flag=a=b, empty find output, set -e and set -u. Its only note was a possible low-confidence ShellCheck SC2311 info…
  • Grep: no harness-ops hook wiring references the changed scripts, no test reads their source text, and the names time_field and hot_max_bytes clash with nothing in the sourced prune-*.sh files.
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42778917943

Left out: the items under Not verified.

Related

#14576

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

Security review: PR #15036 (head 25240fa)

I found no security issues. I read every hunk of all 4 changed files. None of them matches a trusted-path glob, and none is a plugin manifest, a trust control or an instruction surface.

  • plugins/harness-ops/skills/observability/scripts/clean.sh: The new step rewrites a --flag=value argument as --flag value with set -- "${1%%=*}" "${1#*=}" "${@:2}". The value still lands in the same variable it did before, so nothing new reaches any variable.
    • Empty value: --keep-days= becomes two arguments, so need_value's $# -ge 2 check passes. The empty string then reaches the same downstream validation as before, which still rejects it before -mmin (require_nonneg_int, clean.sh#L147-L149).
    • mapfile: Replacing the while read loops with mapfile -t keeps the same newline-split arrays from the same find commands. Their depth, type and age limits are unchanged.
  • plugins/harness-ops/skills/observability/otel/prune-otel-store.sh:
    • time_field helper: It returns one of two fixed strings, and the awk -v values are the same as before.
    • resolve_repo_root: It keeps the same fallback order: CLAUDE_PROJECT_DIR, then the git toplevel, then the current directory.
    • Byte caps: They are now computed once from the same integers, then quoted.
  • plugins/harness-ops/skills/observability/scripts/build-dashboard.mjs: .map(asText) is safe here because asText is only given the item. The messageOf helper returns the same error text as the code it replaces.
  • .changes/...md: A changelog fragment, with no executable surface.

The PR context contains no embedded instructions aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15036, simplify the harness-ops observability scripts

No findings. I read every hunk of all 4 changed files and checked each simplification against the code it calls. None of them changes behavior.

prune-otel-store.sh

  • resolve_repo_root checks the same sources in the same order: CLAUDE_PROJECT_DIR, then git rev-parse --show-toplevel, then pwd. ${root:-$(pwd)} keeps the empty-string fallback.
  • The new time_field helper sees the same basename (${1##*/}) as the old inline test. filter_file and line_sizes pass it the same argument as before ($src / $1). The old local time_field variable is gone, so nothing hides the new function name.
  • hot_max_bytes / hot_total_max_bytes are now computed once (line 444). They still use the same hot_max_mb / hot_total_max_mb. Both values are checked against ^[0-9]+$ and reduced to base 10 at lines 354–370, and nothing reassigns them after line 370. Computing them early, even when present_files is empty, therefore can't hit a new arithmetic error.

clean.sh

  • The pre-case rewrite (set -- "${1%%=*}" "${1#*=}" "${@:2}") handles the edge cases the same way as before:
    • --flag=a=b still gives a=b.
    • --keep-days= (empty value) now goes through need_value. That passes, because $# >= 2, and require_nonneg_int still rejects the empty value with exit 2, the same result as the old arm.
    • Under set -u, "${@:2}" is safe with a single argument.
  • mapfile -t in place of the while read loops gives the same arrays for find's newline-ended output, empty output included. mapfile needs bash 4 or later; the script's header already says bash 5+.

build-dashboard.mjs

  • asText takes a single parameter (line 61), so .map(asText) ignores the index and array arguments map passes.
  • messageOf matches both inline expressions it replaces.

Closing issue #14576 acceptance criteria

  • Behavior unchanged: met, as far as reading the code shows. The PR body says the existing suites (clean.test.sh, prune-otel-store.test.sh, build-dashboard.test.sh) were not run and are left to CI. That claim comes from the author and I couldn't run them.
  • Only listed files plus a fragment edited: met.
  • Within 400 lines and 15 files: met.
  • ci-status green: the author left this to CI; I couldn't confirm it from here.
  • harness-ops fragment with bump: patch, ### Changed and the exact required line: met.

Other checks

  • Path-scoped rules: skill-bodies-state-current-rules.md and cost-claims.md match these paths. The change only moves one code comment into the new helper, which raises nothing under either rule.
  • No plugin manifest changed, and no paved-path or prior-findings items apply.
  • Embedded instructions: none in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 25240fa

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-15036-25240faec88e5c38cdc6c78715d7e0646320544c, 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 786d4a5 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14576-42778917943-1 branch November 10, 2026 09:33
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 observability harness-ops plugin code (2 of 3)

0 participants