Repository navigation
Persist where a store was written instead of re-deriving it - #851
Merged
Merged
Conversation
Two subsystems shared one defect: the writer resolved a location at
runtime and the reader rebuilt the name from a convention, so the two
agreed only by coincidence.
resolveSchedulesBucket prefers the shared spawn-schedules-<region> and
falls back to an account-scoped spawn-schedules-<account>-<region> when
the shared name is taken by another account — and it RETURNS which one
it used. cmd/schedule.go discarded that, ScheduleRecord had no bucket
field, and the scheduler-handler rebuilt the name from the region alone.
So in any account that took the fallback path, every scheduled sweep
failed on a missing object. The record carries s3_params_bucket now and
the handler prefers it, falling back to the region template only for
records written before the field existed — right for those, since an
account on the fallback path would already have been failing.
`spawn queue results` derived spawn-results-<region> directly beneath a
comment saying it "should match what was specified in the queue config",
which it never loaded, while the writer uploads to the queue JSON's
result_s3_bucket. It worked for the wizard default and the bundled
examples, and not for pkg/queue/templates/*.json's {{S3_BUCKET}}, any
other bucket a user names, or the integration fixtures. Nothing persists
queue state server-side, so the reader can only be told or guess: it
takes --config or --bucket now, and ANNOUNCES the guess when given
neither, because guessing wrong produces an empty listing that looks
exactly like the queue having produced nothing. A --config declaring no
bucket is an error rather than a silent fall back.
Three notes on the gates, since two of them were wrong first.
The ordering assertion I started with compared source positions to
require that downloadParams consult the recorded bucket before the
region template. A revert computing the template first and then
overriding it PASSED — correctly, because computing-then-overriding is
equally valid. It was checking style, not mechanism. The decision is a
pure paramsBucket(recorded, region) now, with a behavioural table test
beside it, and the note replacing the assertion says why. Rule 6, fourth
time in this audit.
And `dynamodbav:"s3_params_bucket` is a PREFIX of
`dynamodbav:"s3_params_bucket_unused"`, so a revert renaming the field
slipped past two matchers. Rule 3 applies to a gate's own matcher as
much as to the code it guards.
Closes #804
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Closes #804.
Correctness audit 2026-10.Two subsystems, one defect: the writer resolved a location at runtime and the reader
rebuilt the name from a convention, so the two agreed only by coincidence.
1. Scheduled executions read a bucket they had never written to
resolveSchedulesBuckethandles the shared bucket name being taken by another account:It returns the one it used.
cmd/schedule.gothrew it away:ScheduleRecordhad no bucket field, and the handler rebuilt the name from the region:So in any account that took the fallback path, every scheduled sweep failed on a
missing object.
The record now carries
s3_params_bucketand the handler prefers it. The template remainsthe fallback for records written before the field existed, which is right for those: an
account on the fallback path would already have been failing, so a pre-existing record is
necessarily on the shared name.
2.
spawn queue resultslooked in the wrong bucketIt never loaded the config. The writer uploads to the queue JSON's
result_s3_bucket.It worked for the wizard default and the bundled examples — and not for
pkg/queue/templates/*.json's{{S3_BUCKET}}, for any other bucket a user names, or forthe integration fixtures.
Nothing persists queue state server-side (the config is a local JSON supplied at launch),
so the reader can only be told or guess. It now takes
--config(readingresult_s3_bucketandresult_s3_prefix) or--bucket, and announces the guess whengiven neither:
The announcement is the load-bearing part: guessing wrong produces an empty listing,
which is indistinguishable from the queue having produced nothing. A
--configthatdeclares no bucket is an error rather than a silent fall back to the guess.
Three notes on the gates, because two were wrong first
The ordering assertion I started with was checking style, not mechanism. It compared
source positions to require that
downloadParamsconsult the recorded bucket before theregion template. A revert that computed the template first and then overrode it passed —
and correctly, because computing-then-overriding is equally valid. The decision is now a
pure
paramsBucket(recorded, region)with a behavioural table test beside it in thehandler's own module, and the note replacing the assertion explains why. That is rule 6
for the fourth time in this audit — gating a correlate rather than the mechanism.
Two matchers were satisfied by a prefix.
dynamodbav:"s3_params_bucketis a prefix ofdynamodbav:"s3_params_bucket_unused", so a revert renaming the field slipped past them.Rule 3 applies to a gate's own matcher as much as to the code it guards.
Five compiling reverts, all now caught: the CLI discarding the bucket, the record field
renamed, the recorded bucket ignored, the queue flags removed, and the guess no longer
announcing itself.
Not addressed here
The issue's third suggestion — reconciling the two results-bucket naming schemes
(
spawn-results-<region>here vspkg/taskproto.DefaultResultsBucket'sspawn-results-<account>-<region>) — is a naming decision with a migration attached, not abug fix, so it stays open for #811's company rather than being guessed at.
Verification
make check(all nested modules),make check-docs, changelog gate,semgrep0 findings,make api-snapshotno drift, Tier 0 e2e with-count=1,go mod tidyclean inlambda/scheduler-handler.