Skip to content

refactor(architecture): simplify the map-deployment collector and the Azure and CloudFormation readers - #14810

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14407-42648174536-1
Nov 9, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14407

Summary

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

Simplified the three listed map-deployment scripts without changing their behavior: 67 lines added and 128 removed. In collect-deployment.sh, one SECTIONS array now drives the nine record files: truncation at startup, the JSON emit order in write_record, and the final sort -u. add_tool sets the shipped/unshipped flags itself, so the 13 assignments beside its calls are gone. A run_reader helper replaces three copies of the build-the-file-list, run-awk, check-the-flag code for the Terraform, Bicep/ARM, CloudFormation and Pulumi readers. Two intermediate sort -u passes over the diffs file are gone, since nothing reads that file before the final sort -u. In azure-reader.awk, unused parameters and locals are removed and a one-use variable is inlined. In cloudformation-reader.awk, resolve_param's branches are one if/else chain with a single RES_SEC assignment. Design choice: a refusal reason a reader flags now goes through a per-run flag file named for that run's unreadable reason, not a file shared between tools. This changes nothing, because a raised flag refuses and exits at once. I also tried replacing the Compose reader's own image and replica diff loops with deployment-diff.awk's container_diffs(). The pre-PR review found that container_diffs() creates the replica_of entry it is about to test, so a service declared in only one environment with replicas would gain an extra replicas diff row. I reverted that part, and the Compose diff loops are unchanged.

Not verified

  • I could not run collect-deployment.test.sh: this lane runs only the named wrappers, and check-affected's output does not say whether that suite was among its 13 passed checks. It is left to the PR's CI.
  • The ai-slop detector (detect.sh) could not run in this lane; I read the one-line changelog fragment against the rubric by hand and found no tells.
  • Pre-existing bug, outside this issue's scope and left as is: deployment-diff.awk container_diffs() reads replica_of[a,c] and replica_of[b,c] before its membership test, which creates the missing entries. The Kubernetes, Terraform, Azure and YAML readers that call it can therefore emit a…
  • ci-status green: left to the PR's CI.

Fix

  • plugins/architecture/skills/map-deployment/scripts/collect-deployment.sh: added the SECTIONS key/file array, which drives initial truncation, the write_record emit loop and the final sort -u loop. refuse() truncates in a loop. add_tool() sets shipped/unshipped and drops the per-call flag…
  • plugins/architecture/skills/map-deployment/scripts/azure-reader.awk: dropped the unused tokenize() parameter f, the unused compute_ref() local p, and the unused map_scope() locals type and img; inlined the one-use nm in map_scope().
  • plugins/architecture/skills/map-deployment/scripts/cloudformation-reader.awk: resolve_param() is one if/else chain with a single RES_SEC assignment, not two early returns.
  • .changes/architecture/work-resolve-issue-issue-14407-42648174536-1-7897a0c9.md: new patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against c87fc14:

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

The run reports:

  • check-changelog-fragments: all 7 fragments valid (run before and after the review fix)
  • check-changed-skills: map-deployment PASS, 0 errors, 2 warnings about SKILL.md size that this change did not touch
  • check-affected: 13 passed, 6 skipped over 4 changed files (run before and after the review fix)
  • fresh-context review subagent over the whole diff: found one real behavior change (container_diffs() adds spurious Compose replicas rows); I reverted it. It confirmed the rest unchanged: SECTIONS key order and separators, add_tool flag parity for every former assignment, no reader of the diffs file…
  • tidy-diff (code-tidying) over the changed lines: no edits; the comments in the changed lines state reasons or constraints, so none was deleted
  • git-read diff --numstat HEAD: 67 added, 128 removed across the 3 listed files, plus a 7-line fragment
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42648174536

Left out: the items under Not verified.

Related

#14407

Merge-Risk: max=MEDIUM demote=false head=c87fc1480bfbb2417b554b7e6a18ac8ff5a0403d rubric=8.2.0 rater=claude-opus-5-5 checker=claude-opus-5-5

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

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Security review: PR #14810

I found no security issues in this pull request. I read every hunk of all 4 changed files, and none of them matches a trusted path. Nothing in the change touches a trust control, a workflow, a token, a merge hold or a plugin manifest.

