test: update tests left stale by logging and metadata changes

- large-repository-tree: queued jobs now carry a logJobId trace id
  (structured logging); assert it instead of an exact job payload.
- repository-activity: FileModel.exists() is chained with .hint() since
  #951; stub it with a query-like object.
- performance-integration: staged markers are cleared through
  File.collection.updateMany since #951, so the old Model.updateMany stub
  never injected the interruption.
- performance-worker: workers report fixed codes only, so a regex
  timeout surfaces as anonymization_deadline_exceeded; the elapsed bound
  still proves the 1s regex deadline applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Thomas DurieuxandClaude Opus 5.5 committed 2026-11-29 07:54:00 +00:00
1 parent 23384dad92
commit 7bc4475b02
4 files changed
+16 -9

No files matched your search

+5 -4
View File
@@ -996,13 +996,14 @@ const uri = process.env.PERFORMANCE_MONGO_URI;
const row = await Repo.create({ repoId: "active-staged", status: "ready", statusDate: new Date(), lastView: new Date(),
treeGeneration: "old", source: { type: "GitHubStream" }, options: { expirationMode: "never" } });
await File.create({ repoId: row.repoId, treeGeneration: "old", path: "", name: "old.txt" });
const repo = new Repository(row), updateMany = File.updateMany;
// Completion clears markers through the driver collection (clearStagedRowsInBatches).
const repo = new Repository(row), updateMany = File.collection.updateMany;
Object.defineProperty(repo, "source", { get: () => ({ getFiles: async () => [{ path: "", name: "active.txt", size: 1 }] }) });
File.updateMany = function (filter, ...args) {
if (filter.treeStaged) return { exec: async () => { throw Error("marker cleanup interrupted"); } };
File.collection.updateMany = function (filter, ...args) {
if (filter.treeStaged) return Promise.reject(Error("marker cleanup interrupted"));
return updateMany.call(this, filter, ...args);
};
try { await repo.files({ force: true }); } finally { File.updateMany = updateMany; }
try { await repo.files({ force: true }); } finally { File.collection.updateMany = updateMany; }
expect(await File.countDocuments({ treeStaged: true })).to.equal(1);
await require("../src/server/schedule").runRepositoryStatusCheck();
expect((await File.find({ repoId: row.repoId })).map(file => file.name)).to.deep.equal(["active.txt"]);