Repository navigation
fix(preview): collapse provider-directory rows and keep changeset order - #1242
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 4 selected item(s). |
|
@jimpablo I was working on the same issue as well, but you pushed the PR first. One thing i noticed is that the FAQ still says With this change, provider-directory entries are summarized in text output, while JSON still keeps every entry. Should we update the preview example/wording in |
|
Thanks @Parikalp-Bhardwaj — sorry for the overlap, and thanks for reading the FAQ against this change. I double-checked against #1236 (and the same author's follow-ups) before deciding not to touch the docs here:
So the table row for Happy to add a short wording note in all five |
|
@jimpablo @Parikalp-Bhardwaj You should always document these changes. |
|
Thanks @wu21-web — will do. Updating the five FAQ locales in this PR so the preview wording and sample match the new text/JSON split. |
I agree, since this changes user-visible preview behavior, the FAQ should be updated in the same PR so the documented behavior stays accurate. |
|
Agreed — that's now in this PR. |
|
@jimpablo merge conflicts |
Size the path column per section, render provider_directory entries as one summary line in text output, and keep preview entries in Git order.
Terminal preview summarizes provider-directory files; JSON still lists every entry. Sync the wording and sample across all five locales.
Use --format json in a test comment, separate the totals and ordering reasons in preview.go, and stop saying preview lists every candidate file.
b283afa to
0de1f8b
Compare
|
Can I review this? |
|
@lizhengfeng101 Rebased on main and fixed the conflicts. Had to update one existing test after #1241 landed, see the description. |
…er (alibaba#1242) * fix(preview): collapse provider-directory rows and keep changeset order Size the path column per section, render provider_directory entries as one summary line in text output, and keep preview entries in Git order. * docs(faq): document collapsed provider-directory preview rows Terminal preview summarizes provider-directory files; JSON still lists every entry. Sync the wording and sample across all five locales. * docs(preview): tighten comment and FAQ wording Use --format json in a test comment, separate the totals and ordering reasons in preview.go, and stop saying preview lists every candidate file.
Description
Fixes the three
--previewpresentation problems that became reachable once #1223 started listing provider-directory exclusions (#1236):Will reviewrows.provider_directoryentries collapse into one line that names only the directories actually matched (diff.ProviderDirPrefix). They are skipped when sizing the excluded column.--format jsonis unchanged and still lists every entry infiles.DiffSetrecords each provider exclusion's changeset position andForEachInOrderwalks Included/Excluded in Git's order instead of prepending provider entries. The terminal listing and the JSONfilesarray follow that order.Scope note: #1236 lists
output.go,preview.goand their two test files. This also touchesinternal/diff, for two reasons. OncepartitionDiffssplits the changeset intoIncludedandExcluded,preview.gocan no longer recover the original order, soDiffSetrecords where each exclusion sat. Anddiff.ProviderDirPrefixlets the summary line name the matched directories from the existingproviderDirIgnoreDirsblocklist instead of a second copy of it.The five FAQ locales now describe the text/JSON split: terminal preview collapses provider-directory files into one summary line;
--format jsonstill lists every entry.Untracked provider-directory files stay with #1235 / #1241. This does not add a vendor-include override (#1197).
Example on a scratch repo with a vendored
target/tree, avendor/file, and a test file:Type of Change
How Has This Been Tested?
make testpasses locallymake checkpasses locallymake coveragereports 91.5% (threshold 90%)New tests, covering the renderer,
Preview,runPreviewandinternal/diff:TestOutputPreviewText_ExcludedPathDoesNotWidenWillReviewTestOutputPreviewText_AggregatesProviderDirectoriesTestOutputPreviewJSON_KeepsEveryFileInEntryOrderTestPreviewKeepsChangesetOrderTestRunPreviewJSON_ProviderDirectoryKeepsChangesetOrderTestGetDiffSetWalksChangesetOrderTestProviderDirPrefixUpdated:
TestOutputPreviewText_WithExcludedFiles. Since #1241 itsvendor/lib.goentry isprovider_directory, which this PR renders as the summary line, so the test now expects that line instead of a per-row path.Manual: built
ocrand ranocr review --previewandocr review --preview --format jsonagainst a scratch repo containinga.go,foo_test.go, a deeptarget/.pnpm/...path,target/demo.go, andvendor/lib.go. Text output is shown above. The JSONfilesarray lists all 5 paths in Git order.Also checked against a 3,421-file provider tree (the excluded section stays at one summary line; JSON keeps all 3,423 entries in
git difforder), commit and range modes, and a gitignored tracked file sitting between entries.Pre-commit
ocr review --audience agentcould not run locally (no LLM endpoint configured).Checklist
go fmt,go vet)AI/LLM disclosure: Grok 4.6 (Grok Build / xAI) was used to implement the fix and tests and to draft this description. Claude Code (Claude Opus 5) was used afterwards to check the PR against #1236 and to correct two code comments and the FAQ wording. I reviewed the diff. Commits carry no AI attribution.
Related Issues
Closes #1236