candor-ts 0.7.1 → 0.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "candor-ts",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "candor for TypeScript — per-function side effects, transitively, with a policy gate (candor-spec 0.5)",
5
5
  "type": "module",
6
6
  "dependencies": {
package/query-core.mjs CHANGED
@@ -247,8 +247,13 @@ function commonPrefixLen(fns) {
247
247
  return (best ?? []).length;
248
248
  }
249
249
  function layerOf(fn, prefixLen) {
250
+ // The layer = the first segment after the common prefix, the leaf excluded. candor-ts names functions
251
+ // with a FILE.fn (free fns) or FILE.Class.method tail — a SHALLOW 1-segment-minimum tail — so the rule is
252
+ // `prefixLen + 1 < length` (matching candor-rust's layer_of). candor-java uses `+2` because its names carry
253
+ // an extra Package.Class.method segment; copying that here collapsed every 2-segment free function to
254
+ // "(root)", killing the dispersion signal on real TS reports.
250
255
  const segs = fn.split(".");
251
- return prefixLen + 2 < segs.length ? segs[prefixLen] : "(root)";
256
+ return prefixLen + 1 < segs.length ? segs[prefixLen] : "(root)";
252
257
  }
253
258
  export function containment(fns, baseFns) {
254
259
  const pl = commonPrefixLen(fns);
package/query.mjs CHANGED
@@ -89,7 +89,12 @@ switch (cmd) {
89
89
  // new leak), matching candor-java / candor-query. JSON-only, like every other candor-ts query command.
90
90
  const [prefix, basePrefix] = args;
91
91
  if (basePrefix) {
92
- const r = coreContainment(loadReport(prefix), loadReport(basePrefix));
92
+ const baseFns = loadReport(basePrefix);
93
+ if (baseFns.length === 0) { // fail CLOSED (exit 2), not a wall of bogus "everything leaked" (exit 1)
94
+ console.error(`candor-ts: no report at baseline prefix '${basePrefix}' — check the path`);
95
+ process.exit(2);
96
+ }
97
+ const r = coreContainment(loadReport(prefix), baseFns);
93
98
  emit(r);
94
99
  process.exit(r.leaks.length ? 1 : 0);
95
100
  }