Skip to content

fix: avoid repeated file token units#5

Merged
sting8k merged 1 commit into
mainfrom
public/file-token-unit-label
May 26, 2026
Merged

fix: avoid repeated file token units#5
sting8k merged 1 commit into
mainfrom
public/file-token-unit-label

Conversation

@sting8k
Copy link
Copy Markdown
Owner

@sting8k sting8k commented May 24, 2026

Summary

  • Avoid repeating the tokens unit in each file glob result row.
  • Move the unit note to the file-result header: sizes ~= tokens.
  • Add regression coverage for rows with and without summaries.

Validation

  • cargo fmt --check
  • cargo test --locked --test files_and_symbol_glob files_action_lists_file_globs

Release note

Parking this PR for a later public release batch. No version bump, publish, tag, or release is included here.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 24, 2026

Greptile Summary

This PR removes the repeated tokens unit from per-file glob result rows and moves it to the result header as sizes ~= tokens, reducing visual noise in file-listing output.

  • src/search/glob.rs: file_preview now emits ~N and ~N · summary instead of ~N tokens / ~N tokens · summary.
  • src/search/display/glob_result.rs: The file-result header now includes sizes ~= tokens to declare the unit once.
  • tests/files_and_symbol_glob.rs: Adds an EmptyController.php fixture (no extractable first line) and three regression assertions covering header unit placement, row repetition, and the no-summary file path; updates directory file count from 2 to 3.

Confidence Score: 5/5

Safe to merge — the change is a pure display formatting adjustment with no effect on search logic, pagination, or data handling.

The diff touches only string formatting in two functions and their test coverage. Both branches of file_preview (with and without a meaningful first line) are now exercised by the new EmptyController.php fixture. No logic, data flow, or public API surface is altered.

No files require special attention.

Important Files Changed

Filename Overview
src/search/display/glob_result.rs Appends sizes ~= tokens to the file-result header so the unit is declared once; no logic changes.
src/search/glob.rs Removes "tokens" suffix from per-file file_preview output in both summary-present and summary-absent branches; doc comment updated to match.
tests/files_and_symbol_glob.rs Adds EmptyController.php fixture (no meaningful first line) to cover the no-summary branch; updates directory count from 2→3 and adds three targeted regression assertions for the token-unit placement.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[file_preview called] --> B{metadata readable?}
    B -- No --> C[return None]
    B -- Yes --> D[estimate_tokens from file size]
    D --> E[first_meaningful_line]
    E --> F{summary empty?}
    F -- Yes --> G["return Some('~N')"]
    F -- No --> H["return Some('~N · summary')"]

    I[format_glob_result] --> J["header: '...N of M files (offset O, sizes ~= tokens)'"]
    J --> K[append_grouped_files]
    K --> L["per-file row: '  filename.ext  (~N)' or '  filename.ext  (~N · summary)'"]
Loading

Reviews (1): Last reviewed commit: "fix: avoid repeated file token units" | Re-trigger Greptile

@sting8k sting8k merged commit 9c026f9 into main May 26, 2026
3 checks passed
@sting8k sting8k deleted the public/file-token-unit-label branch May 26, 2026 09:10
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