Skip to content

Tolerate hydration count drift in status estimates - #2146

Draft
Tyrie Vella (tyrielv) wants to merge 2 commits into
microsoft:masterfrom
tyrielv:tyrielv/hydration-count-drift
Draft

Tyrie Vella (tyrielv) wants to merge 2 commits into
microsoft:masterfrom
tyrielv:tyrielv/hydration-count-drift

Conversation

@tyrielv

@tyrielv Tyrie Vella (tyrielv) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Problem and Context

Hydration status adds placeholder and modified-path counts, then compares those sums with index-based totals. These sources count different populations.
New paths, overlapping records, and retained folders after branch switches can exceed the totals without a calculation failure.
Current status handling rejects those results. The diagnostic contract from #2144 is already on master.

Background hydration also requests modified paths through the mount's own pipe. If the request arrives before mount readiness, the mount rejects it.
Its disk fallback conflicts with the mount's open writer. A clean status cache can then prevent another hydration refresh.

Changes

  • Accept complete, nonnegative observations even when their sums exceed the totals. Reject incomplete summaries that the earlier count-only policy accepted.
  • Collect both denominators and share acceptance and display across the summary, cache, CLI, and hook-linked code. Cap only the display at 100%. Identify excess counts and display n/a when a positive sum has a zero denominator.
  • Change usable status output to Estimated hydration: files ...; folders .... Apply that format to gvfs health --status even when the status-hook feature is disabled.
  • Preserve raw counts, denominator sources, signed differences, and positive excess in diagnostics. Use 64-bit sums without changing count populations, wire count fields, database records, or the circuit-breaker policy.
  • Read the mount's existing in-memory modified paths during background hydration. Preserve the pipe and disk fallback for external health calculations.
  • Keep cache lookups free of calculations and repository scans. Preserve the hook and cache lookup budgets.
  • Update the functional test-output filter for the new status prefix.
  • Add unit tests for count drift, unavailable sources, arithmetic boundaries, zero denominators, exact percentages, fractional truncation, and protocol compatibility. These tests assert shared CLI and hook behavior and raw cache diagnostics.
  • Add unit tests for populated and empty in-memory modified paths, including empty-entry filtering. Extend the disabled-feature test to reject provider reads.
  • Add functional tests that retain an obsolete placeholder folder with an untracked file after a branch switch. The tests distinguish that folder from a clean removed folder and verify cached status, forced fallback, and repeated cache reuse.
  • The functional tests use distinct paths for cached and fallback cases. They wait for a stable cache identity and delete their test-owned paths. The tests report the last mount calculation on timeout.
  • Document estimate semantics, source completeness, client compatibility, and the existing disk-reader limitations.

Accept complete nonnegative observations across different count populations. Share estimated display and preserve raw diagnostics without changing database records or cache lookup budgets.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Read modified paths from the mount's existing collection during background hydration.
Avoid the mount's self-pipe before readiness.
Preserve empty-entry filtering, the external pipe and disk fallback, and cache lookup budgets.

Add provider and percentage-boundary tests.
Isolate branch-switch test paths.
Delete retained folders.
Require a stable cache identity before reuse assertions.

Assisted-by: GPT-6.1 Sol
Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
@tyrielv
Tyrie Vella (tyrielv) force-pushed the tyrielv/hydration-count-drift branch from 5454a3f to a2bd5b7 Compare November 5, 2026 23:43
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