@wairon/cli 5.1.1-dev.45 → 5.1.1-dev.46

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.
package/dist/cli/index.js CHANGED
@@ -65,7 +65,7 @@ var init_defaults = __esm({
65
65
  copilot: ".github/prompts",
66
66
  codex: ".codex/agents"
67
67
  };
68
- WAIRON_VERSION = "5.1.1-dev.45";
68
+ WAIRON_VERSION = "5.1.1-dev.46";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  SUPPORTED_ALIASES = ["wai"];
71
71
  SCAN_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
@@ -1943,8 +1943,12 @@ var init_specs = __esm({
1943
1943
  * so a lower detail dial no longer vouches for everything the component
1944
1944
  * declares. Each entry gets the same target validation a `call` step gets
1945
1945
  * (the component resolves, the caller declares it, the method is on its
1946
- * contract). Refused beside a non-empty narrative, where the steps already
1947
- * say what is called and a second spelling could only disagree.
1946
+ * contract) AND the same code↔spec reading (call-conformance, both
1947
+ * directions): an entry asserts the same call a step does, minus the
1948
+ * position in the flow that check never reads, so it can no more buy
1949
+ * reachability without the code than a step can. Refused beside a non-empty
1950
+ * narrative, where the steps already say what is called and a second
1951
+ * spelling could only disagree.
1948
1952
  */
1949
1953
  calls: import_zod7.z.array(import_zod7.z.string().min(1)).optional(),
1950
1954
  /**
@@ -13613,6 +13617,18 @@ function resolveCallTarget(ctx, componentId, methodName) {
13613
13617
  }
13614
13618
  return { accepted, files };
13615
13619
  }
13620
+ function claimsOf(implMethod) {
13621
+ const claims = [];
13622
+ for (const step of implMethod.narrative) {
13623
+ if (step.type !== "call" || !step.targetComponent || !step.targetMethod) continue;
13624
+ claims.push({ step: step.stepNumber, component: step.targetComponent, method: step.targetMethod });
13625
+ }
13626
+ for (const ref of implMethod.calls ?? []) {
13627
+ const parsed = parseDeclaredCall(ref);
13628
+ if (parsed) claims.push({ component: parsed.compId, method: parsed.methodName });
13629
+ }
13630
+ return claims;
13631
+ }
13616
13632
  function describeSite(site) {
13617
13633
  if (!site.member) return `${site.name}(\u2026)`;
13618
13634
  if (site.via) return `${site.via}.${site.name}(\u2026)`;
@@ -13621,23 +13637,26 @@ function describeSite(site) {
13621
13637
  return `<receiver>.${site.name}(\u2026)`;
13622
13638
  }
13623
13639
  function describeMiss(m) {
13624
- const head = `step ${m.step} \u2192 ${m.target} (looked for ${m.accepted.map((a) => `"${a}"`).join(" / ")}`;
13640
+ const where = m.step === void 0 ? "declared call" : `step ${m.step}`;
13641
+ const head = `${where} \u2192 ${m.target} (looked for ${m.accepted.map((a) => `"${a}"`).join(" / ")}`;
13625
13642
  if (m.miss.kind === "elsewhere") return `${head}, called but resolved to ${m.miss.landed.map((p) => `"${p}"`).join(", ")})`;
13626
13643
  if (m.miss.kind === "unresolved") return `${head}, written as ${m.miss.shapes.map((s) => `\`${s}\``).join(" / ")})`;
13627
13644
  return `${head})`;
13628
13645
  }
13629
- var callConformanceRule;
13646
+ var unitOf, claimNoun, callConformanceRule;
13630
13647
  var init_call_conformance = __esm({
13631
13648
  "src/core/rules/conformance/call-conformance.ts"() {
13632
13649
  "use strict";
13633
13650
  init_models();
13651
+ unitOf = (m) => m.step === void 0 ? m.target : `${m.step}:${m.target}`;
13652
+ claimNoun = (implMethod) => implMethod.narrative.length ? "narrative call step(s)" : "declared call(s)";
13634
13653
  callConformanceRule = {
13635
13654
  name: "call-conformance",
13636
- description: "Code\u2194spec Level 3: the narrative `call` step \u2194 realized call relation, judged both ways against the method's own source file (its sourcePath, else the implementation's), at exact analysis grade only. Forward: every `call` step must be realized by a call whose callee RESOLVES TO one of the target method's own source files \u2014 the target's contract name or a per-method `symbol` override, closed transitively over the named helpers the realized function calls, and resolved against every file the call CAN have reached: a `this.<field>.<method>()` receiver followed through the field's DECLARED TYPE, a `new Class(...).<method>()` receiver through the module its CLASS NAME came from. A matching call whose origin a pure model cannot resolve is reported apart as CALL_ORIGIN_UNRESOLVED, which NAMES the shape it could not follow and asks for nothing \u2014 a coverage hole in the reader, reported for the reason CONFORMANCE_DEGRADED is: a silently degraded gate is worse than a degraded one. A finding names a landing only from the PROVEN tier so that widening what a call reached can accept a step but never accuse one, and a target that names no file of its own falls back to name membership. Converse: a call that resolves to a modelled method of ANOTHER component in the SAME file crosses a component boundary while looking local, so the narrative must declare it (UNDECLARED_COLOCATED_CALL) \u2014 judged on the proven tier alone, and a same-file private helper is no modelled method and is never reported. Order, arguments and conditions stay unverified, dispatch steps (runtime-table routed) are skipped, the conformance dial (off) skips, and weaker analysis grades never guess.",
13655
+ description: "Code\u2194spec Level 3: the CLAIMED call \u2194 realized call relation, judged both ways against the method's own source file (its sourcePath, else the implementation's), at exact analysis grade only. A method claims a call two ways and they face one check: a narrative `call` step, and an entry of the declared `calls` a narrative-less method reaches its collaborators through. They assert the same thing, and the step number is no part of the claim \u2014 this check never reads order, so it is only how a finding points at one. Forward: every claim must be realized by a call whose callee RESOLVES TO one of the target method's own source files \u2014 the target's contract name or a per-method `symbol` override, closed transitively over the named helpers the realized function calls, and resolved against every file the call CAN have reached: a `this.<field>.<method>()` receiver followed through the field's DECLARED TYPE, a `new Class(...).<method>()` receiver through the module its CLASS NAME came from. A matching call whose origin a pure model cannot resolve is reported apart as CALL_ORIGIN_UNRESOLVED, which NAMES the shape it could not follow and asks for nothing \u2014 a coverage hole in the reader, reported for the reason CONFORMANCE_DEGRADED is: a silently degraded gate is worse than a degraded one. A finding names a landing only from the PROVEN tier so that widening what a call reached can accept a claim but never accuse one, and a target that names no file of its own falls back to name membership. Converse: a call that resolves to a modelled method of ANOTHER component in the SAME file crosses a component boundary while looking local, so the method must claim it \u2014 in a step or in `calls` (UNDECLARED_COLOCATED_CALL) \u2014 judged on the proven tier alone, and a same-file private helper is no modelled method and is never reported. A method that claims nothing at all is judged in neither direction: what it leaves unsaid is UNUSED_*'s subject. Order, arguments and conditions stay unverified, dispatch steps (runtime-table routed) are no claim about a call site, a malformed declared reference is MALFORMED_DECLARED_CALL's finding and names no target here, the conformance dial (off) skips, and weaker analysis grades never guess.",
13637
13656
  codes: [
13638
- { code: "CALL_STEP_UNREALIZED", defaultSeverity: "warning", summary: "Narrative call step realized by no call that resolves to the target method's own source file \u2014 the call is absent, or it lands in another module", carryable: true },
13639
- { code: "CALL_ORIGIN_UNRESOLVED", defaultSeverity: "warning", summary: "Narrative call step whose target name IS called, but only from call sites written in a shape this analysis cannot resolve to a file \u2014 the step was not checked, and is neither proven realized nor accused", carryable: true },
13640
- { code: "UNDECLARED_COLOCATED_CALL", defaultSeverity: "warning", summary: "The realized function calls a modelled method of another component living in the same source file, and no narrative step declares that call", carryable: true }
13657
+ { code: "CALL_STEP_UNREALIZED", defaultSeverity: "warning", summary: "Narrative call step or declared call realized by no call that resolves to the target method's own source file \u2014 the call is absent, or it lands in another module", carryable: true },
13658
+ { code: "CALL_ORIGIN_UNRESOLVED", defaultSeverity: "warning", summary: "Narrative call step or declared call whose target name IS called, but only from call sites written in a shape this analysis cannot resolve to a file \u2014 the claim was not checked, and is neither proven realized nor accused", carryable: true },
13659
+ { code: "UNDECLARED_COLOCATED_CALL", defaultSeverity: "warning", summary: "The realized function calls a modelled method of another component living in the same source file, and neither a narrative step nor a declared call names it", carryable: true }
13641
13660
  ],
13642
13661
  check(ctx) {
13643
13662
  const code = ctx.codeIndex();
@@ -13654,7 +13673,7 @@ var init_call_conformance = __esm({
13654
13673
  const { implementation: impl, method: implMethod, component, sourceFile: file } = entry;
13655
13674
  const tier = implMethod.conformance ?? impl.conformance ?? defaultConformanceTier(component);
13656
13675
  if (tier === "off") continue;
13657
- if (!implMethod.narrative.length) continue;
13676
+ if (!implMethod.narrative.length && !implMethod.calls?.length) continue;
13658
13677
  if (!file) continue;
13659
13678
  const facts = code.factsAt(file);
13660
13679
  if (!facts || facts.status !== "analyzed" || facts.analysisGrade !== "exact") continue;
@@ -13664,16 +13683,15 @@ var init_call_conformance = __esm({
13664
13683
  const sites = closedCallSites(code, file, fnSymbol);
13665
13684
  if (!sites) continue;
13666
13685
  const missed = [];
13667
- for (const step of implMethod.narrative) {
13668
- if (step.type !== "call" || !step.targetComponent || !step.targetMethod) continue;
13669
- if (!ctx.componentMap.has(step.targetComponent)) continue;
13670
- const target = resolveCallTarget(ctx, step.targetComponent, step.targetMethod);
13686
+ for (const claim of claimsOf(implMethod)) {
13687
+ if (!ctx.componentMap.has(claim.component)) continue;
13688
+ const target = resolveCallTarget(ctx, claim.component, claim.method);
13671
13689
  if (target.accepted.has(fnSymbol)) continue;
13672
13690
  const matching = sites.filter((s) => target.accepted.has(s.name));
13673
- const ref = `${step.targetComponent}.${step.targetMethod}`;
13691
+ const ref = `${claim.component}.${claim.method}`;
13674
13692
  if (target.files.size === 0) {
13675
13693
  if (matching.length === 0) {
13676
- missed.push({ step: step.stepNumber, target: ref, accepted: [...target.accepted], miss: { kind: "absent" } });
13694
+ missed.push({ step: claim.step, target: ref, accepted: [...target.accepted], miss: { kind: "absent" } });
13677
13695
  }
13678
13696
  continue;
13679
13697
  }
@@ -13687,7 +13705,7 @@ var init_call_conformance = __esm({
13687
13705
  }
13688
13706
  if (realized) continue;
13689
13707
  const miss = matching.length === 0 ? { kind: "absent" } : landed.size === 0 ? { kind: "unresolved", shapes: [...new Set(matching.map(describeSite))].sort() } : { kind: "elsewhere", landed: [...landed].sort() };
13690
- missed.push({ step: step.stepNumber, target: ref, accepted: [...target.accepted], miss });
13708
+ missed.push({ step: claim.step, target: ref, accepted: [...target.accepted], miss });
13691
13709
  }
13692
13710
  const unrealized = missed.filter((m) => m.miss.kind !== "unresolved");
13693
13711
  const unresolved = missed.filter((m) => m.miss.kind === "unresolved");
@@ -13695,30 +13713,36 @@ var init_call_conformance = __esm({
13695
13713
  ctx.addIssue(
13696
13714
  "warning",
13697
13715
  "CALL_STEP_UNREALIZED",
13698
- `Method "${implMethod.name}" in implementation "${impl.id}": ${unrealized.length} narrative call step(s) are realized by no call of the function "${fnSymbol}" in "${file}" that resolves to the target's own source file \u2014 ${unrealized.map(describeMiss).join("; ")}. Callees are closed over the named helpers the function calls, and each call site is resolved through this file's import bindings (order, arguments and conditions are not checked). Realize the calls, fix the narrative, or map code names via per-method symbols on the targets.`,
13716
+ `Method "${implMethod.name}" in implementation "${impl.id}": ${unrealized.length} ${claimNoun(implMethod)} are realized by no call of the function "${fnSymbol}" in "${file}" that resolves to the target's own source file \u2014 ${unrealized.map(describeMiss).join("; ")}. Callees are closed over the named helpers the function calls, and each call site is resolved through this file's import bindings (order, arguments and conditions are not checked). Realize the calls, fix what the method claims, or map code names via per-method symbols on the targets.`,
13699
13717
  impl.id,
13700
13718
  entry.draftContext,
13701
13719
  void 0,
13702
- // A step, named by its number and its target: what the register
13703
- // carries is ONE unresolved step, never "this method's call steps".
13704
- { at: implMethod.name, covers: unrealized.map((m) => `${m.step}:${m.target}`) }
13720
+ // One claim, named the way the register names a unit: a step by its
13721
+ // number and target, a declaration by its target alone. What the
13722
+ // register carries is ONE unrealized claim, never "this method's
13723
+ // calls".
13724
+ { at: implMethod.name, covers: unrealized.map(unitOf) }
13705
13725
  );
13706
13726
  }
13707
13727
  if (unresolved.length) {
13708
13728
  ctx.addIssue(
13709
13729
  "warning",
13710
13730
  "CALL_ORIGIN_UNRESOLVED",
13711
- `Method "${implMethod.name}" in implementation "${impl.id}": ${unresolved.length} narrative call step(s) ARE called by name inside the function "${fnSymbol}" in "${file}", but every site calling them is written in a shape this analysis cannot resolve to a file \u2014 ${unresolved.map(describeMiss).join("; ")}. What resolves is a name bound to a module of THIS project: a bare or namespaced call through such an import binding, a \`this.<field>\` receiver whose declared type names one, a \`new Class(\u2026)\` receiver whose class does. What does not: an import from a PACKAGE specifier, a receiver holding a value the module assembled, a receiver this model records no name for. This reports what was not checked, not what is wrong \u2014 the step is neither proven realized nor accused of being missing, and no working call is asked to be rewritten to suit the reader.`,
13731
+ `Method "${implMethod.name}" in implementation "${impl.id}": ${unresolved.length} ${claimNoun(implMethod)} ARE called by name inside the function "${fnSymbol}" in "${file}", but every site calling them is written in a shape this analysis cannot resolve to a file \u2014 ${unresolved.map(describeMiss).join("; ")}. What resolves is a name bound to a module of THIS project: a bare or namespaced call through such an import binding, a \`this.<field>\` receiver whose declared type names one, a \`new Class(\u2026)\` receiver whose class does. What does not: an import from a PACKAGE specifier, a receiver holding a value the module assembled, a receiver this model records no name for. This reports what was not checked, not what is wrong \u2014 the claim is neither proven realized nor accused of being missing, and no working call is asked to be rewritten to suit the reader.`,
13712
13732
  impl.id,
13713
13733
  entry.draftContext,
13714
13734
  void 0,
13715
- { at: implMethod.name, covers: unresolved.map((m) => `${m.step}:${m.target}`) }
13735
+ { at: implMethod.name, covers: unresolved.map(unitOf) }
13716
13736
  );
13717
13737
  }
13718
13738
  const declared = /* @__PURE__ */ new Set();
13719
13739
  for (const step of implMethod.narrative) {
13720
13740
  if (step.targetComponent && step.targetMethod) declared.add(`${step.targetComponent}.${step.targetMethod}`);
13721
13741
  }
13742
+ for (const ref of implMethod.calls ?? []) {
13743
+ const parsed = parseDeclaredCall(ref);
13744
+ if (parsed) declared.add(`${parsed.compId}.${parsed.methodName}`);
13745
+ }
13722
13746
  const crossings = /* @__PURE__ */ new Map();
13723
13747
  for (const site of closedCallSites(code, file, fnSymbol, new Set(colocated.keys())) ?? []) {
13724
13748
  const owner = colocated.get(site.name);
@@ -13733,7 +13757,7 @@ var init_call_conformance = __esm({
13733
13757
  ctx.addIssue(
13734
13758
  "warning",
13735
13759
  "UNDECLARED_COLOCATED_CALL",
13736
- `Method "${implMethod.name}" in implementation "${impl.id}": the function "${fnSymbol}" in "${file}" calls ${crossings.size} modelled method(s) of OTHER components living in that same file, and no narrative step declares the call \u2014 ${detail}. Sharing a file does not make the hop internal: it crosses a component boundary nothing imports, so no file-level check can see it. Narrate the call, or move the code so the boundary is real.`,
13760
+ `Method "${implMethod.name}" in implementation "${impl.id}": the function "${fnSymbol}" in "${file}" calls ${crossings.size} modelled method(s) of OTHER components living in that same file, and neither a narrative step nor a declared call names it \u2014 ${detail}. Sharing a file does not make the hop internal: it crosses a component boundary nothing imports, so no file-level check can see it. Narrate the call, declare it in \`calls\`, or move the code so the boundary is real.`,
13737
13761
  impl.id,
13738
13762
  entry.draftContext,
13739
13763
  void 0,