* filer: fold chunk lists for scoped commits
A filer serving a keep-only scoped token never folded chunk lists, and
refused any new chunk for an entry holding manifests, so scoped clients
kept their lists flat. On a store with a value size limit, such as
FoundationDB, a scoped file stopped fitting at about 1000 chunks.
The filer now folds scoped commits and reuses stored manifests as it does
for unscoped ones. Folding runs after the retained-data check, so the only
manifests a scoped commit stores are ones the filer wrote:
- a scoped request may keep a manifest stored at the target, sent as
stored; any other manifest is refused, with or without a proof, and a
stored manifest cannot be kept as a data chunk;
- the chunks held by the stored manifests count as stored at the target
and join the identity map, so they may be retained flat but not under
another spelling of their file id;
- those chunks are read under the handler's path lock, not at admission;
admission still refuses a manifest the target does not store and leaves
the checks that depend on the held chunks to the locked check. A
manifest that cannot be read refuses the write as Unavailable. An update
rechecking inside its store transaction reuses the chunks it already
read, so it does no volume I/O there.
Appends to a folded entry are allowed under the same rules: an append
keeps every stored chunk, and the locked check refuses aliases of the
chunks the stored manifests hold.
* mount: explain why a scoped mount keeps chunk lists flat
A filer serving a scoped token now folds scoped commits itself and keeps
only the manifests it wrote. The mount's flat rule is unchanged; only the
reason given for it was out of date.
* filer: test a scoped truncate through a stored manifest
* filer: refuse manifest chunks in a scoped append
An append moves each chunk it carries to the end of the file. A manifest
cannot be moved that way: the chunks it holds keep their own offsets, so
the appended range would read no data and the manifest's bytes would still
read at their old place. Before this series a scoped request could carry no
manifest at all; now that a scoped commit may keep a stored manifest, an
append still takes data chunks only.
* filer: read only the stored manifests a scoped commit drops
The locked retained-data check read every stored manifest whenever a
scoped request had chunks, so each flush of a folded file and each append
cost one volume read per manifest under the path lock. The unscoped path
reads only the manifests a commit drops.
Read the same way for a keep-only scope: only the stored manifests the
request does not keep unchanged, and none for an append, which keeps every
stored chunk. A kept manifest keeps its chunks referenced, and garbage
comparisons match chunk identities, so another spelling of one of its
chunks cannot get the needle deleted; such a chunk now needs its own proof
like any new chunk. Truncating through a manifest and listing its chunks
flat still work, since both drop it.
* filer: find the dropped manifests of a scoped commit in one pass
Index the manifests the request keeps by file id instead of scanning the
request for each stored manifest, which compared and cloned chunks
quadratically in the number of manifests.
* filer: rewrap the scopeManifestReader comment
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: assignment tokens and chunk proofs for scoped writes
* filer: tighten scoped chunk identities and write boundaries
* filer: apply gRPC key removal on config reload
* filer: prevent scoped chunk alias and remote append data loss
* filer: guard scoped writes across stored data representations
* filer: preserve lazy scoped admission lookups
* filer: avoid summing chunk counts for map capacity
* filer: keep a scoped assign in its path's collection
A scoped token could name another bucket's collection in AssignVolume and
upload chunks there, charging that bucket's quota and losing them when that
collection is deleted. A scoped caller now gets the collection its path
resolves to; naming a different one is refused before the master call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: rotate gRPC keys and bind chunk proofs to collections
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* filer: path- and method-scoped tokens on the filesystem gRPC service
* filer: close scoped admission and compatibility gaps
* filer: test subscription key ambiguity and retained write success
* filer: assert verified peer chains survive subscription fallback
* filer: keep a hard link's count and chunks together under a scoped token
A scoped write may keep a hard link the target already has, but the link
count it sends was stored as is, and its chunks could stay on the name
with the link dropped. Either let a scoped token delete its own name and
take the chunks of a name outside its grants with it: the forged count
reaches zero, or the detached name owns the shared chunks.
The handler recheck now refuses a scoped write that changes a stored
link's count or keeps its chunks without the link. Dropping the link
together with the data, and appending to a linked file, are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: leave subscriptions with a non-scope bearer to the existing verifier
The stream interceptor refused a SubscribeMetadata or SubscribeLocalMetadata
call whose bearer does not verify under the filer key unless the bearer was
a subscription token, and it checked that token with the peer stripped. With
no subscription key, or on an mTLS peer, the existing verifier admits such a
call, so filer.sync sending another cluster's admin token stopped.
When the bearer is no filer scope, the subscription verifier now decides on
the original context, as before scoped tokens. A scoped token still reaches
the refusal for scoped subscriptions, and malformed metadata is still refused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: refuse scoped writes that would make ancestors outside the grant
A scoped create, append or rename checked only its target. The filer then
creates the target's missing ancestors up to the first one it finds, and
turns that one into a directory if it is a file, dropping its ttl. A token
granted /data/proj/ws could so promote the file /data/proj, or create /q and
/q/r for a grant /q/r/ws.
The scope now walks the same ancestors before admitting the write and
refuses one outside the write grants that is missing or not a directory. A
create with skip_check_parent_directory makes no ancestors and is not
walked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: require write grants for scoped lock mutations
* filer: document scoped signatures and read-only token upgrades
* filer: enforce WORM retention for scoped mutations
* filer: refuse scoped writes through shared hard links
* filer: drop series notes from scope comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* filer: refuse scoped subtree mutations across WORM rules
---------
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>