@afokapu/atdd-bun 0.10.30 → 0.10.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -337,6 +337,7 @@ export function unbuiltWagons(croot, trainId) {
337
337
  let sourceRoot = "src/wagons";
338
338
  try { sourceRoot = Bun.YAML.parse(readText(join(croot, "atdd-bun.yaml")))?.topology?.source_root || sourceRoot; } catch { /* default layout */ }
339
339
  const hasSource = (wagon) => [...walkFiles(join(croot, sourceRoot, wagon), isTs)].some((f) => !/\.(test|spec)\.[cm]?[jt]sx?$/.test(f));
340
+ const produces = new Map();
340
341
  (function rec(dir) {
341
342
  let entries;
342
343
  try { entries = readdirSync(dir).sort(); } catch { return; }
@@ -348,6 +349,8 @@ export function unbuiltWagons(croot, trainId) {
348
349
  if (!/\.ya?ml$/.test(name)) continue;
349
350
  let doc;
350
351
  try { doc = Bun.YAML.parse(readText(full)); } catch { continue; }
352
+ if (doc && typeof doc.wagon === "string" && Array.isArray(doc.produce))
353
+ produces.set(doc.wagon.trim(), doc.produce.map((p) => p?.name).filter((name) => typeof name === "string" && name));
351
354
  if (!doc || typeof doc.train_id !== "string" || !Array.isArray(doc.sequence)) continue;
352
355
  const wagons = new Set(doc.sequence.flatMap((step) => [step?.from, step?.to]).filter((end) => typeof end === "string" && end.startsWith("wagon:")).map((end) => end.slice(6).trim()));
353
356
  byTrain.set(doc.train_id, [...wagons]);
@@ -355,7 +358,18 @@ export function unbuiltWagons(croot, trainId) {
355
358
  })(join(croot, PLAN_ROOT));
356
359
  // Only a repository that keeps wagon code under the source root can show a wagon as not built yet. Where no wagon has
357
360
  // source there (the code lives elsewhere, as in decision-os), nothing is pending and every route is judged.
358
- const built = new Map([...new Set([...byTrain.values()].flat())].map((wagon) => [wagon, hasSource(wagon)]));
361
+ // A wagon coded outside the source root is built all the same when Cargo-moving code names an artifact it produces:
362
+ // the wagon-contract rule's own evidence (C1 #lVuJXXe3mM9E). Comments are masked, tests are not read.
363
+ let cargoCode = null;
364
+ const named = (wagon) => {
365
+ const names = produces.get(wagon) ?? [];
366
+ if (!names.length) return false;
367
+ cargoCode ??= [...walkFiles(croot, isTs)].filter((f) => !/\.(test|spec)\.[cm]?[jt]sx?$/.test(f)).map((f) => readText(f) ?? "")
368
+ .filter((text) => /\bCargo\b|\bcargo\s*\.\s*(?:put|get)\s*\(/.test(text))
369
+ .map((text) => text.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:\\])\/\/[^\n]*/g, "$1")).join("\n");
370
+ return names.some((name) => cargoCode.includes(name));
371
+ };
372
+ const built = new Map([...new Set([...byTrain.values()].flat())].map((wagon) => [wagon, hasSource(wagon) || named(wagon)]));
359
373
  const layoutInUse = [...built.values()].some(Boolean);
360
374
  for (const [trainId, wagons] of byTrain) byTrain.set(trainId, layoutInUse ? wagons.filter((wagon) => !built.get(wagon)) : []);
361
375
  pendingCache.set(croot, byTrain);
package/integrity.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.10.30",
2
+ "version": "0.10.31",
3
3
  "files": {
4
4
  "HOOK_AUDIT.md": "5329d840db37671b1918f688ead26865473b87db73dbc75f7c8b2a8bbe8d6d43",
5
5
  "PLANNER_PORT.md": "fb5935bac8b7ac18994de21e43ace3a5ef8cd55f85b0e3349fca261280054f11",
@@ -379,7 +379,7 @@
379
379
  "detectors/bun_interlocking_binding/fixtures/dirty_transcribed_runtime/server.ts": "d5bc34c5b1b2b0a511e0c4604ce6f9c77491dca9aee994be720540f3052babc1",
380
380
  "detectors/bun_interlocking_binding/fixtures/dirty_transcribed_runtime/src/trains/interlocking.ts": "9bcfdb4ecff6efd1f658b9fd587342615179924e25468c75daa07c2626d4d8ab",
381
381
  "detectors/bun_interlocking_binding/fixtures/dirty_transcribed_runtime/src/trains/runner.ts": "0e4b885e50f12cc2a8c8f6740bf83e7b2e7137a28e1e143586e9a8550ea5bd45",
382
- "detectors/bun_interlocking_coverage/_shared/interlocking.mjs": "99983d159528c7ef4e0a72f39f0dcc9977ffdcce728d52b83c4ef5bc70f2a3ec",
382
+ "detectors/bun_interlocking_coverage/_shared/interlocking.mjs": "448ba5f8561d225eef0e9fd8cc8c7a0bcfc755ad0214ff5758a7aefbbf35283c",
383
383
  "detectors/bun_interlocking_coverage/atdd.implementation.yaml": "f160517a8138ba3ca05e3d130e6fbfb796e643376f25743fdef4fc210196525b",
384
384
  "detectors/bun_interlocking_coverage/checks/_map.json": "0a218ea319cc6258af7bd721c2154cb9561fe67e80d80ef32d08fc77bc9403c3",
385
385
  "detectors/bun_interlocking_coverage/checks/interlocking_production_runner.mjs": "a1edd5aa15892564aa8d46a93dca2d17001901e90085cd660be192a2ec747c1f",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afokapu/atdd-bun",
3
- "version": "0.10.30",
3
+ "version": "0.10.31",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/afokapu/atdd-bun.git"