Skip to content

refactor(architecture): move split_object and field awk functions into lib split-object.awk - #15572

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-15564-43179679492-1
Nov 12, 2026
Merged

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #15564

Summary

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

The split_object and field awk functions that render-components.sh, landscape-record.sh and render-landscape.sh each defined now live once in plugins/architecture/lib/split-object.awk. render-components loads it with -f before its -f /dev/stdin program. The two landscape scripts keep the string form their awk calls need: since several pipe data on stdin, -f - cannot carry the program, so SPLIT_AWK becomes the lib text, an explicit $'\n', then the script's own heredoc functions. Each script keeps its own unquote, because landscape-record's copy keeps escapes as written and the other two decode them. No behavior change.

Not verified

  • render-components.test.sh, landscape-record.test.sh and render-landscape.test.sh were not executed: this lane's shell runs only the named wrappers. Left to the PR's CI.
  • shellcheck was not run locally (no wrapper for it in this lane). Left to the PR's CI.
  • tidy pass 5 (ai-slop): the detector script could not run in this lane, so only the rubric read of the one-line changelog fragment ran (no findings). Passes 1 to 4 ran with no edits.
  • ci-status green is a PR check, left to the PR's CI.
  • Review note, not changed (out of scope): if plugins/architecture/lib/split-object.awk were missing, render-components would exit 1 with 'could not read the graph', and the landscape scripts would fail in awk on an undefined function. The scripts already assume lib/ exists for record-layout.sh.

Fix

  • plugins/architecture/lib/split-object.awk: new file holding split_object and field, unchanged from the three copies, with a header naming its callers and contract.
  • plugins/architecture/skills/map-components/scripts/render-components.sh: removed the inline split_object and field, added the SPLIT_OBJECT_AWK path line, and passes -f "$SPLIT_OBJECT_AWK" before -f /dev/stdin.
  • plugins/architecture/skills/map-landscape/scripts/landscape-record.sh: the SPLIT_AWK heredoc now holds only unquote, and the lib text is prepended to it with an explicit newline, using the existing SCRIPT_DIR.
  • plugins/architecture/skills/map-landscape/scripts/render-landscape.sh: the SPLIT_AWK heredoc keeps unquote, arraylist, arraycount and md, and the lib text is prepended to it through a new SPLIT_OBJECT_AWK path line.
  • .changes/architecture/work-resolve-issue-issue-15564-43179679492-1-c755766c.md: new patch fragment, ### Changed, 'Internal restructuring, no behavior change.'

Verification

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

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

The run reports:

  • check-changelog-fragments: all 2 fragments valid (run before and after tidy).
  • check-changed-skills: map-components and map-landscape PASS, 0 errors (1 pre-existing body-length warning each).
  • check-affected: 13 passed, 6 skipped, over 5 changed files (run before and after tidy).
  • Fresh-context review subagent over the changed files: no correctness bugs found. It confirmed the program-text joins at every SPLIT_AWK use site, the -f lib -f /dev/stdin order, the relative lib paths, set -u ordering, and that the beside-script tests run the scripts in place.
  • Grep: no test or eval names split_object, field or SPLIT_AWK, and no file cites a line number in the three scripts.
  • Diff size: 5 files, about 294 changed lines, one area (plugins/architecture plus .changes/architecture).
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/43179679492

Left out: the items under Not verified.

Related

#15564

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

Security review: PR #15572 (head fb29ae1)

No security issues found.

I read every hunk of all 5 changed files. None of them match a trusted path. The diff touches no manifest, workflow, trust control, merge hold or standing instruction.

The change is a refactor. The same split_object and field awk functions were defined in three architecture-plugin scripts; they now live once in plugins/architecture/lib/split-object.awk:

  • render-components.sh now loads the shared functions with -f "$SPLIT_OBJECT_AWK", placed before its own -f /dev/stdin heredoc program.
  • landscape-record.sh and render-landscape.sh read the lib file's text and put it in front of their SPLIT_AWK program strings.

