Skip to content

refactor(harness-ops): simplify telemetry-upsert and machine-profile scripts - #15010

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14573

Summary

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

telemetry-upsert.sh's argument parser had twelve near-identical case arms, two per value-taking flag. One set_opt helper now stores each flag's value, and two arms (the space form and the --flag= form) replace the twelve, cutting about 40 lines. The script also falls back to target_id for new_id in a single expansion. In profile.sh, discover() and apply() now declare their loop and scratch variables (line, m, d, doc, hit, scope, verdict, value) local in one place, and the option parser's dead *) ;; arm is folded into the --option arm. Flags, their parsing (values containing '=' included), outputs, messages and exit codes are unchanged. The header comments that --help prints are untouched.

Not verified

  • telemetry-upsert.test.sh and profile.test.sh were not run here (this lane runs no test runner; check-affected did not list them). Left to the PR's CI.
  • ci-status green is a PR CI check; left to the PR's CI.
  • ShellCheck and typos were not run locally (not available in this lane); left to the PR's CI.
  • tidy: passes 1-3 (simplify, comment deletion, generated-code residue) ran over the code lines and found nothing to change. Passes 4-5 (docs-hygiene, ai-slop) were skipped for the changelog fragment, because the issue's acceptance criteria fix its only line word for word.
  • In profile.sh apply(), three jq calls per hit could become one, but merging them changes the output for non-string or newline-ending values, so it was left as is.

Fix

  • plugins/harness-ops/skills/lanes/scripts/telemetry-upsert.sh: collapsed the twelve per-flag parse arms into a set_opt helper and two arms; new_id falls back to target_id via ${new_id:-$target_id}
  • plugins/harness-ops/skills/machine-profile/scripts/profile.sh: declared the discover/apply loop variables local up front; merged the --option arm into the inner case's required default arm
  • .changes/harness-ops/work-resolve-issue-issue-14573-42771255465-1-28d18b88.md: patch fragment, ### Changed, 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 589d33f:

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

The run reports:

Left out: the items under Not verified.

Related

#14573

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

Security review: PR #15010 (head 589d33f)

I found no security issues. This was a full review of all 3 changed files, reading every hunk.

What I checked

  • plugins/harness-ops/skills/lanes/scripts/telemetry-upsert.sh: argument parser collapse
    • The new set_opt helper stores the same six flags into the same variables.
    • Its *) default arm, which sets APP_SLUG, can only be reached with --app-slug, because the outer arms list the six flags explicitly. No other input reaches it.
    • The space form still calls require_value.
    • In the = form, ${1%%=*} keeps the flag name and ${1#*=} keeps everything after the first =, which is how the base parsed it. Values containing = are handled as before.
    • No value gets new interpolation. The $REPO / id checks that come later, before any gh api URL is built, are unchanged.
  • telemetry-upsert.sh, new_id="${new_id:-$target_id}"
    • target_id is always assigned before this line (telemetry-upsert.sh L410), so set -u cannot trip.
    • The fallback id still has to pass the numeric check [[ "$new_id" =~ ^[0-9]+$ ]] (L491) before it reaches repos/$REPO/issues/comments/$new_id.
    • Behaviour is the same as before.
  • plugins/harness-ops/skills/machine-profile/scripts/profile.sh
    • The local declarations were moved or added, which only narrows variable scope.
    • The inner case default arm (*) OPTIONS+=("$2")) can only be reached with --option, because the outer arm admits only --data-dir | --prerequisites | --option (L388–L394).
    • Nothing is newly accepted.
  • .changes/... fragment: prose only.

No trust control, token scope, merge hold, kill switch, plugin manifest, workflow or standing instruction is touched. No trusted-path glob matches a changed file. The PR context file has no embedded directives aimed at this lane.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15010, simplify telemetry-upsert.sh and profile.sh (head 589d33f)

I read every hunk of all 3 changed files, plus the unchanged code each changed line depends on. I found nothing blocking and nothing advisory.

How each change was checked

  • The new set_opt helper and the merged parse arms in telemetry-upsert.sh (L198-L219).
    • For the space form, require_value still runs before shift 2, so a flag given last with no value still exits 3.
    • For the --flag=value form, ${1%%=*} keeps only the flag name. ${1#*=} keeps the whole value, including any = inside it (for example --marker=a=b stores a=b). That matches the old per-flag arms.
    • The helper's *) fallback is reached only by --app-slug, because both callers pass just the six listed flags.
    • Unknown flags still reach the outer *) arm.
  • new_id="${new_id:-$target_id}" (L485) under set -u. target_id is always assigned at top level (L410), so expanding it can't trip set -u. On the create path target_id is empty, which leaves an empty id exactly as before, and the verify_fail check on the next line still runs.
  • profile.sh discover() and apply() local declarations (L217, L345).
    • line, m, d, doc, hit, scope, verdict and value are not read anywhere outside these functions. Making them local changes nothing.
    • gh_fact has its own local line (L177). It runs in a command substitution, so it doesn't interact with discover's line either.
    • Moving local m d doc up to the top of discover() (L217) changes nothing observable.
  • The inner option-parser case in profile.sh (L390-L394). The outer arm admits only --data-dir, --prerequisites and --option, so the new *) arm can only receive --option. The removed *) ;; arm could never be reached.

Closing issue #14573, acceptance criteria

  • "Behavior is unchanged": met as far as reading the code can tell. telemetry-upsert.test.sh and profile.test.sh exist next to the scripts, and telemetry-upsert.test.sh calls the --flag= form in 4 places, so it would catch a parser regression. I did not run either test (this lane has no shell). The PR says it ran checks and a review subagent; that claim is unverified here.
  • "The diff edits only the listed files … and changelog fragments": met.
  • "Within 400 changed lines and 15 hand-edited files": met (3 files, about 70 lines).
  • "ci-status is green": left to the PR's CI. This lane cannot check it.
  • Changelog fragment with ### Changed and "Internal simplification, no behavior change.": met. The fragment's bump: patch fits a change with no behavior difference.

No plugin manifest changed. No .claude/rules glob matched a changed file. None of the changed files is on a trusted path. Neither the PR body nor the issue contains any embedded instruction aimed at the review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 589d33f

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-15010-589d33f57cfbea21d7132dfddb69c8cbe208bb6a, 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 ba98bc2 Nov 10, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14573-42771255465-1 branch November 10, 2026 07:33
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit ba98bc20b728b173ee10d3e070c37b4f6ec254ba; 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 lanes and machine-profile harness-ops plugin code

0 participants