test(05-02): tighten loader-env L3 to require pair 1 serving at pinned origin (RED)

- L3 previously pinned the 05-01 empty-seed state (honest null at the pinned origin)
- it now asserts the default fixture source SERVES pair 1 (kl-tower-to-kl-sentral)
  at its pinned public origin and resolves honest null ~300 m away (outside the
  200 m tolerance, D-03)
- RED until plan 05-02 populates the committed fixture dataset
This commit is contained in:
araharah-executor
2026-10-24 05:14:15 +08:00
parent 48627d4102
commit 01b0ed6884
+27 -7
View File
@@ -14,9 +14,11 @@
* L2 esbuild — the bundler family of BOTH wrangler and Vite INLINES the
* seed: the bundle text carries the `router.project-osrm.org` marker
* (the `_source` header survives inlining)
* L3 the committed EMPTY seed serves null through the whole default path
* (static import -> lazy index -> route()) — the honest corpus state
* until plan 05-02 fills it
* L3 the committed corpus serves pair 1 (kl-tower-to-kl-sentral) through
* the whole default path (static import -> lazy index -> route()) at
* its PINNED PUBLIC origin, and resolves honest null for an origin
* ~300 m away (outside the 200 m tolerance — D-03). The empty-seed
* state was 05-01's; plan 05-02 arms this gate with the real corpus.
*
* Run: npm run routing:test (exit 0 = all green)
*/
@@ -74,17 +76,35 @@ test("L2 esbuild bundle marker — the wrangler/Vite bundler family inlines the
);
});
test("L3 the empty committed seed serves null — the honest corpus state until 05-02", async () => {
test("L3 the committed corpus serves pair 1 at its pinned origin; honest null ~300 m away", async () => {
const mod = await loadIndex();
const source = mod.createFixtureRoutingSource();
assert.equal(source.name, "fixture");
const result = await source.route({
// Pair 1 of the pinned corpus (kl-tower-to-kl-sentral): a request at the
// PINNED PUBLIC origin must serve through the whole default path.
const served = await source.route({
origin: { lat: 3.1528, lng: 101.7038 },
destinationId: "kl-sentral",
});
assert.ok(
served,
"the committed corpus must serve pair 1 (kl-tower-to-kl-sentral) at its pinned origin — an empty seed is the 05-01 state, never the shipped one",
);
assert.equal(served.backend, "fixture");
assert.equal(served.destinationId, "kl-sentral");
assert.ok(
served.options.length >= 1,
"at least the best (index-0) route serves, best-first order",
);
// ~0.0027 deg lat ≈ 300 m — OUTSIDE the 200 m origin tolerance. The honest
// "router pending" null (D-03), never a nearest-match fabrication.
const pending = await source.route({
origin: { lat: 3.1528 + 0.0027, lng: 101.7038 },
destinationId: "kl-sentral",
});
assert.equal(
result,
pending,
null,
"the committed empty corpus must parse through the whole path and serve honest null",
"an origin ~300 m from the pinned pair origin is outside the 200 m tolerance — honest null (D-03)",
);
});