Repository navigation
Description
Problem
The map-landscape record format is one repository object and one edge object per line. This is
documented and deliberate: landscape-record.sh:31-51 says it keeps the file diffable and parseable
without a JSON library.
The readers check only that "schema_version": 1 appears somewhere in the file, then match repository
lines with /^[[:space:]]*\{"name":/. That match appears at render-landscape.sh:154 (version check)
and render-landscape.sh:325, :597, :634, :648 (line matching), and at landscape-record.sh:357
and :362 in the drift path.
A record that is valid JSON but formatted differently (compacted to one line, or pretty-printed with
one key per line) therefore passes the version check and matches no repository line. The two readers
then fail as follows:
- Renderer: writes an empty landscape and exits 0. It prints
thin=yes, so the skill'sThin resultremedy (added in feat(architecture): map-landscape reports a thin landscape and names the richer view #4559) tells the user they picked the wrong tool, when the actual problem is
a record the reader cannot parse. The header metadata also falls back tounknown. - Drift check: reports every repository and edge as added. It adds a "NOT COMPARABLE ... posture
mismatch" note instead of saying the committed record could not be parsed.
This only affects records that were hand-written or reformatted. Records produced by the collector
always have the expected layout. Still, a committed landscape.json that someone reformats is a
realistic way to hit it.
Evidence
Verified this pass, in a scratchpad sandbox on main a6ba321:
- Created a copy of
docs/architecture/landscape.jsonwith all newlines removed (tr -d '\n'). - Rendered the original copy with
render-landscape.sh --record <file> --out <dir>. Output:
landscape: internal=13 external=94 drawn_systems=18 edges=108 drawn_edges=18 unresolved_edges=0 thin=no. - Rendered the single-line copy the same way. Output:
landscape: internal=0 external=0 drawn_systems=0 edges=0 drawn_edges=0 unresolved_edges=0 thin=yes, exit 0.landscape.mdcontains an empty
C4Contextblock, and its header reads "Generated on unknown from unknown". - Not tested: a pretty-printed record with one key per line. It is inferred to fail the same way,
because no line in it would start with{"name":. - Ran
landscape-record.sh --drift-against <single-line copy> .. It reported "added repository:
claude-code-plugins" plus every edge as "added edge", under a posture-mismatch note. The exit code was
not captured cleanly: the output was piped tohead, so the observed 141 is SIGPIPE. That the drift
check exits 3 is inferred from the script's exit contract (landscape-record.sh:72).
Proposed approach
Keep the line-oriented format; it is a deliberate choice. Make both readers refuse a record they cannot
parse, instead of reading it as empty:
- In
render-landscape.shand in the--drift-againstpath oflandscape-record.sh, after the
schema_versioncheck, check that the"repositories": [and"edges": [arrays either close on
the same line (empty arrays) or are followed by object lines of the expected shape. - A record that declares entries but matches no repository line fails with exit 1 and a message such
as "record is not in the one-object-per-line layout landscape-record.sh writes; regenerate it". This
reuses the existing "unreadable record" exit code.
Alternative: normalize any valid JSON into the line layout before parsing. Rejected, because it needs a
JSON parser, and the scripts' portability rule forbids jq and python (render-landscape.sh:59).
Files:
plugins/architecture/skills/map-landscape/scripts/render-landscape.sh,landscape-record.sh, and
their.test.shfilesSKILL.md, if the report wording changesplugins/architecture/.claude-plugin/plugin.json(patch bump) andCHANGELOG.md
Acceptance criteria
-
render-landscape.shgiven a single-line record exits non-zero with a message naming the layout
problem, and writes no artifacts. -
render-landscape.shgiven a pretty-printed record (one key per line) behaves the same way. -
landscape-record.sh --drift-againstgiven either shape exits 1 with the same kind of message and
prints no added or removed lines. - A record with genuinely empty
repositoriesandedgesarrays still renders, withthin=yes
and exit 0. - New cases in
render-landscape.test.shandlandscape-record.test.shfail before the fix and
pass after it. The existing cases stay green.
Constraints and gotchas
- Scripts use bash plus POSIX awk/grep/sed only: no jq, no
grep -P, no python. - The
render-landscape.test.shmarkdownlint case is known to fail on Windows hosts when mktemp puts
its path outside the repository's markdownlint config (noted in feat(architecture): map-landscape reports a thin landscape and names the richer view #4559). Linux CI is authoritative. - Bump the version and add a CHANGELOG entry in
plugins/architecture.
Context
Source: side finding recorded in the progress note of local handoff item
20260907-094157-architecture-mapping-skill-family-epic.md (retired with it). Found after PR #4559.
Sibling leftover from the same slice: #4554. The planned map-dependencies graph schema should avoid the
same failure mode (see that issue).
Activity
fix(architecture): refuse reformatted landscape records as empty (#4640…
refactor(architecture): one github.com remote parser and one record l…
fix(architecture): remediate the map-* family audit findings (#5392)