GeezerVison is showing github.com — fix(web): archive previews list numbered files and folders in natural order by only21mil · Pull Request #43701 · pingdotgg/t3code
Conversation
Problem
When a .zip or .tar holds numbered files or folders, the web archive preview lists them as page1.txt, page10.txt, page2.txt (and ch1, ch10, ch2) instead of page1.txt, page2.txt, page10.txt. The listing sorted names with a plain localeCompare, while the workspace file tree already lists numbered names in natural order and the Files breadcrumb menu and the mobile ZIP browser sort with a numeric collator.
Change
The archive listing now sorts with the same Intl.Collator(undefined, { numeric: true, sensitivity: "base" }) the Files breadcrumb menu (fileBreadcrumbChildren) and the diff file tree use, created on first comparison like theirs. The comparator, folders first and then names in natural order, moves to binaryPreviewProtocol.ts as compareArchiveRows, next to the other archive preview helpers and their tests. BinaryViewer.tsx calls it in place of the inline sort; the rest of that diff is the formatter re-indenting the same JSX.
Scope
Bug fix: wrong order in the web archive preview. It is a small fix of an obvious bug, so there is no issue. Mobile already sorts archives with a numeric collator (apps/mobile/src/features/files/zipTree.ts), and desktop renders this same web component.
Verification
Setup: Linux, web app in the Browser panel, light theme, 1280×800, fresh isolated dev data (T3CODE_DEV_SEED=0). A demo repository holds book.zip with page1.txt, page2.txt, page10.txt and folders ch1/, ch2/, ch10/.
Steps: Open the demo project → right panel → Files → book.zip → hide the file explorer → maximize the panel.
| 44a5333 |
4d02ebd |
 Folders list ch1, ch10, ch2 and files page1, page10, page2 |
 Folders list ch1, ch2, ch10 and files page1, page2, page10 |
The new test in binaryPreview.worker.test.ts passes on 4d02ebd (3 of 3 runs) and fails when the comparator is swapped back to 44a5333's localeCompare or loses its folders-first check. vp run check:changed passes on 4d02ebd. On main 83d4509 the test fails (no comparator there), and on a local merge of 4d02ebd into 83d4509 it passes and typecheck is clean.
Not shown
- Desktop (Electron) and macOS or Windows browsers: not run. Desktop renders the same web component.
- A
.tar archive in the app: not run. It goes through the same listing and sort as .zip.
Test output
4d02ebd with 44a5333's comparator (Number(b.directory) - Number(a.directory) || a.path.localeCompare(b.path)):
× sorts archive folders first, then numbered names in natural order
AssertionError: expected [ 'vol1', 'vol10', 'vol2', …(3) ] to deeply equal [ 'vol1', 'vol2', 'vol10', …(3) ]
[
"vol1",
- "vol2",
"vol10",
+ "vol2",
"page1.txt",
+ "page10.txt",
"page2.txt",
- "page10.txt",
]
4d02ebd:
Test Files 1 passed (1)
Tests 7 passed (7)
Generated with Claude Opus 5.5 in T3 Code Nightly
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 26, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The archive protocol now exports a comparator that sorts directories before files and compares paths in natural, case-insensitive order. BinaryViewer uses the comparator to sort archive entries.
Changes: Archive Row Ordering
| Layer / File(s) |
Summary |
Define and verify archive row ordering apps/web/src/components/files/binaryPreviewProtocol.ts, apps/web/src/components/files/binaryPreview.worker.test.ts |
The protocol adds a comparator that places directories before files and compares paths using numeric, case-insensitive ordering. The test checks directory priority and natural ordering of numbered names. |
Use the comparator in BinaryViewer apps/web/src/components/files/BinaryViewer.tsx |
BinaryViewer uses the comparator instead of its inline sort. Row rendering and interactions remain unchanged. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: saphid, maria-rcks
Merge Risk: Minimal · up to 3aea4
-
Merge Risk: ⚪ Minimal · up to 3aea4
Archive previews now list numbered files and folders in natural order, with folders first. The change is small and presentation-only, and no merge-blocking risk was identified.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the main change: archive previews now list numbered files and folders in natural order. It follows conventional commit form and matches the raw summary, the PR objectives, and the desc… |
| Description check |
 |
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each section gives specific content. The Problem section states the expected and … |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the main change: archive previews now list numbered files and folders in natural order. It follows conventional commit form and matches the raw summary, the PR objectives, and the description. The change is a comparator in binaryPreviewProtocol.ts used by BinaryViewer.tsx, which is consistent with the title.
Full details: Description check
-
Explanation
The description follows the repository template closely. It has Problem, Change, Scope, and Verification sections, and each section gives specific content. The Problem section states the expected and actual order and names the affected components. The Change section explains the comparator and its location. The Scope section gives a reason for omitting an issue. The Verification section gives setup, steps, before and after screenshots, test output, and items not checked. It also names the model used, as the template asks. The description does not link a tracking issue, but it gives a reason, which the template allows.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between bc0f04d and 4d02ebd.
Files selected for processing: 3
-
apps/web/src/components/files/BinaryViewer.tsx
apps/web/src/components/files/binaryPreview.worker.test.ts
apps/web/src/components/files/binaryPreviewProtocol.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Evidence
Seeded the same nine-entry ZIP and unpacked files on fresh databases, opened a Replay thread → right panel → Files, expanded unzipped/, selected book.zip, and maximized the panel. Chromium, 1440×1000, light theme on both sides.
| Before |
After |
 |
 |
| bc0f04da94 |
3aea4fb003 |
| ch1, ch10, ch2; page1.txt, page10.txt, page2.txt |
ch1, ch2, ch10; page1.txt, page2.txt, page10.txt |
The unpacked tree uses natural order on both builds. The scenario fails on base and passes on head; scenarios:prove exited 0.
Scenario and synthetic ZIP seed · Before recording · After recording
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|