@autotelic/joggle 0.6.1 → 0.7.0

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,13 @@ 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 check does not write the ledger at all.** `--read-only` (and any run `jig` starts,
436
+ which exports `JIG_READ_ONLY=1` to every engine) answers from the cache and never writes
437
+ it. This is not hygiene: a new answer *renames* the finding it verifies, so a check that
438
+ judged and wrote would re-open identities the baseline already accepted, and the next run
439
+ would fail on files the change never touched. One pull request's lint run appended 919
440
+ answers that way and re-opened 91 findings in a rule whose ledger entries were intact.
441
+ Warming the ledger is a deliberate act: `joggle check` on trunk, or `--update-baseline`.
435
442
  - **A scoped run does not write the committed ledger.** `--since`, `--pr` and
436
443
  `--changed` answer into the machine cache unless `--cache-dir` names a store: a
437
444
  branch's verdicts are a cache, and committing them is what put 131,440 lines in
@@ -441,6 +448,14 @@ and every CI checkout. GitHub warns above **50 MB per file** and refuses above
441
448
  `merge=union` kept both sides on every rebase. The line is now the key and the
442
449
  answer only, so merges collapse to one line; for a history that already grew,
443
450
  compact reads each key once and rewrites the set. No re-judging, no key needed.
451
+ - **Deduplicating an old ledger is safe on a keyless CI today**, so nobody has to wait
452
+ for this version to shrink one: the stamps were never load-bearing for replay. A
453
+ parked stack deduplicated by key in the old three-field format (keeping the newest
454
+ stamp) went from 55.4 MB / 372,623 lines to 1.21 MB / 8,171 answers, and the
455
+ keyless lint job stayed green on the same answers.
456
+ - **Compaction is a commit, so it re-dirties every child of a stack.** Compact
457
+ bottom-up in one pass, or compact the base branch once after the stack merges —
458
+ compacting a parent mid-stack costs one rebase per child for a diff nobody reads.
444
459
 
445
460
  ## Two committed artifacts, two machine artifacts
446
461
 
@@ -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/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.1",
3
+ "version": "0.7.0",
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",