Repository navigation
fix: an empty delivered file is a broken delivery, refused by ReadFileCarrier - #849
Merged
Merged
Conversation
…eCarrier
A value is delivered by file only when it is larger than
FileCarrierThreshold (deliverByFile), so a carrier naming an empty file is a
truncated write or a mount race, never a value the host left unset.
ReadFileCarrier returned "" for it, which a reader treats as absent, so a
lookup could step past a broken delivery to another source. sdk-go#90 found
exactly that: WorkspaceValue answered from the secret namespace (review r144).
It now refuses with ErrFileCarrier ("delivered file is empty"), like a missing
file, so every reader of ResolveFileCarriers/ReadFileCarrier gets the rule
from the one place that reads carrier files (review r154 f2).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
resources.ReadFileCarriernow refuses a carrier whose file is empty, withErrFileCarrier: <key>: delivered file is empty, the same way it refuses a missing file.ResolveFileCarriers, which reads through it, inherits the rule.Why: a value is delivered by file only when it is larger than
FileCarrierThreshold(deliverByFile). A carrier naming an empty file is therefore a truncated write or a mount race, never a value the host left unset.ReadFileCarrierreturned""for it, and a reader treats""as absent, so a lookup could step past a broken delivery to another source. codefly-dev/sdk-go#90 hit this:WorkspaceValueanswered from the secret namespace when the public value's delivered file was empty (review r144 f2). sdk-go now refuses an empty file in its ownreadFileCarrier. Review r154 f2 asked for the rule in core too, so every reader of file carriers gets it from the one function that reads them.docs/runnable-binding-delivery.md's Read time rule lists an empty file among the refusals, with the reason.Fix or hack
Fix, at the owner:
ReadFileCarrieris the one function that reads carrier files. The change is one check there, beside the size check.Test plan
TestResolveFileCarriersFailsClosedgains anan empty filecase (expectsErrFileCarrier). With the check removed, it fails on that case.go test -race -count=1 ./resources/passes.go test -count=1 ./runners/base/passes. That is the other package that reads carriers (ResolveFileCarriers, in a test).go vet ./resources/is clean.golangci-lint run --new-from-rev=origin/main ./resources/...reports 0 issues. The gosec findings left infile_carrier.goare on lines this PR does not touch.Producer side
Nothing produces an empty file carrier:
deliverByFilesetsFileonly when the value is aboveFileCarrierThreshold, and no other code sets it. This PR changes only what a reader accepts.🤖 Generated with Claude Code