@autotelic/joggle 0.6.2 → 0.7.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
@@ -432,6 +432,17 @@ and every CI checkout. GitHub warns above **50 MB per file** and refuses above
432
432
  `--max-age 90` needs ages, which only the machine cache records.
433
433
  - A run says so when the store passes 8 MB, because a cache nobody measured is how
434
434
  a 0-byte ledger on the base branch becomes 55 MB at the top of a stack.
435
+ - **A run says how it got its answers.** "N judgement(s) were asked of the model" means a
436
+ key was present and this run judged for itself; "N judgement(s) were replayed" means no model
437
+ was called. The two can name the same site differently, so a local report and a CI report at
438
+ the same commit are only comparable when this line matches.
439
+ - **A check does not write the ledger at all.** `--read-only` (and any run `jig` starts,
440
+ which exports `JIG_READ_ONLY=1` to every engine) answers from the cache and never writes
441
+ it. This is not hygiene: a new answer *renames* the finding it verifies, so a check that
442
+ judged and wrote would re-open identities the baseline already accepted, and the next run
443
+ would fail on files the change never touched. One pull request's lint run appended 919
444
+ answers that way and re-opened 91 findings in a rule whose ledger entries were intact.
445
+ Warming the ledger is a deliberate act: `joggle check` on trunk, or `--update-baseline`.
435
446
  - **A scoped run does not write the committed ledger.** `--since`, `--pr` and
436
447
  `--changed` answer into the machine cache unless `--cache-dir` names a store: a
437
448
  branch's verdicts are a cache, and committing them is what put 131,440 lines in
@@ -381,6 +381,8 @@ export const make = (fs, path, dir, options = {}) => Effect.gen(function* () {
381
381
  return {
382
382
  get: (key) => Effect.map(Ref.get(entries), (current) => Option.fromUndefinedOr(current.get(key)?.answer)),
383
383
  put: (key, answer) => Effect.gen(function* () {
384
+ if (options.readOnly === true)
385
+ return;
384
386
  const entry = options.timestamps === true
385
387
  ? { key, writtenAt: seconds(yield* Clock.currentTimeMillis), answer }
386
388
  : { key, answer };
package/dist/check.js CHANGED
@@ -909,6 +909,24 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
909
909
  overloaded,
910
910
  };
911
911
  const decisionTotals = yield* decisionStats.read;
912
+ // Say how the answers were obtained. A keyed run judges live and a keyless one replays,
913
+ // and the two can name the same site differently — which is the whole difference between
914
+ // a developer's machine and CI at the same commit. Without this line the report looks the
915
+ // same either way, and the difference is found by bisecting a ledger.
916
+ if (decisionTotals.calls > 0) {
917
+ notes.push({
918
+ ruleId: "joggle",
919
+ reason: decisionTotals.calls +
920
+ " judgement(s) were asked of the model in this run: a key was present, so this run judged for itself. A run without the key replays the committed answers, and judged identities are not always the unverified ones — compare this report with CI's before treating a difference as a code change.",
921
+ });
922
+ }
923
+ else if (decisionTotals.replayed > 0) {
924
+ notes.push({
925
+ ruleId: "joggle",
926
+ reason: decisionTotals.replayed +
927
+ " judgement(s) were replayed from the answer cache; no model was called",
928
+ });
929
+ }
912
930
  const elapsedMs = (yield* Clock.currentTimeMillis) - started;
913
931
  const report = {
914
932
  diagnostics: rankDiagnostics(folded.diagnostics),
package/dist/decision.js CHANGED
@@ -186,6 +186,7 @@ export const layer = (options) => Layer.effectContext(Effect.gen(function* () {
186
186
  const answers = yield* makeAnswerStore(fs, path, options.cacheDir, {
187
187
  layout: options.layout,
188
188
  timestamps: options.timestamps,
189
+ readOnly: options.readOnly,
189
190
  });
190
191
  const planAnswers = {
191
192
  get: (key) => Effect.map(answers.get(key), (stored) => Option.map(stored, answerOf)),
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
+ 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)),
91
92
  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)),
92
93
  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)),
93
94
  cacheDir: Flag.String("cache-dir").pipe(Flag.withDescription("Where the answer cache lives: <cwd>/.joggle when it exists (an onboarded repository), otherwise the machine cache."), Flag.optional),
@@ -185,6 +186,7 @@ const checkCommand = Command.make("check", {
185
186
  apiKey,
186
187
  layout: effective.cache?.layout,
187
188
  timestamps: cacheDir === machineCache,
189
+ readOnly: config.readOnly || process.env["JIG_READ_ONLY"] === "1",
188
190
  }), tsgoLayer(cwd, {
189
191
  runExternalCode: config.runExternalCode || effective.runExternalCode === true,
190
192
  }))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autotelic/joggle",
3
- "version": "0.6.2",
3
+ "version": "0.7.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",