@autotelic/joggle 0.4.5 → 0.5.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 +23 -14
- package/dist/check.js +15 -5
- package/dist/main.js +2 -0
- package/package.json +1 -1
package/JOGGLE.md
CHANGED
|
@@ -488,23 +488,32 @@ full-repository budget: at ~2.5k candidates a keyed run, a repository with 12k
|
|
|
488
488
|
unjudged candidates is a 25-minute run that still refuses to write.
|
|
489
489
|
|
|
490
490
|
```sh
|
|
491
|
-
|
|
491
|
+
# the gate: what this branch adds, judged
|
|
492
|
+
joggle check --types --no-replay --since origin/<parent> --baseline .joggle/baseline
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
**A scoped run is for the gate. Acceptance is a full-run act**, and the command
|
|
496
|
+
enforces it: `--update-baseline` refuses a scoped run unless
|
|
497
|
+
`--allow-scoped-baseline` says otherwise.
|
|
498
|
+
|
|
499
|
+
The reason is the fold. Two findings at the same site with the same move are folded
|
|
500
|
+
into the richer one, and which survivor wins depends on what ran: a scoped run sees
|
|
501
|
+
fewer candidates at that site than a full run does, so it can name the problem with
|
|
502
|
+
one rule where a full run names it with another. Identities are therefore not
|
|
503
|
+
scope-invariant, a scoped accept can miss exactly the identity CI fails on, and no
|
|
504
|
+
amount of `--merge-baseline` repairs a ledger that never saw it. (The fix is aliases
|
|
505
|
+
on a folded survivor, so the ledger can match any of them; until that lands, the
|
|
506
|
+
refusal is the honest state.) Accept with one full run at the head of a stack:
|
|
507
|
+
|
|
508
|
+
```sh
|
|
509
|
+
joggle check --types --no-replay \
|
|
492
510
|
--baseline .joggle/baseline --update-baseline .joggle/baseline --merge-baseline
|
|
493
511
|
```
|
|
494
512
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
ledger. `--allow-unjudged-baseline` is not the shortcut here: it ratifies the
|
|
500
|
-
thousands nobody looked at, which is a commit nobody can defend.
|
|
501
|
-
|
|
502
|
-
A scoped accept is necessary, not sufficient. Cross-file rules only fire over the
|
|
503
|
-
whole repository, and a scoped run folds some findings into another rule at the same
|
|
504
|
-
site (the note counts them), so an identity CI fails on can be one this run never had.
|
|
505
|
-
Use the scoped accept to keep a stack moving and treat the full run as the authority:
|
|
506
|
-
when CI names an identity the scoped ledger lacks, accept that one and move on. Budget
|
|
507
|
-
one full judged run for the stack's head, not one per branch.
|
|
513
|
+
`--merge-baseline` keeps the identities already accepted and adds this run's, so
|
|
514
|
+
accepting at the head does not discard the stack's accepted set. `--allow-unjudged-baseline`
|
|
515
|
+
is not the shortcut here: it ratifies thousands nobody looked at, which is a commit
|
|
516
|
+
nobody can defend.
|
|
508
517
|
|
|
509
518
|
### The cascade, not the conflicts
|
|
510
519
|
|
package/dist/check.js
CHANGED
|
@@ -227,6 +227,18 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
|
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
229
|
if (options.updateBaselinePath !== undefined) {
|
|
230
|
+
const target = baselinePath(path, options.updateBaselinePath);
|
|
231
|
+
// A scoped run is for the gate. Acceptance is a full-run act until folded findings
|
|
232
|
+
// carry the identities they absorbed, because which survivor wins a fold depends on
|
|
233
|
+
// what ran -- so a scoped accept can miss the identity a full run reports, silently.
|
|
234
|
+
const scoped = options.changed === true || options.changedPaths !== undefined;
|
|
235
|
+
if (scoped && options.allowScopedBaseline !== true) {
|
|
236
|
+
return yield* WorkspaceError.make({
|
|
237
|
+
path: options.updateBaselinePath,
|
|
238
|
+
operation: "baseline",
|
|
239
|
+
cause: new Error(`refusing to write ${target} for a scoped run: a scoped run's identities are not a subset of a full run's — the same site can fold to a different survivor when candidates outside the scope are missing — so this ledger could be missing the identity a full run reports. Accept with one full run (at the head of a stack), or pass --allow-scoped-baseline to accept the risk. Unscoped runs are unaffected.`),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
230
242
|
if (unjudged > 0 && options.allowUnjudgedBaseline !== true) {
|
|
231
243
|
return yield* WorkspaceError.make({
|
|
232
244
|
path: options.updateBaselinePath,
|
|
@@ -235,13 +247,11 @@ export const checkRepository = Effect.fn("joggle.check")(function* (options) {
|
|
|
235
247
|
"Judging needs a model key in this run's environment (TYPESAFE_API_KEY); without one, " +
|
|
236
248
|
"the same findings are named from what the rule could see alone, so a ledger written " +
|
|
237
249
|
"now would not match a judged run. Judge first (raise --max-tokens if the budget was " +
|
|
238
|
-
"the limit), or
|
|
239
|
-
"
|
|
240
|
-
"
|
|
241
|
-
"Pass --allow-unjudged-baseline only to accept the unjudged debt itself."),
|
|
250
|
+
"the limit), or run scoped (--since <base>) to see the change judged with a pull " +
|
|
251
|
+
"request's budget — a scoped run reports the gate's answer but cannot write the " +
|
|
252
|
+
"ledger. Pass --allow-unjudged-baseline only to accept the unjudged debt itself."),
|
|
242
253
|
});
|
|
243
254
|
}
|
|
244
|
-
const target = baselinePath(path, options.updateBaselinePath);
|
|
245
255
|
const fresh = report.diagnostics
|
|
246
256
|
.map((entry) => entry.identity)
|
|
247
257
|
.filter((identity) => identity !== undefined);
|
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
|
+
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)),
|
|
91
92
|
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)),
|
|
92
93
|
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),
|
|
93
94
|
cwd: Flag.String("cwd").pipe(Flag.withDescription("Project root to analyse (default: the current directory)."), Flag.optional),
|
|
@@ -165,6 +166,7 @@ const checkCommand = Command.make("check", {
|
|
|
165
166
|
updateBaselinePath: Option.getOrUndefined(config.updateBaseline),
|
|
166
167
|
allowUnjudgedBaseline: config.allowUnjudgedBaseline,
|
|
167
168
|
mergeBaseline: config.mergeBaseline,
|
|
169
|
+
allowScopedBaseline: config.allowScopedBaseline,
|
|
168
170
|
}).pipe(Effect.provide(Layer.mergeAll(rulesLayer, decisionLayer({
|
|
169
171
|
cacheDir,
|
|
170
172
|
wireCacheDir: machineCache,
|