What I checked:

  • Where the awk path comes from. Both scripts build it from their own location: BASH_SOURCE[0], or the existing SCRIPT_DIR, plus a fixed ../../../lib/split-object.awk. Nothing from the environment or the user feeds it, so the scripts load no code they did not load before. The shared file sits inside the same plugin tree, at the same trust level as the scripts.
  • The shared awk text. It is unchanged from the three copies the diff removes. The data these functions parse still flows the same way as before, so this adds no injection surface.
  • Quoting. The heredocs keep their quoted 'AWK' delimiters, so the shell expands nothing in them. The joined string uses "$(<file)"$'\n'"$SPLIT_AWK", with no unquoted interpolation.
  • Changelog fragment. It is prose only.

critical-findings: 0

@github-actions

Copy link
Copy Markdown
Contributor

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

Code review: no findings.

This PR moves the duplicated split_object and field awk functions out of render-components.sh, landscape-record.sh and render-landscape.sh and into the new file plugins/architecture/lib/split-object.awk. I read every hunk of all 5 changed files.

What I checked:

  • Shared file: split-object.awk is the same code as the removed copies, character for character, with a header comment added.
  • render-components.sh: it now passes -f "$SPLIT_OBJECT_AWK" -f /dev/stdin, with the heredoc still feeding stdin. That order is right because the lib file holds only functions. The new path is built from BASH_SOURCE, the same way render-landscape.sh already finds lib/record-layout.sh. Nothing in the script runs cd before line 271.
  • landscape-record.sh: it reuses the existing SCRIPT_DIR (set at line 76), which is defined before line 241.
  • render-landscape.sh: it sets SPLIT_AWK at lines 227-228. Every awk call that uses SPLIT_AWK (lines 239, 528, 565 and 590) comes after that.
  • Joining the program text: $(<file) drops the lib file's trailing newline, and the explicit $'\n' puts it back, so the lib's last } and the script's own heredoc text (function unquote… or a # comment) end up on separate lines. The text that follows "$SPLIT_AWK" at each use site is unchanged, so the joins behave as before.
  • Each script's own unquote: each script keeps its own copy, as the issue asks. No function is now defined twice.
  • Tests: the three *.test.sh files run the scripts in place through $SCRIPT_DIR/..., so the relative path to lib/ resolves.

Closing issue #15564, acceptance criteria:

  • "split_object and field exist once … and the three scripts load it": met. Any test that runs one of the three scripts would fail if the lib could not be loaded.
  • "Behavior is unchanged": by my reading of the code, met; the moved code is identical and the program text is put together the same way. I did not run anything. The existing tests would catch a regression.
  • "The diff edits only the listed files": met. The 5 changed files are exactly the ones the issue lists.
  • "within 400 changed lines and 15 hand-edited files": met, at about 294 lines across 5 files.
  • "render-components.test.sh, landscape-record.test.sh and render-landscape.test.sh pass" and "ci-status is green": the author says these were not run and left them to CI. I could not check them here either.

Other notes:

  • No plugin manifest changed. The changelog fragment's bump: patch fits an internal refactor with no behavior change.
  • The two path-scoped rules that match these files (skill-bodies-state-current-rules.md and cost-claims.md) cover skill and agent body text, and nothing here falls under them.
  • None of the changed files is on a trusted path, and nothing in the PR text was addressed to this review.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for fb29ae1

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-15572-fb29ae1a69ded8f5f06cd69ca673cb5b853b9e3a, expires on 2026-12-12.

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 12, 2026
Merged via the queue into main with commit 6de037c Nov 12, 2026
65 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-15564-43179679492-1 branch November 12, 2026 08:30
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 6de037c760f3dd25299586e0f53efdeaae12b91a; 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.

Move the architecture split_object and field awk functions into one lib file

0 participants