feat(safe-fs): support atomic resize operations for truncate - #711
Draft
kamilio wants to merge 5 commits into
Draft
feat(safe-fs): support atomic resize operations for truncate#711kamilio wants to merge 5 commits into
kamilio wants to merge 5 commits into
Conversation
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.
Problem
truncatecurrently requires retained writable handles. A transactional filesystem can safely resize a file in one atomic mutation but cannot necessarily retain an inode across distributed requests. Such a backend cannot use the command despite being able to preserve its size and quota semantics.Change
Add optional
atomicResizeandresizeFile(path, operation, options)to safe-fs. The operation carries the signed bigint size, modifier, optional reference snapshot, and block-scaling intent so the backend computes the final size against the target within its own transaction. The documented contract requires overflow checks and quota validation before publication.truncatecontinues to prefer retained handles and uses the atomic operation only when the backend explicitly advertises it. Device and mount wrappers forward supported operations, scoped filesystems account for them, and read-only, quota, and overlay wrappers withhold the capability. Cancellation waits for an admitted operation to settle without promising rollback.The branch is reconciled with upstream strict-fixture type fixes; the PR diff contains only the atomic resize contract, command integration, and their tests.
Validation
Parse, while the committed-archive helper callstar.Parser. The original failure evidence is retained; archive controls have not been relaxed.Draft status
Awaiting resolution of broad-run failures; downstream integration screenshot is below. No merge or release is requested.
The API is optional; this PR does not add atomic resizing to backends that cannot provide it. It does not require or replace the independent device comparison fix in #710.
Downstream integration evidence
Recorded controlled Poe2 integration of the optional resize contract with its downstream shell adapter, API and native storage, rendered in real Chat. Partial UTF-8 c3 grows to c30000; an oversize resize to 131073 returns status 1 and preserves authoritative bytes [195, 0, 0]. No model run or production service. This is not standalone upstream validation; broader failures and current CI remain unresolved.