Skip to content

refactor(architecture): simplify the map-landscape collector scripts - #14812

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14411

Summary

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

Simplified the three map-landscape scripts without changing what they print, exit with or accept. portfolio-facts.sh now uses one helper to append comma-separated evidence (replacing four copies and two nested functions) and one helper to build the capped JSON dependency arrays (replacing two collect loops and two emit loops). It also chooses the target-framework evidence once after the runtime switch and drops four single-use manifest variables. reference-edges.sh reads the origin remote once instead of up to twice and derives the owner and self slug from that value inline, removing three wrapper functions. landscape-record.sh replaces an inline comment that repeated the header's rationale with a pointer to it. The --help header blocks are untouched, so --help output is unchanged.

Not verified

  • Shell test suites (landscape-record.test.sh, portfolio-facts.test.sh, reference-edges.test.sh) were not run: this lane's check-affected runs without --tests and the lane cannot execute repository scripts directly; left to the PR's CI
  • ci-status green is a PR CI check, left to the PR's CI
  • tidy pass 5: the ai-slop detector (detect.sh) cannot run in this lane, which only runs named wrappers; the one-line fragment got a manual rubric read with no findings
  • Known theoretical divergence in reference-edges.sh: a git remote URL with an embedded newline before a '/' (e.g. https: //github.com/acme\n/repo) used to yield owner 'acme' and now yields 'acme\n'; git itself cannot use such a URL, so this was not guarded

Fix

  • plugins/architecture/skills/map-landscape/scripts/portfolio-facts.sh: added json_name_array and append_csv helpers; replaced the duplicated evidence/dependency-source appends, the two dependency collect loops and the two JSON emit loops with them; collapsed the go/rust/jvm/ruby/php probes; set…
  • plugins/architecture/skills/map-landscape/scripts/reference-edges.sh: replaced origin_path, remote_owner_segment and remote_slug with one origin read and inline owner/self_slug derivation (one git remote call instead of up to two)
  • plugins/architecture/skills/map-landscape/scripts/landscape-record.sh: shortened an inline comment that restated the header's reason for dropping path
  • .changes/architecture/work-resolve-issue-issue-14411-42648188195-1-49a4808e.md: patch fragment, ### Changed with "Internal simplification, no behavior change."

Verification

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

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

The run reports:

  • check-changelog-fragments: all 8 fragments valid (run before and after tidy)
  • check-changed-skills: map-landscape PASS, 0 errors, 1 pre-existing warning (SKILL.md body length, untouched)
  • check-affected: 13 passed, 6 skipped, 0 failed over the 4 changed files (includes shellcheck on the changed scripts), run before and after tidy
  • fresh-context review subagent: traced every hunk against HEAD; no behavior difference for any realistic input. Only divergence found needs a git remote URL with an embedded newline before a '/' (old code's $(...) capture stripped it from the owner/slug segment, new code does not); left as is, since…
  • tidy-diff (code-tidying): pass 1 removed one redundant blank-line guard in json_name_array (grep -v already filters blank lines); passes 2-5 found nothing to change
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42648188195

Left out: the items under Not verified.

Related

#14411

Merge-Risk: unrated reason=no-rating

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 f2dd6f9cc1dcb6e01ef3509b36baa49552929b09: read 4 of 4 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14812, map-landscape collector scripts refactor

No security issues found.

I read every hunk of all 4 changed files. None of them matches a trusted path. The diff touches no trust control, workflow, plugin manifest or standing instruction.

  • portfolio-facts.sh: two new helpers, json_name_array and append_csv, replace duplicated code.
    • json_name_array still sends every dependency name through json_escape before it goes into the JSON record. The old [[ -n ]] || continue guard is gone, but grep -v '^[[:space:]]*$' already drops blank lines, so the output is unchanged and escaping still covers every item.
    • append_csv writes through printf -v "$1". It is only called with hard-coded variable names (tooling_evidence, runtime_evidence, dep_sources, dev_dep_sources), so no outside value reaches the variable name.
    • The target-framework rework only reads files from the repository being scanned, as before.
  • reference-edges.sh: the origin remote is now read once, and the owner and self_slug are worked out inline. Both still come only from github_remote_path on the origin URL, and --owner still takes precedence.
    • The one difference the PR description notes (a remote URL with a newline in it) changes which bare owner/repo tokens count as edges in the generated landscape record. That is data classification in a local analysis script. No credential, lane or code-execution path depends on it.
  • landscape-record.sh: a comment-only change.
  • .changes/ fragment: changelog text only.

No skip-gate item applied; I reviewed the full diff. No embedded instructions in the PR context. Prior findings: this was the first review of this pull request (blocking only: no).

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: PR #14812, a refactor that simplifies the map-landscape collector scripts

No findings. I read every hunk of all 4 changed files. None of them matches a trusted-path glob.

I traced each change against the head file and the shared helpers it calls, without running anything:

  • portfolio-facts.sh append_csv: it produces the same , separators as the four inline appends and the two nested note_* functions it replaces. Every variable it is given is initialised before use: runtime_evidence and tooling_evidence at L545-546, and dep_sources and dev_dep_sources at L717-719. So ${!1} is safe under set -u.
  • portfolio-facts.sh json_name_array: it runs the same filter pipeline as the old collect loops (drop blank lines, sort -u, then head -$DEP_CAP). Those loops also checked for empty lines, but grep -v already removes them, so dropping that check changes nothing. An empty input still gives [].
  • go, rust, jvm, ruby and php probes: find_first returns 0 only when FIND_HIT is non-empty (L204-206), so removing the [[ -n ... ]] guards is safe. The removed jvm_manifest, ruby_manifest and php_manifest are not read anywhere else. go_manifest and rust_manifest are kept for the later target-framework and dependency reads. The script has no set -e, so the longer && chains don't change the exit status.
  • Target framework: tf and tf_source are now reset for each repository, and the evidence is picked once after the case. The old code read tf only in branches that had just assigned it, so the output is the same, including the rust fallback from rust-version to edition. Removing the -n "$dotnet_proj" check is safe because an empty string never matches *.*proj.
  • reference-edges.sh: git now runs once, even when --owner is given. Given an empty string, github_remote_path returns 1 (lib/github-remote.sh L40), so when there is no origin both owner and self_slug stay empty, as before. The inline owner and slug logic matches the removed remote_owner_segment and remote_slug, including the case where the segment is empty.
  • landscape-record.sh: only a comment changed. The header it now points to does explain the path drop (L49).

Closing issue #14411, criterion by criterion:

  • Behaviour unchanged: no difference found for any realistic input. The PR body itself notes the one edge case, a remote URL with an embedded newline, which git cannot use anyway.
  • Edits only the listed files plus a fragment: met.
  • Under 400 lines and 15 files: met.
  • Fragment: bump: patch, ### Changed, with the required line. Met.
  • ci-status green: I can't see it from this lane.

The existing portfolio-facts.test.sh, reference-edges.test.sh and landscape-record.test.sh suites cover these output paths. The author says those suites were not run by the resolving lane and were left to CI. That is the author's claim and I haven't checked it.

No plugin manifest changed, so there are no manifest lines. Nothing in the PR context tried to give the review instructions. There are no prior findings or settled threads.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@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 68e3b7a Nov 9, 2026
49 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14411-42648188195-1 branch November 9, 2026 19:07
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-landscape architecture plugin code

0 participants