Skip to content

refactor(architecture): simplify dependency-graph.sh - #14805

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

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

Conversation

@melodic-automation-lanes

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

Copy link
Copy Markdown
Contributor

Closes #14405

Summary

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

Simplified dependency-graph.sh with no behavior change (128 lines added, 255 removed). The four near-identical JSON serializers became one json_object key/value helper. Array sorting moved into emit_array, which removed sort_lines and four collection loops. Two helpers, record_value and add_project_node, replace the name lookup and node naming that each reader repeated. The Python and Rust workspace-member glob matching, which were line-for-line copies apart from Rust skipping a "." member, are now one add_member_edges function with a skip-dot flag. The header comment that --help prints, the flags, exit codes and the JSON byte layout are unchanged.

Not verified

  • dependency-graph.test.sh and render-components.test.sh were not run: this lane can run only the named wrappers, so the suites are left to the PR's CI
  • tidy not run: the change is 383 changed lines in the script, above the 300-line tidy cutoff
  • ci-status green is left to the PR's CI

Fix

  • plugins/architecture/skills/map-dependencies/scripts/dependency-graph.sh: json_node/json_edge/json_cycle/json_finding replaced by json_object. sort_lines removed: emit_array now sorts its items and takes the text after the bracket directly. The files list is read with mapfile. Added record_value,…
  • .changes/architecture/work-resolve-issue-issue-14405-42648143537-1-04a4c420.md: patch fragment, ### Changed, "Internal simplification, no behavior change."

Verification

The runner ran each check from the base copy against 7b1c81b:

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

The run reports:

Left out: the items under Not verified.

Related

#14405

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

Security review: PR #14805, refactor(architecture): simplify dependency-graph.sh

No security issues found.

What I checked. I read every hunk of both changed files:

  • plugins/architecture/skills/map-dependencies/scripts/dependency-graph.sh: a refactor of the local dependency-graph script.
  • .changes/architecture/…-04a4c420.md: a patch changelog fragment.

Neither file matches a trusted-path glob. The diff touches no trust control, no workflow, no plugin manifest and no instruction surface such as CLAUDE.md, a skill body or a hook list.

Security-relevant points in the refactor:

  • JSON output escaping. json_object passes every value through the existing json_escape. Every key is a literal from inside the script. So escaping is the same as in the four removed serializers, and a crafted manifest name, path or evidence string cannot break out of the JSON document.
  • Glob matching. add_member_edges keeps the earlier node_glob_regex check before any glob reaches [[ =~ ]], and it still treats a refused glob as unread. The members, excludes and candidate lists are the same data as before. Candidates are still limited to manifests the script found under the root.
  • No new execution path. No new eval, command substitution of manifest content or file write. cycles_truncated is now a literal false where it used to be a variable that always held false.
  • Variable scope. The helpers declare their own locals, so moving the Rust and Python workspace code into one function leaks no state between readers.

Pull request text. Nothing in it tries to steer the review: no text asking to pass the PR, skip a check, drop a finding or post elsewhere.

Spend. None.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

Code review: refactor(architecture): simplify dependency-graph.sh (#14805)

No findings. I read both changed files in full (the changelog fragment and dependency-graph.sh), along with the unchanged head code the changed lines call.

Behavior-equivalence checks

I compared each hunk with the code it replaces. I did not run anything: I had no shell.

  • JSON serializers → json_object. Node fields still come out as id,name,path,ecosystem,kind, then namespace (omitted when empty), then test:"yes". Edge order (from,to,kind,status,evidence), finding order (kind,path,evidence) and cycle {"id":…} are unchanged. Every value still goes through json_escape.
  • emit_array sorting. The items are still sorted with LC_ALL=C sort, and an empty array still prints []. The text after the bracket is still , / , / , / none. The old sort_lines dropped empty lines, but no JSON object line can be empty, so nothing changes. cycles_truncated is still the literal false.
  • add_member_edges. It matches the removed Python py_read_workspace and the Rust inline loop line for line. The one difference is the ././ skip, now behind skip-dot (Rust) / keep-dot (Python), which matches the old split. The unguarded "${py_files[@]}" / "${cargo_files[@]}" expansions only run inside loops over those same non-empty arrays, so set -u is safe.
  • add_project_node / record_value. These keep the old name fallback: the manifest's name, else the folder's basename, else the root's basename. setup.py and Gradle nodes pass "" and fall back as before.
  • Removed locals. dir, name, label, base, owner and the Rust member-loop locals are no longer assigned anywhere in read_node, read_go, read_python, read_rust or read_jvm, so none of them leaks into globals. owner survives only as py_read_req's own local.
  • Error handling. The script runs set -uo pipefail without -e, so moving the cycle awk from cycle_raw="$(…)" into process substitution, and the name lookups from assignments into arguments, changes no exit path.
  • mapfile for files. The script already needs bash 4 (declare -A). find never prints an empty relative path, so keeping empty lines changes nothing.

Closing issue #14405 acceptance criteria

  • Behavior unchanged: met, as far as I can tell from reading the code (above). dependency-graph.test.sh asserts on the JSON output, including the namespace/test node fields (e.g. its node-fields tree), so a regression there would fail a test.
  • Diff edits only the listed file plus a changelog fragment: met.
  • Within 400 changed lines: met (128 added, 255 removed).
  • ci-status green: not something this lane can check. The PR body says the test suites were not run by the authoring lane and are left to CI; that is author-claimed and I did not verify it.
  • Fragment: met. It has bump: patch, ### Changed, and the line "Internal simplification, no behavior change."

Other notes

  • Path-scoped rules under .claude/rules/ that match plugins/*/skills/** (skill-bodies-state-current-rules, cost-claims) cover skill and agent prose and cost claims. The script's comments break neither rule.
  • I found no embedded instructions in the PR context or prior-findings files. This is the lane's first review of this PR, so it was not blocking only.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

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

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 7b1c81b

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-14805-7b1c81b7556b4bec14db91c75820b7e846a64a2e, 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 fa51dd3 Nov 9, 2026
50 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14405-42648143537-1 branch November 9, 2026 19:00
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Post-merge mutation testing

Killed 5, survived 2, timeout 0, no coverage 0, invalid 0, not run 0.
Covered-code score 71%; mutation score 71%.

File Killed Survived Timeout No coverage Invalid Not run
plugins/architecture/skills/map-dependencies/scripts/dependency-graph.sh 5 2 0 0 0 0

Surviving mutants

Location Operator Disposition Cause
plugins/architecture/skills/map-dependencies/scripts/dependency-graph.sh:512 ROR productive no-assertion
plugins/architecture/skills/map-dependencies/scripts/dependency-graph.sh:668 LCR productive no-assertion

The run's summary has the full report.

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 dependency-graph.sh architecture plugin code

0 participants