Skip to content

fix(web): show TAR files directly under their folder when a path contains a dot segment - #46893

Merged
juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-47e67d2195
Dec 1, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:mainfrom
saphid:hunter/c-47e67d2195

Conversation

@saphid

@saphid saphid commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Problem

Archive previews strip leading ./ and repeated slashes from TAR member names but keep an interior . segment, so a file stored as docs/./file.txt sits behind a spurious clickable . folder instead of appearing directly in docs.

Deterministic repro on origin/main (4374266d290a4bb35075be9835b00cccd5c9309a):

mkdir -p fx/docs && printf 'sample\n' > fx/docs/file.txt
tar -C fx -cf example.tar 'docs/./file.txt'   # tar -tf lists docs/./file.txt; extraction writes docs/file.txt

Open example.tar from the Files panel (or as a chat attachment) and click docs.

  • Observed: docs contains a single folder row .; file.txt only appears after opening it.
  • Expected: docs immediately lists file.txt, and clicking it shows sample.

Change

BinaryViewer now builds the display/grouping path by dropping empty segments and every . segment except a final one. That covers the leading /, ./ and repeated-slash cases the old regexes handled, plus an interior ./. A non-directory entry whose last segment is ., such as the payload of a gzip named ..gz, still gets a row, as on main. The raw member path is still used for worker lookups and row identity, so the original bytes open. Dotfiles like .gitignore and .. segments are untouched. This one component backs both the Files panel and attachment archive previews.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • The existing browser test names archive folders whose paths have leading slashes, repeated slashes or ./ (real BinaryViewer + binary preview worker in Chromium) now stores its dot.txt member as ./a/./dot.txt. It fails on base with expected [ '.', 'hello.txt', 'hello.txt' ] to deeply equal [ 'dot.txt', 'hello.txt', 'hello.txt' ] and passes on head, including opening the raw member bytes.
  • New browser test lists the payload of a gzip file named ..gz passes on base and head. It failed (expected [] to deeply equal [ '.' ]) against an earlier draft that dropped every . segment.
  • vp run check:changed exit 0 at HEAD 24c19682c9db (format, lint, knip, typecheck, tests, React Compiler).
  • GNU tar 1.35 fixture listing, base/head test output and the HEAD-tagged check:changed summary: https://gist.github.com/saphid/a14d8669f1d8374f97586b1f62d35e2a

Not shown: before/after screenshots of the Files panel in a running app, the desktop (Electron) shell, and mobile (archive previews are web/desktop only).

Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • .github/pull_request_template.md:27 — The linked gist shows an earlier Chromium test and the GNU tar fixture, not the round-two transcript or the HEAD-tagged check:changed result it is described as containing. Attach the current evidence or distinguish the linked proof from the reported checks.
  • .github/pull_request_template.md:30 — Keep the missing before/after Files panel screenshots disclosed until they are captured. Clarify that mobile supports ZIP previews but does not render the affected TAR view; say ‘TAR preview is web/desktop only,’ not ‘archive previews are web/desktop only.’

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Dec 1, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at dff6489

Macroscope's review found this PR approvable — Archive previews now place entries with intermediate dot segments directly under their intended folders. Original paths remain intact for opening entries, and the change is limited to preview navigation.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dff6489 and c92efb0.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Archive member path normalization now removes empty segments and non-final . segments while retaining a final .. Browser tests cover an inner ./ in a TAR path and previewing decompressed content from a gzip file named ..gz.

Changes: Archive path handling

Layer / File(s) Summary
Normalize archive paths and verify previews
apps/web/src/components/files/BinaryViewer.tsx, apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
Archive member paths discard empty and non-final . segments. Browser tests cover an inner ./ in a TAR path and a . archive entry that previews the decompressed sample payload.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: stienswout, iamshadmantaqi, only21mil

Merge Risk: Minimal · previous review dff64

This fixes TAR archive previews that showed a spurious folder for an interior "." path segment. The change is small and covered by browser tests, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix, the TAR archive preview, and the trigger (a dot segment in the path). It matches the change to BinaryViewer, which drops interior '.' segments from archive display and groupin…
Description check Passed The description follows the template sections (Problem, Change, Scope, Verification) and explains the bug, the fix, and the tests. It gives a deterministic reproduction. Gaps remain. The Verification …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix, the TAR archive preview, and the trigger (a dot segment in the path). It matches the change to BinaryViewer, which drops interior '.' segments from archive display and grouping paths. The title follows the conventional commit form the template asks for.

Full details: Description check

Explanation

The description follows the template sections (Problem, Change, Scope, Verification) and explains the bug, the fix, and the tests. It gives a deterministic reproduction. Gaps remain. The Verification section discloses that before/after Files panel screenshots are missing, and the linked gist does not contain the round-two transcript or the HEAD-tagged check:change result the author cites. The reviewer notes also flag a wording issue about mobile support for archive previews.

Resolution

Address these items before merge: 1) Attach the current evidence for the HEAD-tagged vp run check:changed result, or state that the linked gist does not contain it. 2) Attach before/after screenshots of the Files panel, or keep the disclosure that they are missing. 3) Reword the mobile note to say that TAR preview is web/desktop only, not that archive previews are web/desktop only.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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 b4fd7ba and dff6489.

Files selected for processing: 2

  • apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
  • apps/web/src/components/files/BinaryViewer.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 1, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Environment: real web app, 1280×800 browser, light theme, fresh isolated database on each commit, synthetic project and Replay (dev) thread.

Steps: Create fx/docs/file.txt containing sample followed by a newline; run tar -C fx -cf example.tar docs/./file.txt; seed a project and replay thread; open the thread, right panel → Files → example.tar; maximize the panel and open docs. Capture the listing, expect file.txt directly inside docs, then open file.txt and verify sample.

Scenario: TAR interior dot segments do not create phantom folders

Proven: the scenario fails on base f5689ae8ee and passes on head c92efb0dec.

Base f5689ae8ee Head c92efb0dec
Result ❌ failed
ASSERTION_FAILED: expect.toBeVisible failed
locator: getByRole("button", name: "file.txt")
expected: visible
observed: no node (match count 0)
✅ passed
docs folder Base f5689ae8ee: docs folder Head c92efb0dec: docs folder
file preview Head c92efb0dec: file preview

| Recording | Before recording | After recording |

Scenario and fixture driver

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 1, 2026
@juliusmarminge
juliusmarminge merged commit 4dafd22 into pingdotgg:main Dec 1, 2026
59 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants