Skip to content

fix(windows): write back edits after a blocked Cloud Files commit - #517

Merged
veryCrunchy merged 12 commits into
feat/vigilant-bouman-5f3fc2from
fix/windows-cloud-files-writeback-commit
Oct 17, 2026
Merged

veryCrunchy merged 12 commits into
feat/vigilant-bouman-5f3fc2from
fix/windows-cloud-files-writeback-commit

Conversation

@veryCrunchy

@veryCrunchy veryCrunchy commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Stacked on #515, whose branch now includes #516. This commit was pushed after #516 merged, so it wasn't part of #516.

Outcome

On Windows Cloud Files, edits keep being written back after another application had the file open during an earlier upload. That file is marked as synced once the application closes it.

Root cause (reproduced on a disposable local Windows 11 sync root)

The scenario: another process holds a shared handle on the file during writeback.

  • The ETag-guarded upload commits, and the placeholder records the new revision and size, but the exclusive in-sync commit cannot get its handle.
  • Windows keeps reporting the size from the last in-sync point in the close-completion callback. That callback required the size to match the identity, so every later close was rejected.
  • As a result, no further edit was written back while the app ran, and the item stayed in a failed writeback.

Change

  • Close callback: it no longer requires the recorded size to match the identity; hydration still does. The blocking application's own close now completes the pending commit without uploading again.
  • Writeback: remembers the revision each accepted upload was based on. If recording the new revision fails after the server accepted the upload, only that update is retried, never another upload against the superseded revision.

Validation

  • :ui:desktopTest --tests '*WindowsCloud*': 141 tests, 0 failures, 2 skipped (they need the packaged launcher). Run with JDK 21 on Windows 11.
  • New deterministic cases:
    • a close callback reporting the last in-sync size still writes back
    • a failed revision update is retried without re-upload
  • New native case on a disposable sync root:
    • a separate powershell process holds the file open during writeback, so the commit is blocked
    • when the handle closes, the commit completes with exactly one upload
    • a later edit then uploads against the new revision and ends in sync
  • With the old size check restored, the native case and its deterministic test fail.
  • bash tools/check-kotlin-architecture.sh passes. Resolving the writeback identity moved into WindowsCloudFilesWriteback, which lowers the WindowsCloudFilesProvider.kt baseline from 2338 to 2331.

Limits

Pending commits and revision updates are held in memory. After a restart, a placeholder whose new revision was never recorded is uploaded against its old revision, and the server rejects that upload. This is documented in docs/windows-release.md.

When another application held a placeholder open, the exclusive in-sync
commit failed after the upload had recorded the new revision. The
identity then carried the uploaded size while Windows kept reporting the
size from the last in-sync point, so every later close callback failed
the size check and no further edit was written back while the app ran.

The close callback no longer requires the recorded size to match the
identity; hydration still does. The blocking application's own close now
completes the pending commit without uploading again.

A writeback also remembers the revision each accepted upload was based
on, so a failed revision update is retried on its own instead of
uploading again against the superseded revision.
A connected file placeholder is a cloud reparse point that Java NIO does
not report as a regular file, so allocatedBytes and dehydrate returned 0
for every hydrated placeholder. Free up space, automatic cleanup, and the
storage summary therefore found nothing to free.

Classify the path from native find data with the startup enumeration
rule and dehydrate only an unpinned, in-sync file placeholder. Windows
refusals for content that became dirty, pinned, or open elsewhere free
nothing instead of failing the whole pass, and freed totals count the
bytes each dehydration released. Dehydration opens the file for
attribute access only, so a reader that denies write sharing is reported
as in use rather than as a sharing violation.

Native tests on a disposable sync root hydrate, free, and reopen a file,
and keep dirty, pinned, and externally open files local.
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #517 / NC Native October 17, 2026 19:52 Destroyed
@obiente-cloud

obiente-cloud Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Obiente preview

NC Native · 0b529e301309 · Removed

View preview status

View in Obiente

Obiente updates this comment as the preview changes.

@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #517 / NC Native October 17, 2026 19:52 Destroyed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T22:00:57.234847Z 0b529e3 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…k-commit' into fix/windows-cloud-files-dehydrate-classification

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c75ff6455d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/kotlin-file-size-baseline.txt Outdated
A Windows CI runner reported no allocated bytes for a placeholder right
after its content was read, although the same sample was complete
locally. Wait within a bound until the file reports its whole size as
allocated, and report the raw allocation result and placeholder state
on timeout. Shorten the changelog summary to the fragment limit.
CfDehydratePlaceholder requires an exclusive handle, so dehydration now
holds an exclusive CfOpenFileWithOplock handle. An oplock that cannot be
taken or breaks first keeps the content local and frees nothing.

An online-only placeholder allocates no bytes and is skipped before any
native call, so a cleanup pass does not scale with the remote tree.

Automatic cleanup executes its plan through one checker that also keeps
a file whose known revision changed after planning, besides the existing
pin, sync state, and allocated size checks.
Both writeback call sites read and validated the placeholder's current
identity themselves. The writeback now does that once, which keeps the
oversized provider below its recorded size baseline.
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #517 / NC Native October 17, 2026 20:45 Destroyed
veryCrunchy and others added 2 commits October 17, 2026 22:49
…k-commit' into fix/windows-cloud-files-dehydrate-classification

# Conflicts:
#	tools/kotlin-file-size-baseline.txt
…e-classification

fix(windows): dehydrate and measure connected Cloud Files placeholders
@obiente-cloud
obiente-cloud Bot temporarily deployed to Obiente Preview / PR #517 / NC Native October 17, 2026 21:59 Destroyed
@veryCrunchy
veryCrunchy merged commit df655ee into feat/vigilant-bouman-5f3fc2 Oct 17, 2026
4 of 5 checks passed

This branch was successfully deployed

No deployments
Obiente Preview / PR #517 / NC Native — 0b529e30 Deployed Oct 17, 2026 by obiente-cloud[bot]
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