Skip to content

fix(cli): clean usage-error envelope; flow/outline accept FQN roots (#473 #474 #475) - #481

Merged
HumanBean17 merged 2 commits into
masterfrom
fix/jrag-473-474-475
Sep 13, 2026
Merged

HumanBean17 merged 2 commits into
masterfrom
fix/jrag-473-474-475

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

Fixes three reported CLI bugs. All three reproduce on master and are verified fixed end-to-end on the bank-chat fixture.

Fixes #473
Fixes #474
Fixes #475

#473 — CLI crash with a wrong option value

jrag dependents "X" --detail minimal produced a raw chained traceback and exit 1. Root cause: _EnvelopeArgumentParser routes argparse errors to main(), whose usage-error handler re-read --format/--detail from raw argv through a pre-parser that deliberately has no choices validation — the very token that triggered the error was fed to render(), raising ValueError inside the except block, outside every guard.

Fix: _FORMAT_CHOICES/_DETAIL_CHOICES are now shared constants (single source of truth for the real parser's choices= and for a clamp in the usage-error path). Invalid values now yield the clean status: error envelope, a terse stderr line, and exit 2 — for both --detail and --format. A drift-guard test (per the repo's enum-choices pattern) keeps the constants in sync with the render layer, which validates independently.

#474 — flow does not resolve method-level FQNs

flow_payload resolved its entry with hint_kind="route" only, and the resolver searches only the hinted kind — so method FQNs returned not_found even though callees resolved the identical FQN fine.

Fix: route resolution stays first (route path/topic behavior unchanged); a route not_found retries as a Symbol:

  • method/constructor FQN → breadth-first walk over CALLS (LadybugGraph.trace_symbol_flow, one frontier query per hop); each edge carries hops = minimum BFS distance (rendered hop= in text)
  • class/type FQN (class, interface, enum, record, annotation) → expands to declared method/constructor members (DECLARES) with a warnings[] note
  • file Symbol → clean error pointing at jrag outline (no silent empty flow)

A review pass caught that the initial retry swallowed route ambiguous results (a topic prefix like banking.chat. returned a false not_found instead of its candidate list); ambiguity now propagates immediately, with a regression test.

#475 — outline cannot find a class

_cmd_outline resolved its argument only as a path on disk, so an FQN fell through to file-not-found. An FQN (class or method) now resolves as a Symbol and outlines the declaring file — verified to return the identical symbol set as the file-path form. Identifier-like misses surface the resolve envelope (closest symbols, jrag search pointer); path-like misses keep the familiar file-not-found error. Ambiguous names surface their candidates (no silent pick).

Verification

  • New tests: graph-layer BFS semantics (min-hops, dedup, cycle safety), payload-boundary contract, CLI subprocess coverage for all three fixes plus ambiguity contracts and the render-flag drift guard.
  • Heavy golden suite (JAVA_CODEBASE_RAG_RUN_HEAVY=1): 16/16 byte-identical — the route flow output is unchanged.
  • Full suite: 2145 passed / 40 skipped; all 9 failures verified pre-existing or environmental on pristine master (bench grade service, .claude→.agents rename fallout in test_publish_skill_runbook, release_sh requires a clean tree).
  • Ruff: no new findings vs master (same-binary comparison).
  • Docs/help updated (en + ru); skills/ + agents/ artifacts re-synced (sync_agent_artifacts.py --check passes).

Reviewed by a three-scope reviewer team (CLI fixes / flow backend / docs-artifacts); the one Critical and all Important findings are addressed in this commit.

…473 #474 #475)

#473: an invalid --detail/--format value crashed the usage-error path with a
raw traceback — the handler re-read render flags from raw argv via a
choices-less pre-parser and fed the offending token to render(). Render-flag
choice sets are now shared constants and clamped before rendering (clean
envelope, exit 2).

#474: flow resolved entries with hint_kind=route only, so method-level FQNs
returned not_found although visible via outline/callees. A route not_found
now retries as a Symbol: method roots get a BFS CALLS walk (trace_symbol_flow,
edges carry minimum-distance hops), class/type roots expand to declared
method/constructor members (DECLARES) with a warning, file symbols are
rejected with a pointer to outline. Route resolution (incl. ambiguous
candidate lists) is unchanged — pinned by the heavy goldens (16/16
byte-identical).

#474 review fix: only not_found retries; route ambiguity propagates with its
candidates instead of a false not_found diagnosis.

#475: outline resolved <file> on disk only, so a class FQN hit file-not-found.
An FQN now resolves as a Symbol and outlines the declaring file (identical
symbol set to the path form); identifier-like misses surface the resolve
envelope, path-like misses keep the file-not-found error.

Tests: graph-layer BFS semantics, payload boundary, CLI subprocess coverage
for all three fixes + ambiguity contracts + render-flag drift guard.
Docs/help updated (en+ru); skills/agents artifacts re-synced.
The rename (f51b3d4) moved the skill to .agents/skills/publish-pip/ but
test_publish_skill_runbook kept reading .claude/skills/..., so all 6 tests
failed with FileNotFoundError on CI (master stayed green only because the
rename push ran a path-filtered 22s job that skipped the suite). Resolve the
current location first with a legacy .claude fallback for symlinked dev
checkouts.
@HumanBean17
HumanBean17 merged commit ced115f into master Sep 13, 2026
4 checks passed
@HumanBean17
HumanBean17 deleted the fix/jrag-473-474-475 branch September 13, 2026 13:51
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.

jrag outline problem jrag flow problem CLI crash with a wrong option

1 participant