Skip to content

fix(cli): pad the kind column in search, callers, callees and impact - #314

Merged
sunerpy merged 2 commits into
mainfrom
fix/cli-kind-column
Oct 3, 2026
Merged

sunerpy merged 2 commits into
mainfrom
fix/cli-kind-column

Conversation

@sunerpy

@sunerpy sunerpy commented Oct 3, 2026

Copy link
Copy Markdown
Owner

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, callees and impact lays a row out as {kind:<12}{name}, which is
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. On the mini fixture, v0.53.2 prints:

functionadd
  src/math.ts:1
import./math

and impact prints functionrunDemo:3, fileapp.ts:1 and methodincrement:8.

NodeKind, EdgeKind, Language and ReferenceSubkind now format through Formatter::pad, which honours
width, fill and alignment and never truncates a longer name. Output written without a width (to_string(), the
JSON output, the index) is byte-identical, because pad with 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_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, and acquire_file checks the deadline
    before its first try_lock.
  • So on a slow runner, a probe of a free lock could report TIMED_OUT.
  • Main's CI on c03fcbd (run 37135369551, attempt 1) failed exactly that way, in Windows Tests:
    current_writer_is_state_gated_retains_lease_and_stamps_the_exact_owned_value at store_state_gates.rs:1063,
    left: "TIMED_OUT" right: "ACQUIRED". The re-run passed.

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 the lock is free.

The three index_lease probes that expected ACQUIRED under SHORT_DEADLINE now use CHILD_WAIT. No product
code changes.

Verification

  • Red before the fix:
    • 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, callees and impact rows;
    • exclusive_probe_acquires_a_free_lock_from_a_slow_child and probes_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_OUT for a free lock.
  • Green after it.
  • make pre-ci on the clean head 603286d (rustc 1.98.0): 4,365 Rust tests passed and 0 failed, 569
    frontend tests passed, docs-check OK, clippy -D warnings clean, archive smoke passed.

🤖 Generated with Claude Code

CodeGraph Test added 2 commits October 4, 2026 01:30
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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +212 to +213
// search, callers, callees and impact print `{kind:<12}{name}` like upstream's
// `kind.padEnd(12) + name`. Without padding the rows read `functionadd`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #314   +/-   ##
=======================================
  Coverage   95.07%   95.07%           
=======================================
  Files         198      198           
  Lines      108998   109014   +16     
=======================================
+ Hits       103631   103649   +18     
+ Misses       5367     5365    -2     
Files with missing lines Coverage Δ
crates/codegraph-cli/src/main.rs 91.01% <100.00%> (+0.01%) ⬆️
crates/codegraph-core/src/types.rs 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit 72eefae into main Oct 3, 2026
11 checks passed
@sunerpy
sunerpy deleted the fix/cli-kind-column branch October 3, 2026 17:55
@github-actions github-actions Bot mentioned this pull request Oct 3, 2026
sunerpy added a commit that referenced this pull request Oct 3, 2026
- 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>
sunerpy added a commit that referenced this pull request Oct 3, 2026
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>
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.

1 participant