carlos / platform Public

Test the purge's in-sweep rule: a granted record that is in the listing is not swept

The mutation that removes the rule passed the earlier cases, because none of
them put the record into the listing. This one lands it before the prefix is
listed.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 3d4104cb8436c722c2522d8be3455dfb4cd65bb8 parent 14d3af8
1 file changed, +7 −1
  • internal/release/trash_test.go +7 −1
diff --git a/internal/release/trash_test.go b/internal/release/trash_test.go
index 9638f140b..c2d5383ce 100644
--- a/internal/release/trash_test.go
+++ b/internal/release/trash_test.go
@@ -474,7 +474,7 @@ func TestPurgeAppRefusesUnreadableStoreRecord(t *testing.T) {
// grant that was admitted before the app was trashed and arrives now.
type landingStore struct {
Store
- at string // "get:<key>", "delete:<key>" or "cdelete:<key>"
+ at string // "get:<key>", "delete:<key>", "cdelete:<key>" or "list"
land func()
done bool
}
@@ -492,6 +492,11 @@ func (l *landingStore) Get(ctx context.Context, key string) ([]byte, string, err
return body, etag, err
}
+func (l *landingStore) List(ctx context.Context, prefix string) ([]string, error) {
+ l.fire("list")
+ return l.Store.List(ctx, prefix)
+}
+
func (l *landingStore) Delete(ctx context.Context, key string) error {
l.fire("delete:" + key)
return l.Store.Delete(ctx, key)
@@ -520,6 +525,7 @@ func TestPurgeAppNeverSweepsAStoreRecordGrantedDuringThePurge(t *testing.T) {
}{
{"between the guard's read and its delete", "get:" + storeKey, false},
{"as the declaration is being deleted", "cdelete:" + storeKey, false},
+ {"after the declaration was deleted and before the prefix is listed", "list", true},
{"during the sweep, after the declaration was deleted", "delete:" + appPrefix("bab", "derp") + "config.json", true},
{"as the marker is about to go", "delete:" + AppTombstoneKey("bab", "derp"), true},
} {