Skip to content

refactor(harness-ops): simplify the observability OTEL store scripts and queries - #15250

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14574

Summary

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

Simplified five of the seven listed harness-ops OTEL files without changing their behavior. cc-otel.sql computes the logs trace/span struct cast once in the attrs CTE instead of twice. item-rollup.sql drops an inner COALESCE that the final SELECT's COALESCE already covers. prune-collector-lifecycle.sh folds three copies of the PowerShell service call into one service_ps helper and flattens wait_collector_gone's polling loop. prune-compact.sh reuses keep_prompts in place of two inline copies of its test and moves the duplicated duckdb error-capture block from cold_counts and cold_glob_counts into a duckdb_cold_read helper. prune-filter.awk computes prefix_len once in BEGIN and converts secs to a number once. hook-latency.sql and net-probe.sh are unchanged. Folding the store-dir getenv expression into a macro was left alone because DuckDB evaluates macro default values when the macro is defined (read https: //duckdb.org/docs/2.0/sql/statements/create_macro.html), so moving the getenv call into a helper could change when the cold macros resolve the store path. Function names that other files call (default_stop, default_start, default_running, cold_counts, cold_glob_counts, the cc_* macros and views) are unchanged.

Not verified

  • DuckDB-backed test suites (cc-otel.test.sh, prune-otel-store.test.sh, item-rollup.test.sh) were not run directly in this lane, which allows no duckdb or test-runner command; left to the PR's CI
  • ci-status green is a PR CI check; left to the PR's CI
  • hook-latency.sql and net-probe.sh not changed: the available simplifications (reading the promoted hook_event/total_duration_ms columns, dropping the fd-3 close in the no-curl fallback) would change edge-case behavior
  • tidy-diff partly skipped: pass 2 could not run change-shape.sh to prove comment deletions, so the one candidate (the restating comment above service_ps in prune-collector-lifecycle.sh:109) stays as a proposal. Passes 4 and 5 did not run their skills' scripts (detect.sh, digest-guard.sh), which this…

Fix

  • plugins/harness-ops/skills/observability/otel/cc-otel.sql: cc_logs_from computes r::STRUCT(timeUnixNano, traceId, spanId) once as an attrs column (ids) and reads trace_id/span_id from it; the explanatory comment moved with the cast.
  • plugins/harness-ops/skills/observability/otel/item-rollup.sql: the tokens CTE drops the redundant inner COALESCE(..., 0); the final SELECT's round(COALESCE(k.x, 0)) still yields 0.
  • plugins/harness-ops/skills/observability/otel/prune-collector-lifecycle.sh: new service_ps helper backs default_stop/default_start/default_running; wait_collector_gone uses a single rc capture plus case instead of if/else/continue.
  • plugins/harness-ops/skills/observability/otel/prune-compact.sh: compact_dropped and cold_prompt_notice call keep_prompts; new duckdb_cold_read helper holds the mktemp/stderr-capture/CR-strip block cold_counts and cold_glob_counts duplicated.
  • plugins/harness-ops/skills/observability/otel/prune-filter.awk: prefix_len computed once in BEGIN; secs converted to a number once.
  • .changes/harness-ops/work-resolve-issue-issue-14574-42949592677-1-55b88c4c.md: patch fragment, '### Changed' with 'Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 18 fragments valid (run before and after tidy)
  • check-changed-skills: observability PASS, 0 errors, 4 pre-existing warnings about SKILL.md size and description length (run before and after tidy)
  • check-affected: 13 passed, 6 skipped over 6 changed files (run before and after tidy)
  • fresh-context review subagent over the whole diff: found no behavior difference in any of the five files, and no test asserts on the changed lines
  • read https: //duckdb.org/docs/2.0/sql/statements/create_macro.html: a macro's default value expression is evaluated at definition time, not at run time, which is why the store-dir getenv expression was not moved into a macro
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42949592677

Left out: the items under Not verified.

Related

#14574

Merge-Risk: max=HIGH demote=true head=5b259c3e7002cdf559a815b35c062b3d2263a777 rubric=8.4.1 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-review reviewed 5b259c3e7002cdf559a815b35c062b3d2263a777: read 6 of 6 changed file(s); 0 finding(s), 0 as inline comments.

Code review: no findings. I read every hunk of all 6 changed files and the unchanged code each changed line calls. No changed file matches a trusted-path glob.

I checked each refactor for any change in behavior:

  • cc-otel.sql: The struct cast that was written twice now runs once as the ids column in the attrs CTE. The final SELECT reads FROM attrs, so ids.traceId and ids.spanId give the same values. The explanatory comment moved with the cast and still describes what the code does.
  • item-rollup.sql: The tokens columns are read only at lines 104–107, and each one is already wrapped in round(COALESCE(k.x, 0)). Dropping the inner COALESCE changes no output.
  • prune-collector-lifecycle.sh:
    • service_ps builds the same PowerShell command as before. In default_running, \$_ is still a literal $_ after the second expansion.
    • require_windows_service still runs first.
    • The exit code still comes from powershell.exe, as the last command in the function.
    • The wait_collector_gone rewrite (rc=0; collector_running || rc=$?; case) keeps the old meanings: 0 means still running, so it polls again; 1 returns 0; anything else returns 2; once POLL_MAX_TRIES is reached it returns 1.
  • prune-compact.sh:
    • keep_prompts (line 28) runs exactly the inline test it replaces.
    • duckdb_cold_read keeps the same duckdb_cold arguments (its dir argument comes first), the closed stdin, the error text, the temp-file cleanup and the CR stripping. Both callers pass the same "what" text the old error messages printed.
  • prune-filter.awk: tf is passed with -v (see the invocation comment and prune-otel-store.sh), so it is already set when BEGIN runs. secs is compared only as a number, so converting it once gives the same results.

Closing issue #14574 acceptance criteria:

  • Behavior unchanged: met, judged by reading the code; I ran nothing. The author says the DuckDB-backed suites (cc-otel.test.sh, prune-otel-store.test.sh, item-rollup.test.sh) were not run in their lane and are left to CI. That claim and CI's result are unverified here.
  • Only listed files and fragments edited: met.
  • Within 400 lines and 15 files: met.
  • ci-status green: not checkable from this lane.
  • Fragment: met. .changes/harness-ops/…55b88c4c.md has bump: patch, ### Changed and the required line, in the same format as the existing harness-ops fragment.

Path-scoped rules: skill-bodies-state-current-rules.md and cost-claims.md match these paths. Neither is broken: the code changes add no new claims, and the moved comment still matches the code.

There is no embedded instruction text in the PR context.

@github-actions

Copy link
Copy Markdown
Contributor

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

Security review: PR #15250 (refactor of the harness-ops observability OTEL scripts)

I found no security issues in this change.

I read every hunk of all 6 changed files. None of them match a trusted path. This is the lane's first review of the PR: the prior-findings file shows 0 earlier heads and blocking only: no. No plugin manifests changed. Nothing in the diff deletes or narrows a standing instruction, and nothing touches a trust control.

What I checked:

  • prune-compact.sh: the prompt-scrub privacy control. Two inline tests of CC_OTEL_COLD_KEEP_USER_PROMPTS were replaced with calls to keep_prompts. At head that helper is [[ "${CC_OTEL_COLD_KEEP_USER_PROMPTS:-0}" == "1" ]] (prune-compact.sh#L28), which is the same test with the same default of off. Prompts are still scrubbed from the cold tier by default. The new duckdb_cold_read helper passes its arguments through quoted "$@", so its SQL strings are the same as before and no new interpolation is added.
  • prune-collector-lifecycle.sh: the PowerShell call. The new service_ps puts $1 into the -Command string. Its only callers are the three default_* functions, each of which passes a fixed literal containing '$COLLECTOR_SERVICE_NAME', interpolated exactly as in the base. No new input reaches PowerShell, and require_windows_service still runs first. wait_collector_gone keeps its return codes: 0 when the service stopped, 2 when the query errors, and 1 when it is still running after POLL_MAX_TRIES. A query error still never counts as a stop.
  • cc-otel.sql: the logs view. The by-name struct cast moved into the attrs CTE as ids, and it still holds only timeUnixNano, traceId and spanId. The body is not serialized, and the final SELECT lists its columns by name, so the view shows no extra columns.
  • item-rollup.sql and prune-filter.awk. These are arithmetic and COALESCE simplifications with no security surface. In the awk script, the tf variable is already available in BEGIN.
  • The changelog fragment. It is plain text.

No embedded directives appear in the PR context. This PR needs no extra paid usage.

critical-findings: 0

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 5b259c3

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-15250-5b259c3e7002cdf559a815b35c062b3d2263a777, 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 70e22e3 Nov 11, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14574-42949592677-1 branch November 11, 2026 04:03
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 70e22e348e74061983e757ed51fdd47022dffb40; 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 observability harness-ops plugin code (1 of 3)

0 participants