Skip to content

fix(harness-ops): report moved keys and a missing file from the enabledPlugins normalizer - #10826

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-7960-40790167353-1
Oct 29, 2026
Merged

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

Conversation

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

Closes #7960

Summary

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

normalize-enabled-plugins.sh now prints normalized moved=K keys=N (and would-normalize moved=K keys=N under --check), and the report's Normalized row reads K of N keys moved, so one appended key in a 101-key map reads 1 of 101 keys moved. A missing --file prints missing-file keys=0 with exit 0 and renders as Normalized: skipped, no user settings file, never as already sorted. K is the fewest keys the reorder moves (N less the longest already-sorted subsequence), not the count of keys whose index changed as the issue body suggested: one appended key shifts every key after its sorted position, and a permutation can never change exactly one index, so that count could never produce the 1 of N keys moved golden the acceptance criteria ask for.

Not verified

  • normalize-enabled-plugins.test.sh and sync-run.test.sh were not executed: this lane runs only the named wrappers, so the suites and the new golden are left to the PR's CI (the issue's acceptance criterion names CI running both)
  • sync-run.sh was not changed: it stores the normalizer's line verbatim in the digest (normalize.output) and parses nothing, so the new forms need no reader change there
  • tidy ran with partial coverage. Simplify and comment passes found nothing to change. The markdown lines were read against write-for-agents and the ai-slop rubric with no edits. The ai-slop detector script and write-for-humans on the changelog fragment were not run, since this lane cannot execute plu
  • the new golden fixtures/render/normalized-one-key-moved.txt was written by hand from the installed-all-disabled golden plus the new row, because the suite could not run here; the PR's CI confirms it
  • the decision on the issue is a defaulted one (veto before merge), not a recorded decision; the missing-file behavior follows it and stays open to veto at review

