merge: enforce CI gates the contributor rules already required (D1, A3, A4, D2)

Add cargo fmt --check (strict) and cargo clippy (advisory) to CI, ratchet the
traceability threshold 50 -> 82, add a dangling-ID gate, and fix the
offlineCatalog flake (cold dynamic import, not a timer).
This commit is contained in:
2026-08-16 23:00:58 +02:00
11 changed files with 355 additions and 31 deletions
+23 -1
View File
@@ -23,6 +23,13 @@ const h = vi.hoisted(() => {
fn(value);
return () => subs.delete(fn);
},
// Drop subscribers left behind by module instances discarded via
// `vi.resetModules()`. Without this, every previously-imported copy of the
// service still reacts to `set()` and pushes its own visibility value.
reset(v: T) {
subs.clear();
value = v;
},
};
}
return {
@@ -31,6 +38,21 @@ const h = vi.hoisted(() => {
};
});
// Prime the module graph once, at collection time, instead of inside a test.
//
// Every test re-imports the service after `vi.resetModules()` so it gets a fresh
// set of module-level subscriptions. The *first* of those imports also pays to
// transform the service and its dependency graph — around a second of real
// wall-clock work with a cold Vite cache. Charged to a test body that cost sat
// close enough to vitest's 5s default that suite-wide contention (many workers
// transforming at once) tipped this file into a timeout, while running the file
// alone always passed. Warming here moves the compile out of the timed region;
// the per-test re-imports that follow are cached and cost ~30ms.
//
// The timeout is deliberately left at the default: the point is to stop timing
// the compiler, not to give it a bigger budget.
await import("./offlineCatalog");
vi.mock("$lib/stores/connectivity", () => ({
isConnected: { subscribe: h.isConnectedStore.subscribe },
}));
@@ -50,8 +72,8 @@ vi.mock("$lib/stores/auth", () => ({
describe("pushCatalogVisibility resolves reachable || showCatalog (UT-068)", () => {
beforeEach(() => {
h.isConnectedStore.reset(true);
h.setShowServerCatalog.mockClear();
h.isConnectedStore.set(true);
vi.resetModules();
});