Repository navigation
fix(analyze): deduplicate Home hard links across children - #2014
Merged
tw93 merged 2 commits intoNov 16, 2026
Merged
Conversation
Measure included Home entries in one du process so siblings and top-level files share its hardlink accounting. Keep the immediate Library and mounted children excluded, and reject stale cached totals. Reuse scan-wide file identities in the bounded Go fallback when exec cannot fit all operands. Preserve partial permission results and physical symlinks. Verified the real-hardlink regression red on unchanged main and green here, format/check, go test ./..., and the full scripts/test.sh runner (exit 0).
Record the regression against the fix commit, the native Linux reproduction in tw93#2013, and the separate Windows consumer. Keep package and app delivery status unverified. Verified the incident audit, new commit and catcher references, and diff whitespace. Production code is unchanged from the passing full test run.
tw93
added a commit
that referenced
this pull request
Nov 16, 2026
The Home overview ran one du per child after skipping ~/.cache, so each process kept its own hardlink set and a file linked across two children, or between Home and a child, was counted once per link. Mole CLI (macOS) fixed this in #2014 by passing every child to one du -c, but uutils du 0.2.2, Ubuntu 25.10's default, still counts links per operand, so Linux runs a single du over Home and excludes the literal ~/.cache path, the same way it already excludes foreign mounts. The bounded Go fallback now shares the scan's identity set, and overview cache schema 13 drops older totals. Verified on the devbox: TestHomeOverviewCountsHardlinksAcrossChildrenOnce reads 6291456 B on the old code under GNU du 9.1 and uutils du 0.2.2 and passes on the new code under both; go test ./... passes as user mole.
tw93
added a commit
that referenced
this pull request
Nov 16, 2026
…inux port Squash merging #2014 replaced 7c83bad with 3c4f01d, so I-77 and the SYNC source now name the merged commit (audit_incidents.py passes, 77 rows). The Linux row moves from Pending to Implemented at linux 644a643 (#2013), with why it uses one du over Home instead of the operand list: uutils du 0.2.2 counts hard links per operand.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Home overview sizes count a 1 MiB file twice when its hard links sit in different immediate children, or directly in Home and a child. Each child previously used an independent
du, while direct files were added separately.Measure all included children in one
duinvocation and use its combined total. Keep only the immediate~/Libraryexcluded, retain mount-point filtering and physical symlink handling, and invalidate older cached totals. If the operand list cannot fit inexec, the existing bounded Go fallback shares the scanner's file-identity accounting.Safety Review
This changes read-only size accounting. The existing deletion, Trash and authorization paths are untouched. Top-level Library and mounted children remain outside the Home measurement; nested Library directories remain included. Permission-only failures retain a partial subtotal, and cancellation keeps the existing measurement deadline.
Home now uses one
duprocess for shared hardlink accounting. Large real user homes have not been benchmarked; the existing overview deadline remains in force.Tests
main@5dd93fe3; sibling, root/child, newline-name and fallback cases fail there and pass with the fix.go test ./...../scripts/check.sh --formatand./scripts/check.sh --no-format.TERM=xterm-256color MOLE_TEST_NO_AUTH=1 MOLE_TEST_TIMING=1 BATS_FORMATTER=tap ./scripts/test.sh, with an isolatedTMPDIR: exit 0,All tests passed!(1938.49 s). Main Bats batch 2508 cases and all nine serial files complete, followed by Go build/vet/tests, module loading and integration.The local check uses its supported
go vetfallback because golangci-lint is not installed. The full runner skips the shallow-clone commit-resolution case, the CLI check for an unbuilt analyze binary, and its Homebrew installation probe. The new Go regressions and the runner’s Go build/tests do run; no live cleanup or large real-user HOME scan was performed.The Linux consumer has the same per-child structure; unchanged source was reproduced through the real CLI on Ubuntu 25.10 with uutils and GNU du. Its current contribution policy accepts issues, so that consumer is tracked in #2013. The Windows Home consumer uses its own walker; #2012 remains the separate NTFS work.
AI assistance was used for the investigation, implementation and validation.
Safety-related changes
Read-only measurement and cache invalidation only.