Skip to content

refactor(architecture): simplify map-containers collect and render scripts - #15013

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14402

Summary

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

Simplified collect-containers.sh and render-containers.sh without changing their outputs, flags or exit codes on any normal input. collect-containers.sh now builds every JSON object with one json_object helper and folds the repeated join, evidence-append and Sdk-match code into the join_lines, append_evidence and sdk_is helpers. It collapses the store-image case to one printf, keeps its work files in one mktemp -d directory under a single trap, and sorts in place with sort -u -o. render-containers.sh works out each container's description and element, and the list of edges the diagram draws, once instead of separately in the likec4 and c4-plantuml branches. Net: 123 lines added, 170 removed.

Not verified

  • collect-containers.test.sh and the eval scaffolds were not run: this lane runs only the named wrappers, so no test can execute here. Left to the PR's CI.
  • Failure-path change: if mktemp -d fails, collect-containers.sh now exits 1 with 'cannot create a temporary directory'. Before, each mktemp failed separately and the script carried on with empty paths. This is a deliberate guard, and no normal input reaches it.
  • Tidy proposal not applied: the '# append_evidence ...' helper comment mostly restates its four lines (class A candidate). The comment-only proof script change-shape.sh cannot run in this lane, so the comment was kept.
  • Tidy pass 5 (ai-slop:audit fix): the deterministic detector detect.sh cannot run in this lane, so only the rubric read ran on the changelog fragment and found nothing. No findings file was written.
  • The untracked dotfiles in the checkout root (.bashrc, .bash_profile, .gitconfig, .idea, .mcp.json, .profile, .ripgreprc, .vscode, .zprofile, .zshrc) were not created by this run. They look like sandbox mount placeholders and were left untouched; they are not part of this change.
  • ci-status green on the PR is a PR CI check and cannot be checked here.

Fix

  • plugins/architecture/skills/map-containers/scripts/collect-containers.sh: added json_object, join_lines, append_evidence and sdk_is helpers. They replace emit_container, the hand-built module and edge objects, three copies of the join awk, two copies of the evidence-append awk and the repeated Sdk…
  • plugins/architecture/skills/map-containers/scripts/render-containers.sh: the container description and C4 element, and the drawn uses-edges (rel_from, rel_to, rel_ev), are computed once before the dialect branches. Both the likec4 and c4-plantuml branches read them and print byte-identical lines.
  • .changes/architecture/work-resolve-issue-issue-14402-42771234099-1-6e127046.md: new patch fragment from new-changelog-fragment, body '### Changed' and '- Internal simplification, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 22 fragments valid (run before and after tidy and the review fixes)
  • check-changed-skills: map-containers PASS, 0 errors, 2 warnings about SKILL.md body length, which this change did not touch
  • check-affected: 13 passed, 6 skipped, over 3 changed files (run before and after the review fixes)
  • fresh-context review subagent read the full diff against HEAD and the test file. Normal input: no behavior difference, and no assertion in collect-containers.test.sh breaks. It confirmed two failure-path differences, both fixed: a failed mktemp -d would have written work files at /, now guarded…
  • tidy (code-tidying:tidy-diff) over all 33 changed hunks: no further edits
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42771234099

Left out: the items under Not verified.

Related

#14402

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

Security review: PR #15013 (head fecb38f)

No security issues found. I read every hunk of all 3 changed files. None of them matches a trusted path, and none touches a trust control, a merge hold, a manifest or a standing instruction.

What changed: a refactor of the map-containers skill's local collector and renderer scripts, plus a changelog fragment.

What I checked:

  • Temp files (collect-containers.sh L182-183): the 16 separate mktemp files are now paths inside one mktemp -d directory, removed by one trap 'rm -rf "$work"' EXIT.
    • The directory is private and created by mktemp itself. The script stops through die (defined at L71, before this point) if creation fails, so no work file can land at an empty or predictable path.
    • $work is always set before the trap's rm -rf runs.
    • This is no less safe than the base, and slightly safer.
  • Path normalization (normalize_inside): the hand-written join loop is now joined="${out[*]-}". The function still sets local IFS=/ (L117), so the parts are still joined with /. The segment handling that rejects .. is unchanged, and so is the empty-result return 1.
  • JSON output: the new json_object helper passes every value through the existing json_escape. The keys are fixed text. Escaping is the same as in the removed emit_container and the hand-built objects it replaces.
  • Diagram output (render-containers.sh): the descriptions, elements and edges are now worked out once. They still pass through the same safe() calls before printing in both diagram formats, so no unescaped text reaches the output.
  • Other changes (append_evidence, sdk_is, sort -u -o, reusing $work/parsed on each pass): these move or collapse logic and add no new injection surface. Values reach awk through -v as before.

