fix(cli): pad the kind column in search, callers, callees and impact - #314
Conversation
The human output of search, callers, callees and impact lays a row out as
`{kind:<12}{name}`, upstream's `kind.padEnd(12) + name`. NodeKind's Display
wrote its name with `write_str`, which ignores the formatter's width, so every
row ran together: `functionadd`, ` functionrunDemo:3`, `import./math`.
NodeKind, EdgeKind, Language and ReferenceSubkind now format through
`Formatter::pad`, which honours width, fill and alignment and never truncates a
name longer than the width. JSON output is unchanged.
The cross-process lock probes in index_lease and store_state_gates always tried the lock with SHORT_DEADLINE (80 ms), whatever bound the caller passed; the bound only limited how long the parent waited for the child. The deadline is set before the child opens and validates the lock file, so on a loaded Windows runner a probe of a free lock could report TIMED_OUT. Main's CI on c03fcbd failed that way in current_writer_is_state_gated_retains_lease_and_stamps_the_exact_owned_value. The child now reads its lock bound from the parent: SHORT_DEADLINE where the lock is held and TIMED_OUT is expected, CHILD_WAIT where it is free. The three index_lease probes that expected ACQUIRED with SHORT_DEADLINE now use CHILD_WAIT. A test-only pre-acquire delay reproduces the slow child: the new probe tests fail on the old helpers and pass now.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 603286d1bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // search, callers, callees and impact print `{kind:<12}{name}` like upstream's | ||
| // `kind.padEnd(12) + name`. Without padding the rows read `functionadd`. |
There was a problem hiding this comment.
Document the new padded text rows
This establishes a byte-level human-output contract for search, callers, callees, and impact, but the commit leaves docs/cli.md unchanged. Document the padded kind-column layout in that canonical page so the public CLI behavior and its compatibility expectations are recorded alongside the implementation.
AGENTS.md reference: AGENTS.md:L117-L119
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #314 +/- ##
=======================================
Coverage 95.07% 95.07%
=======================================
Files 198 198
Lines 108998 109014 +16
=======================================
+ Hits 103631 103649 +18
+ Misses 5367 5365 -2
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
- READMEs (both languages): a viewer capture under the header, a "Visual (preview)" point, a Browser viewer section with the Flow and Map views, a Community section with GitHub Issues and the WeChat Official Account 六月水蓝, and the website in the documentation list. docs-check now requires the two new sections in both mirrors. - Website: a community page in both languages and the Official Account's QR code on both home pages (public/community/, the same image as the pt-tools and Voltip sites). - Quick start: step 5 shows the real output of search, callers, callees and impact, now that the kind column is padded (#314). Co-authored-by: CodeGraph Test <codegraph@example.invalid>
The release record for #314: the release PR merge and its tag SHA, the workflow run, the published digest, and the black-box acceptance against v0.53.2, plus dated entries for the padded kind column and for the stand-in executable warm-up in #317. Current alignment lists v0.53.3. Co-authored-by: CodeGraph Test <codegraph@example.invalid>
Summary
Two fixes found while publishing the website.
fix(cli): pad the kind column in search, callers, callees and impact
The human output of
search,callers,calleesandimpactlays a row out as{kind:<12}{name}, which isupstream's
kind.padEnd(12) + name.NodeKind'sDisplaywrote its name withwrite_str, which ignores theformatter's width, so every row ran together. On the mini fixture, v0.53.2 prints:
and
impactprintsfunctionrunDemo:3,fileapp.ts:1andmethodincrement:8.NodeKind,EdgeKind,LanguageandReferenceSubkindnow format throughFormatter::pad, which honourswidth, fill and alignment and never truncates a longer name. Output written without a width (
to_string(), theJSON output, the index) is byte-identical, because
padwith no width or precision writes the string as is.test(store): give lock probes the caller's bound
The cross-process lock probes in
index_leaseandstore_state_gatesalways tried the lock withSHORT_DEADLINE(80 ms), whatever bound the caller passed; the bound only limited how long the parent waited for the child.
acquire_filechecks the deadlinebefore its first
try_lock.TIMED_OUT.c03fcbd(run 37135369551, attempt 1) failed exactly that way, in Windows Tests:current_writer_is_state_gated_retains_lease_and_stamps_the_exact_owned_valueatstore_state_gates.rs:1063,left: "TIMED_OUT" right: "ACQUIRED". The re-run passed.The child now reads its lock bound from the parent:
SHORT_DEADLINEwhere the lock is held andTIMED_OUTis expected;CHILD_WAITwhere the lock is free.The three
index_leaseprobes that expectedACQUIREDunderSHORT_DEADLINEnow useCHILD_WAIT. No productcode changes.
Verification
display_honours_width_and_alignment("function|"instead of"function |");search_human_result_line_pads_the_kind_to_twelve_columns;text_rows_pad_the_kind_to_twelve_columns, which runs the real binary on the mini fixture:search,callers,calleesandimpactrows;exclusive_probe_acquires_a_free_lock_from_a_slow_childandprobes_acquire_a_free_lock_from_a_slow_child,which use a test-only 300 ms pre-acquire delay to stand in for the slow Windows child. Both reported
TIMED_OUTfor a free lock.make pre-cion the clean head603286d(rustc 1.98.0): 4,365 Rust tests passed and 0 failed, 569frontend tests passed, docs-check OK, clippy
-D warningsclean, archive smoke passed.🤖 Generated with Claude Code