What I checked:

  • Secret redaction in cloudformation-reader.awk (resolve_param). The two early returns used to set RES_SEC = sec. Both now reach the shared line RES_SEC = (sec || index(r, "{{resolve:") > 0). In those branches r is unresolved("{Ref:" name "}"), which returns "unresolved:{Ref:<name>}" (yaml-rows.awk:380). The new line therefore sets RES_SEC to the same value as before, or marks more values secret, never fewer. RES_OK = 0 from unresolved() is kept. Redaction is not weakened.
  • Removed locals in azure-reader.awk. type, img and nm are gone from map_scope's locals and p from compute_ref's. In awk, removing a local that is still used would make it a global and could leak a value between calls. I read both function bodies: map_scope (L525-572) no longer uses type, img or nm, and compute_ref (L480-497) never uses p. No unintended globals appear. tokenize's dropped f parameter is unused, and its one caller was updated.
  • The run_reader helper in collect-deployment.sh. The flag file path $TMP/$2.flag and the extra awk options come only from literals written in the script, never from repository content. The repository file paths are still passed as ./$rel array elements after the options, the same as before. No new injection or path surface appears. The refusal reasons (terraform-unreadable, bicep-/arm-unreadable, cloudformation-unreadable, pulumi-unreadable) match the base. add_tool still runs json_escape on name, shipped and evidence.

The PR context file contains no embedded instructions aimed at the lane. The changelog fragment is prose only.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14810 (refactor of the map-deployment collector and the Azure/CloudFormation readers)

No findings. I read every hunk of all 4 changed files. I checked each claimed behavior-preserving change against the unchanged code it calls.

What I checked

  • SECTIONS array in collect-deployment.sh: the keys are in the same order as the old emit_array calls, and the ,\n separators come out the same way (no separator before index 0). The truncate and final sort -u loops go over the odd indices, which hold the same nine files as before. write_record declares i local, and it runs inside a $( … ) subshell, so the loop counter can't clobber anything at the top level.
  • add_tool setting shipped/unshipped itself: every call with yes used to be followed by shipped=1, and every call with no by unshipped=1. Three calls had no flag assignment beside them: live (line 216) and containers (lines 226 and 977). Each of them is followed at once by refuse, which exits, so the new unshipped=1 there is never read. Moving the shipped=0/unshipped=0 initialization earlier changes no result for the same reason.
  • run_reader: the refusal reasons are the same as before (terraform-unreadable, bicep-unreadable/arm-unreadable, cloudformation-unreadable, pulumi-unreadable). The old Azure block was also gated on [[ -s azure.txt ]]. Dropping that gate is safe, because add_tool bicep and add_tool arm are always paired with a write to azure.txt. So the list is never empty when the grep gate passes, and awk never falls back to reading stdin. The CloudFormation and Pulumi gates are unchanged: they were tool-name greps before too. The -v tool=… options now come after -f options; gawk, mawk and BSD awk all accept mixed option order before the operands. Because each run now has its own flag file, the old shared az-flag/yaml-flag files are gone. That changes nothing, since any raised flag refuses and exits.
  • Removing the two intermediate sort -u passes over $DIFFS: no script reads the diffs file before the final sort. The awk readers only append to it (no getline from it), and refuse truncates it before writing. Since sort -u is idempotent over a union, the final output is the same.
  • azure-reader.awk: f is not referenced in tokenize, p is not referenced in compute_ref, and type/img are not referenced in map_scope. So removing them leaks no globals. Inlining nm keeps the order in which show() and node() are evaluated.
  • cloudformation-reader.awk resolve_param: the two early-return branches used to set RES_SEC = sec. They now fall through to RES_SEC = (sec || index(r, "{{resolve:") > 0). Here r is "unresolved:{Ref:" name "}" (unresolved() in yaml-rows.awk), and a CloudFormation parameter name can't contain {{resolve:, so the result is the same.

Closing issue #14407, acceptance criteria

  • Behavior unchanged: met, by my reading of the code. collect-deployment.test.sh already covers these refusal reasons and readers heavily, so a regression would make it fail. I did not run it (no shell). The author also reports it as not run.
  • Edits only the listed files plus a fragment: met.
  • Within 400 changed lines and 15 files: met (about 67 added and 128 removed, 4 files).
  • ci-status green: not something I can check. It is left to CI.
  • Fragment: met. .changes/architecture/… has bump: patch, ### Changed, and the exact required line.

The author's verification claims (check-affected, the changelog and skill checks) are author-claimed and I did not verify them. The path-scoped rules matching plugins/*/skills/** (skill-bodies-state-current-rules, cost-claims) cover skill and agent prose and have no criterion these script edits hit. No plugin manifests changed. I found no embedded instructions in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for c87fc14

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-14810-c87fc1480bfbb2417b554b7e6a18ac8ff5a0403d, expires on 2026-12-09.

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 9, 2026
Merged via the queue into main with commit 9aa1be0 Nov 9, 2026
62 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14407-42648174536-1 branch November 9, 2026 19:01
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 map-deployment architecture plugin code (1 of 2)

0 participants