Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/control-core/src/replacement-evidence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ export class ReplacementEvidence {
}
async records(): Promise<RunRecordV1[]> {
const listing = await this.directory("runs/", []);
return evidenceMap(listing.directories, async (prefix) => {
// The Bucket can hold other folders under runs/; only run identities have records.
const runs = listing.directories.filter((prefix) =>
/^runs\/run-[0-9a-f]{24}\/$/.test(prefix),
);
return evidenceMap(runs, async (prefix) => {
const record = validateRunRecord(await this.read(`${prefix}run.json`));
if (prefix !== `runs/${record.run_id}/`)
throw new ReplacementError(409, "Run record identity mismatch");
Expand Down
8 changes: 8 additions & 0 deletions packages/control-core/test/replacements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,14 @@ describe("native leaderboard metric authority", () => {
expect(view.assembly.result.trial_results).toBe(selected);
}
});
it("skips Bucket folders under runs/ that are not run identities", async () => {
await putJson(store, "runs/legacy-smoke/result.json", {});
const records = await new ReplacementEvidence(store).records();
expect(records.map((record) => record.run_id)).toContain(source.run_id);
expect(records.every((record) => /^run-[0-9a-f]{24}$/.test(record.run_id))).toBe(
true,
);
});
it("withholds relationships from fresh records even before projection repair", async () => {
const records = await new ReplacementEvidence(store).records();
records.push({
Expand Down
Loading