PR context: it holds no embedded instructions aimed at this lane. Prior findings: none, so this was a full review, not blocking only. Native skip gate: did not apply, because the scripts parse repository content.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: PR #15013, a refactor of the map-containers collect and render scripts

No blocking or advisory findings. I read every hunk of all 3 changed files and checked the changed lines against the head files.

Checked for behaviour equivalence (closing issue #14402, "Behavior is unchanged")

  • json_object: the key order matches the old code for every object. Containers are id, name, kind, technology, store_kind, summary, evidence, matching emit_container. Modules are container, name, path, evidence. Edges are from, to, kind, via, evidence. Values are escaped the same way.
  • normalize_inside: "${out[*]-}" joins on / because the function sets local IFS=/ at line 117. The - default keeps an empty array safe under set -u.
  • sdk_is and the Functions check: the conditions are the same as before, only reordered. The AzureFunctionsVersion awk check gives the same exit status as before, because an unset found means !found is 1.
  • The store-image case: an empty leaf now falls to *) store_kind="" and then reaches the -z "$leaf" branch, so it produces the same rows as the old "" arm. The store_kind it sets is overwritten by the later read, so it leaks nowhere.
  • Work files in one mktemp -d directory:
    • Every file the script appends to with >> or tests with -s is either pre-created by touch or created fresh: $listen.map, $ep_edges (written once, inside its if), $hits.grouped and $deploy.tmp.
    • $parsed is rewritten with > on each loop pass, and queue is truncated with : >.
    • The rm -f lines it removes ran only after each file's last read, so dropping them changes nothing.
  • sort -u -o and the dropped -s guards: an empty input still gives an empty output file, as before. module_body and edge_body end up empty either way.
  • render-containers.sh:
    • Building calias and idalias in one loop is safe, because uniq depends only on earlier calls.
    • The pre-built rel_* list and the cdesc and cel arrays print the same lines in both dialects.
    • In the none dialect, the edge loop now also runs. It only adds keys to idalias, which nothing reads with in.
  • Failure path: a failed mktemp -d now exits 1 with a message. This is a new failure path that the PR's "Not verified" section states; exit 1 matches the documented exit codes, and no normal input reaches it.

The issue's acceptance criteria

  • Behaviour unchanged: met, as checked above. collect-containers.test.sh exercises these paths (store images, Sdk kinds and dialect output), so it could fail if they broke. I did not run it: this lane has no shell. The author also says it was not run and leaves it to CI.
  • Edits only the listed files plus a changelog fragment: met.
  • Size limit: met. The PR reports +123/-170 lines across 3 files.
  • Fragment: .changes/architecture/…6e127046.md has bump: patch, a ### Changed heading and the required line.
  • ci-status green: cannot be checked from this lane.

Plugin manifests: none changed. Paved paths: this lane resolved no standards index rows for these files. Prior findings: none, and this is not a blocking-only review. I found no embedded instructions in the PR context.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Unattended merge: native auto-merge leaves this pull request unarmed at head fecb38f259ba8759703ce24ed784702d215356d4. No person needs to act: a lane clears this reason, and the next scheduled run judges it again.

pr-merge's gate refuses its verifier verdict (verify:missing)

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fecb38f

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-15013-fecb38f259ba8759703ce24ed784702d215356d4, 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
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 10, 2026
@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 5a23f26 Nov 10, 2026
75 of 76 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14402-42771234099-1 branch November 10, 2026 07:57
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 5a23f26b8cf646c0408d8bca6761665435a1aa34; 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 map-containers architecture plugin code

0 participants