@autotelic/joggle 0.7.2 → 0.8.1

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/JOGGLE.md CHANGED
@@ -438,6 +438,11 @@ and every CI checkout. GitHub warns above **50 MB per file** and refuses above
438
438
  way. Without that, a tsconfig that includes `dist` made every declaration appear twice, and
439
439
  the report said "declared in two places" about a build artifact — 73 of 95 findings on one
440
440
  repository, present on a developer's machine and absent in CI because CI had never built.
441
+ - **The analysed set is machine-readable.** `--format json` carries a `discovery` block —
442
+ files analysed, files and directories ignored, extensions skipped, whether the walk was
443
+ truncated — and `--list-files` adds the paths. Two checkouts of one commit that report
444
+ different findings differ either in that set or in its verdicts, and the JSON used to show
445
+ neither: the census was prose and the list was never emitted.
441
446
  - **A run says how it got its answers.** "N judgement(s) were asked of the model" means a
442
447
  key was present and this run judged for itself; "N judgement(s) were replayed" means no model
443
448
  was called. The two can name the same site differently, so a local report and a CI report at
package/dist/check.js CHANGED
@@ -908,6 +908,18 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
908
908
  duplicated,
909
909
  overloaded,
910
910
  };
911
+ const seen = {
912
+ analysed: workspace.files.length,
913
+ ignored: discovery.ignored,
914
+ ignoredDirectories: discovery.ignoredDirectories,
915
+ truncated: discovery.truncated,
916
+ skippedExtensions: discovery.skippedExtensions,
917
+ };
918
+ // Only when asked: the list is thousands of lines, and the reason to ask is exactly "diff
919
+ // these two trees".
920
+ if (options.listFiles === true) {
921
+ Object.assign(seen, { paths: workspace.files.map((file) => file.path).sort(Order.String) });
922
+ }
911
923
  const decisionTotals = yield* decisionStats.read;
912
924
  // Say how the answers were obtained. A keyed run judges live and a keyless one replays,
913
925
  // and the two can name the same site differently — which is the whole difference between
@@ -924,7 +936,7 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
924
936
  notes.push({
925
937
  ruleId: "joggle",
926
938
  reason: decisionTotals.replayed +
927
- " judgement(s) were replayed from the answer cache; no model was called",
939
+ " judgement(s) were replayed from a cache — the committed ledger and this machine's wire cache — and no model was called. A cold CI run has neither, so it judges nothing and names the same sites differently",
928
940
  });
929
941
  }
930
942
  const elapsedMs = (yield* Clock.currentTimeMillis) - started;
@@ -933,6 +945,7 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
933
945
  files: workspace.files.length,
934
946
  rules: effective.length,
935
947
  structure,
948
+ discovery: seen,
936
949
  skipped,
937
950
  notes,
938
951
  drops,
package/dist/decision.js CHANGED
@@ -189,7 +189,15 @@ export const layer = (options) => Layer.effectContext(Effect.gen(function* () {
189
189
  readOnly: options.readOnly,
190
190
  });
191
191
  const planAnswers = {
192
- get: (key) => Effect.map(answers.get(key), (stored) => Option.map(stored, answerOf)),
192
+ // An answer served from the ledger is a replay, and the stats said otherwise: a run
193
+ // whose 95 findings all came from cached verdicts reported "0 replayed, 0 calls", so
194
+ // the census could not tell a warm machine from a cold one.
195
+ get: (key) => Effect.tap(answers.get(key), (stored) => Option.isSome(stored)
196
+ ? Ref.update(stats, (current) => ({
197
+ ...current,
198
+ replayed: current.replayed + 1,
199
+ }))
200
+ : Effect.void).pipe(Effect.map((stored) => Option.map(stored, answerOf))),
193
201
  put: (key, answer) => answers.put(key, storedOf(answer)),
194
202
  };
195
203
  // Every answer is remembered per decision, so the committed cache is the
package/dist/main.js CHANGED
@@ -88,6 +88,7 @@ const checkCommand = Command.make("check", {
88
88
  baseline: Flag.String("baseline").pipe(Flag.withDescription("Report only findings not already accepted in this baseline file."), Flag.optional),
89
89
  updateBaseline: Flag.String("update-baseline").pipe(Flag.withDescription("Write the current findings to this file as the accepted baseline."), Flag.optional),
90
90
  mergeBaseline: Flag.Boolean("merge-baseline").pipe(Flag.withDescription("With --update-baseline, keep the identities already in that file and add this run's. A scoped run (--since) judges all of its own files, so this grows a ledger by one change instead of replacing it."), Flag.withDefault(false)),
91
+ listFiles: Flag.Boolean("list-files").pipe(Flag.withDescription("Include the analysed file paths in the report's discovery block (--format json). The only honest way to answer why two checkouts of one commit report different findings is to diff their file lists."), Flag.withDefault(false)),
91
92
  readOnly: Flag.Boolean("read-only").pipe(Flag.withDescription("Answer from the cache and never write it. Set for every engine jig runs: a check must not edit the tree it judges, because new answers rename the findings they verify."), Flag.withDefault(false)),
92
93
  allowScopedBaseline: Flag.Boolean("allow-scoped-baseline").pipe(Flag.withDescription("Write a ledger from a scoped run. Refused by default: a scoped run's identities are not a subset of a full run's, so the ledger can miss the identity CI reports. Accept from a full run instead."), Flag.withDefault(false)),
93
94
  allowUnjudgedBaseline: Flag.Boolean("allow-unjudged-baseline").pipe(Flag.withDescription("Write the baseline even though some candidates were not judged. A baseline is what was reviewed; this is the explicit way to accept that some of it was not."), Flag.withDefault(false)),
@@ -179,6 +180,7 @@ const checkCommand = Command.make("check", {
179
180
  allowUnjudgedBaseline: config.allowUnjudgedBaseline,
180
181
  mergeBaseline: config.mergeBaseline,
181
182
  allowScopedBaseline: config.allowScopedBaseline,
183
+ listFiles: config.listFiles,
182
184
  }).pipe(Effect.provide(Layer.mergeAll(rulesLayer, decisionLayer({
183
185
  cacheDir,
184
186
  wireCacheDir: machineCache,
package/dist/report.js CHANGED
@@ -432,6 +432,7 @@ const json = (report) => JSON.stringify({
432
432
  // artifact that hid where the candidates went -- and reading it is how the
433
433
  // gated band below was found.
434
434
  drops: report.drops,
435
+ discovery: report.discovery,
435
436
  },
436
437
  }, null, 2);
437
438
  /** GitHub Actions workflow commands, so CI annotations come for free. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autotelic/joggle",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
4
4
  "type": "module",
5
5
  "description": "Cross-file patterns and idioms for TypeScript — the layer above the linter and the typechecker.",
6
6
  "license": "MIT",