Fix

  • plugins/harness-ops/skills/plugins/scripts/normalize-enabled-plugins.sh: adds moved_count (N less the longest sorted subsequence of keys) and prints moved=K beside keys=N on normalized and would-normalize; a missing --file prints missing-file keys=0 (exit 0) instead of already-sorted keys=0; the
  • plugins/harness-ops/skills/plugins/scripts/normalize-enabled-plugins.test.sh: replaces the old missing-file assertion with a missing-file keys=0 exit-0 case (with and without --check, file not created); updates the would-normalize/normalized expectations to carry moved=1; adds a one-appended-key c
  • plugins/harness-ops/skills/plugins/scripts/render-report.jq: adds a moved_count helper; the Normalized row renders K of N keys moved and the audit row K of N keys would move, with digests that lack moved= keeping the old text; adds a missing-file branch rendering `Normalized: skipped, no user se
  • plugins/harness-ops/skills/plugins/scripts/sync-run.test.sh: adds render checks for moved counts, missing-file in sync and audit, and the old-format fallback; adds a golden case that runs the real normalizer after an install over a four-key map with one out-of-place key and checks the digest, the so
  • plugins/harness-ops/skills/plugins/scripts/fixtures/render/normalized-one-key-moved.txt: new golden whose Normalized row reads 1 of 4 keys moved
  • plugins/harness-ops/skills/plugins/context/script-contracts.md: documents the normalizer's output lines, the moved count, and the missing-file result the same way the script header does
  • plugins/harness-ops/skills/plugins/context/sync-install-enable.md: the Never-silent bullet names normalized moved=K keys=N and the K of N keys moved row; a new bullet covers a missing user settings file
  • .changes/harness-ops/fix-normalizer-moved-keys-7960a1c4.md: harness-ops patch fragment (Fixed) for both changes

Verification

The runner ran each check from the base copy against 4590f58:

  • scripts/check-changelog-fragments.sh --check: passed

The run reports:

Left out: the items under Not verified.

Related

#7960

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

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 4590f58c1c051dfe764b183ffaa718344ebd92fa: 0 finding(s), 0 as inline comments.

No security issues found.

critical-findings: 0

I read the whole diff (8 files) and the PR context. None of the changed files match the trusted paths or touch a trust control, merge hold, token scope, kill switch, plugin manifest or instruction surface.

  • normalize-enabled-plugins.sh: the new moved_count runs a fixed jq program on the --file path, which is passed as a quoted argument. No shell or jq interpolation of file content, so there is no injection path.
  • Files and errors: the script writes no additional files, and the missing-file branch exits 0 before any write. A jq failure in moved_count would abort under set -e, but is_sorted has already parsed the same file, so a loud failure there is not a bypass.
  • render-report.jq: capture("moved=…") only extracts digits from the normalizer's own output line, and the strings it renders are fixed text plus digits.
  • Other files: the tests, golden fixture, docs and changelog fragment carry no security surface.

The PR text contains no embedded instructions aimed at the lane.

Spend: none.

@github-actions

Copy link
Copy Markdown
Contributor

claude-review reviewed 4590f58c1c051dfe764b183ffaa718344ebd92fa: 0 finding(s), 0 as inline comments.

No findings. I read the full diff, the PR context and the closing issue #7960. I could not run any tests: this session has no shell, so every check below is by reading the code.

Normalizer change (normalize-enabled-plugins.sh)

  • moved_count computes N minus the longest strictly increasing subsequence of the keys, using the same codepoint ordering as keys. I traced it by hand on the new test inputs and each gives the asserted value:
    • a,c,d,e,b gives moved=1 keys=5.
    • d,c,b,a gives moved=3 keys=4.
    • x,ai-slop,context-budget gives moved=1 keys=3.
  • The empty-map case yields 0, so jq -e does not trip.
  • missing-file keys=0 exits 0 and is checked with and without --check. The test also checks that the file is not created.

Renderer (render-report.jq)

  • moved_count falls back to null when moved= is absent, so older digests keep the "N keys reordered" text. $norm defaults to "", so capture cannot error on null.
  • The missing-file branch renders "Normalized" or "Would normalize" depending on $audit.
  • sync-run.sh contains none of the normalizer's output tokens, so it stores the line verbatim, as the PR says. No reader change is needed there.
  • The new golden is hand-written. Its Normalized row sits after Installed and before Divergences, which matches the emit order in render-report.jq (lines 222–246), so it should pass, but only CI can confirm it.

New sync-run.test.sh case

  • The user_settings.json it writes is not overwritten by setup_case, which only writes it when the file is absent.
  • SYNC_RUN_NORMALIZE is set in EXTRA_ENV, and EXTRA_ENV comes after the default stub in run_sync's env call, so it overrides the stub.
  • The map alpha@market1, delta@other, gamma@other, beta@other gives LIS 3, so moved=1 keys=4, as asserted.

Closing issue #7960 criteria

  • The issue asked for "the number of keys whose index changed". The PR instead reports the fewest keys the reorder moves. That deviation is explained in the PR body and the script header. It is the only definition that can produce the required 1 of N keys moved golden, so I did not flag it.
  • Every other criterion is met and covered by a test: the moved-count case, the missing-file case with the old line-74 assertion replaced, the no user settings file render check, the 1 of 4 keys moved golden, header and script-contracts.md wording, and the changelog fragment.
  • The CI-passes criterion is not confirmed here.

Not checked: the manifest items do not apply, since no plugin.json or marketplace.json changed. I did not run the changelog-fragment check; the fragment is a valid bump: patch with a ### Fixed section. No trusted-path files are touched and nothing spends money, so there is no hold.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 4590f58c1c051dfe764b183ffaa718344ebd92fa.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit e5f45bc Oct 29, 2026
43 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-7960-40790167353-1 branch October 29, 2026 02:42
@github-actions

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 7, survived 0, timeout 0, no coverage 0, invalid 0, not run 1.
Covered-code score 100%; mutation score 100%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/harness-ops/skills/plugins/scripts/normalize-enabled-plugins.sh 7 0 0 0 0 1

The run's summary has the full report.

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.

fix(harness-ops): report moved keys and a missing file from the enabledPlugins normalizer

0 participants