Skip to content

refactor(architecture): simplify the map-data collect and render scripts - #14803

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14404

Summary

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

Simplified collect-data.sh and render-data.sh without changing their outputs, exit codes, written files, printed text or flags. In collect-data.sh, write_record now takes only status, reason, tier and tool and loops over the six arrays, whose row files are all named $TMP/<key>.tsv. Three copies of the awk field() function are now one AWK_FIELD program prefix behind a keep_rows helper. Other changes: a case statement replaces the subshell token picks, a clear_drawn helper replaces three repeated truncation blocks, a no-op duplicate add_mech call and an unused awk -v variable are gone, and two stale comment blocks are rewritten to match what the code does. In render-data.sh, nkey is reset inside take_array, a redundant nested if is gone and a one-use variable is inlined.

Not verified

  • collect-data.test.sh (the black-box test of both scripts) was not executed: this lane runs only the named wrappers, so the suite is left to the PR's CI
  • shellcheck was not run directly (no wrapper for it in this lane); the subagent review expects no new warnings and check-affected passed
  • ci-status green is a PR check left to the PR's CI
  • tidy pass 2 (comment deletions): change-shape.sh cannot run in this lane, so no deletion could carry its COMMENT-ONLY proof; proposal: the one-line comment above clear_drawn in collect-data.sh mostly restates the function body
  • tidy pass 5: the ai-slop detector (detect.sh) cannot run in this lane; the rubric read of the fragment found no tells, and no findings file was written

Fix

  • plugins/architecture/skills/map-data/scripts/collect-data.sh: write_record takes 4 args and loops over the arrays; empty_tsvs replaced by a loop; clear_drawn helper; case-based cardinality token; loop variable renamed pair -> entity; dropped the no-op add_mech before the prisma-flag refusal and…
  • plugins/architecture/skills/map-data/scripts/render-data.sh: nkey reset moved into take_array; redundant nested condition in the entity selection removed; one-use colflag inlined
  • .changes/architecture/work-resolve-issue-issue-14404-42648086721-1-a912a7b2.md: patch fragment, ### Changed, 'Internal simplification, no behavior change.'

Verification

The runner ran each check from the base copy against 8c8549a:

  • 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 tidy)
  • check-changed-skills: map-data PASS, 0 errors, 2 pre-existing size warnings on SKILL.md (unchanged by this diff)
  • check-affected: 13 passed, 6 skipped over 3 changed files (run before and after tidy)
  • fresh-context subagent review of the whole diff against HEAD for behavior differences (local scoping, awk concatenation and ternary semantics, the removed add_mech no-op, temp names, render-data nkey move): no findings
  • git-read diff --numstat HEAD: 2 script files, 199 changed lines; with the fragment 3 files, within the issue's 400-line and 15-file limit
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42648086721

Left out: the items under Not verified.

Related

#14404

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

Security review: PR #14803

I found no security issues.

Scope: I read all three changed files in full:

  • plugins/architecture/skills/map-data/scripts/collect-data.sh
  • plugins/architecture/skills/map-data/scripts/render-data.sh
  • the changelog fragment under .changes/architecture/

None of them matches a trusted-path glob. The PR changes no trust control, plugin manifest, workflow or standing instruction.

What I checked:

  • The new AWK_FIELD prefix and keep_rows helper. The awk program is built from a fixed single-quoted string joined to another fixed string. No outside input becomes awk code. Data reaches awk only through -v variables, and every value comes from the script itself: the key names tool and evidence, $winner_tool, and $ext, which a case statement sets to one of four values.
  • Temporary files. keep_rows writes "$1.keep" and then moves it over "$1". Every $1 is one of the row files inside the mktemp -d directory, which the EXIT trap deletes. No new path takes a value from outside the script.
  • write_record. It now builds $TMP/$key.tsv from a fixed list of six keys, so it reads the same files the old positional arguments passed. The JSON values still go through json_escape.
  • Cardinality case and the clear_drawn helper. Both produce fixed strings or empty fixed files. Neither runs a command on outside input.
  • render-data.sh. The changes are internal to awk (moving the nkey reset, removing an if that repeated the outer condition, inlining a variable). None of them changes how input is parsed or what the script rejects.

Not covered: whether the refactor keeps the old behavior, including removing the add_mech call before the prisma refusal. That is a correctness question for the code-review lane, not this one.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14803 (refactor map-data collect/render scripts)

No findings. I read every hunk of all 3 changed files. I checked each refactor against the head file and against the base code the diff removes, looking for any change in behavior.

Checked in collect-data.sh:

  • write_record arguments. It now takes 4 arguments and loops over $TMP/<key>.tsv. The six row-file variables (MECH, MODS, ENTS, ATTRS, RELS, MISMATCHES) are all $TMP/<key>.tsv with the same key names (lines 203–208), and the loop keeps the same order. sep adds the same ,\n between arrays as before. Every call to write_record/refuse happens after TMP is set.
  • Removed add_mech prisma. prisma_flag can only be set by parse_prisma, which runs only when prisma.txt is non-empty. In that case add_mech prisma … has already run (line 331), and add_mech skips a name that is already there (line 239). So the removed call never did anything.
  • Cardinality case. case "$kind/$optional" gives the same four tokens as the old if/ternary. kind is only ever one-to-one or one-to-many, so a / inside it cannot cause a false match.
  • AWK_FIELD and keep_rows. AWK_FIELD and the program body join into one awk argument. -v key is shadowed by field()'s own key parameter, so the lookup is unaffected. The contains ? … : … comparison matches the old string-equality and index(ev, ext) > 0 checks, including when ext is empty. The -v rels that was dropped is not used anywhere in the mismatch awk program.
  • Loop variable rename. Renaming pair to entity collides with no other variable.

Checked in render-data.sh:

  • nkey. nkey is a global and take_array is its only writer, so resetting it at the top of the function gives the same result as resetting it at each call site.
  • Entity selection. The removed inner if had the same condition as the outer for … if, so dropping it changes nothing.
  • colflag. Inlining it into the printf gives the same output.

Closing issue #14404 acceptance criteria:

  • Behavior unchanged: met, as far as I can tell from reading the code. scripts/collect-data.test.sh exists as a black-box test of both scripts. The author says it was not run in their lane; I did not run it either, because this lane has no shell.
  • Diff limited to the listed files plus a fragment: met.
  • Within 400 lines and 15 files: met.
  • Fragment: met. It is bump: patch with ### Changed and "Internal simplification, no behavior change."
  • ci-status green: not verified. That is left to the PR's CI.

The verification steps in the PR body are the author's claims; I did not run them.

No plugin manifests changed, no files under .claude/rules/ apply, and no changed file matches a trusted-path glob.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 8c8549a

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-14803-8c8549a8d2a4caf4fd55c0cbc4fa23d28f769f33, 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 fafb10a Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14404-42648086721-1 branch November 9, 2026 17:18
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 4, survived 3, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 57%; mutation score 57%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/architecture/skills/map-data/scripts/collect-data.sh 3 2 0 0 0 0
plugins/architecture/skills/map-data/scripts/render-data.sh 1 1 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/architecture/skills/map-data/scripts/collect-data.sh:1233 SBR productive no-assertion
plugins/architecture/skills/map-data/scripts/collect-data.sh:1413 SBR productive no-assertion
plugins/architecture/skills/map-data/scripts/render-data.sh:130 SBR productive input-gap

The run's summary has the full report.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit fafb10ac9ba41f0d2afb726e05c1151cfaf3a870; 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-data architecture plugin code

0 participants