Repository navigation
Commit 0d43004
fix(spec): the default-change ratchet authorises from the baseline major, so the version branch major roll stops refusing rows declared under 17 (#23123)
Fixes #23113
Clause-②: no
Unblocks #21988, the Version Packages PR for `18.0.0-next.0`. The
release branch is not edited, and neither the smoke nor any workflow is
touched.
## The failing line
I read it from the job log of run `38323903662`, job `115058075855`
(`Packed-tarball smoke (release candidate)`, step 10 `Build`). The tree
is `changeset-release/main` at `9a73a93f1`, with
`@objectstack/spec@18.0.0-next.0`:
```text
❌ 10 authorable key(s) changed the DEFAULT they apply when the author omits them:
- api/InstallPackageRequest:enableOnInstall: true → (none) (removed)
- api/PackageInstallRequest:enableOnInstall: true → (none) (removed)
- data/Cube:public: false → true (changed)
- kernel/InstallPackageRequest:enableOnInstall: true → (none) (removed)
- marketplace/MarketplaceInstallRequest:enableOnInstall: true → (none) (removed)
- marketplace/Package:visibility: "private" → "org" (changed)
- system/MetricsConfig:slis: (none) → [] (added)
- system/TracingConfig:sampling: (none) → {"rules":[],"type":"always_on"} (added)
- ui/PaginationConfig:pageSize: 25 → 50 (changed)
- ui/UserActionsConfig:editInline: false → true (changed)
Baseline: upstream 85c6d76
```
- The exit site is `packages/spec/scripts/build-schemas.ts:3352` on
`9a73a93f1`: the default-change refusal, with its message at `:3317`.
- The exit is not silent. The message was printed, but it sits at log
lines 2371–2466, after turbo's own `ERROR … exited (1)` lines at
1639–1641. The rest of the task's output is flushed after turbo reports
the failure, so reading only from `[System]` to turbo's error line shows
no error.
## Root cause
- `authoriseDefaultChanges`
(`packages/spec/scripts/lib/authorable-defaults.ts:392`) admitted
`DEFAULT_CHANGES_BY_MAJOR` rows only at `CURRENT_MAJOR`, which is
`Number.parseInt` of `package.json`'s version (`build-schemas.ts:767`).
- The stated premise was: "By the time a major rolls, the baseline
already carries the new value."
- That premise fails on the version branch:
- The smoke checks out at depth 1, so `merge-base HEAD origin/main`
cannot answer. The gate re-anchors on `baseRev` `85c6d76ec42a`, at spec
`17.4.0`. That anchor is allowed to lag.
- The version pass rolls the branch to major 18.
- The ten keys main changed after `85c6d76ec42a` are all declared under
`17:` in `scripts/lib/default-changes.ts`.
- A window holding only major 18 has no rows, so all ten read as
undeclared.
- **Control: same anchor, same mechanism, one major earlier.**
- The last green smoke, run `38247570907` (12:12Z), built `17.8.0`
(`HEAD is now at d00f5f2 chore: version packages`). It re-anchored on
the same `85c6d76ec42a` and printed `📌 9 declared default change(s)
accepted (#4666)`.
- The first red, `38248923046` (12:25Z), built `18.0.0-next.0` (`d85ff7c
chore: version packages (next)`), on the same `main` sha `4267484fe5`.
- The tenth key, `ui/UserActionsConfig:editInline`, landed on main in
between.
- **Not the prerelease label.** `Number.parseInt('18.0.0-next.0', 10)`
is `18`, which is correct. The input that changed is the major itself.
## The fix
The authorising window now runs from the **baseline tree's own protocol
major** up to this build's major (`authorisingMajors`):
- **Where the baseline major comes from.** `readProtocolMajorAtRev`
reads it from `package.json` at the baseline rev, the same rev the
baseline defaults are read from. The in-tree baseline is this tree, so
it uses this build's major.
- **Chaining.** Each major's rows chain in ascending order, so
contiguity and the chain-tip rule still apply across the roll. Rows
older than the baseline's major still authorise nothing.
- **Fallbacks.** If the baseline major is unreadable, the window falls
back to this build's major alone, which is the old and narrowest window,
and the build says so. If the baseline is at a newer major than the
build, the window is this build's major alone.
- **Visibility.** Whenever the window spans more than one major, the
build prints it.
- **On `main`** (baseline 17, build 17) the window is `[17]`, the same
as before this change.
Where the change lands:
`packages/spec/scripts/lib/authorable-defaults.ts`,
`packages/spec/scripts/build-schemas.ts`,
`packages/spec/scripts/lib/default-changes.ts` (header comment only) and
`packages/spec/scripts/authorable-defaults.test.ts`.
- The producer is the `gen:schema` script's own library under
`scripts/lib/`, which falls inside the declared surface ("the spec
build's gen:* scripts").
- No `packages/spec/src/**` file is touched.
- `build-openapi.ts` needed no change: the spec build passes through it
in proof (b).
## Proofs
All runs went through `scripts/pm/os-verify-lock.sh`.
**(a) The failure reproduces on `9a73a93f1`, unmodified.**
- Setup: a fresh `git clone --depth=1 --branch changeset-release/main`,
the same shape as the smoke's checkout (HEAD `9a73a93f1c56`, shallow).
- Command: `pnpm --filter @objectstack/spec run build`.
- Result: `VERDICT command-exit 1`. The run re-anchors (`shallow history
… anchors on 85c6d76`), then prints `❌ 10 authorable key(s) changed
the DEFAULT…` with the same ten keys and `Baseline: upstream
85c6d76`.
**(b) The same tree passes with this fix applied locally, uncommitted.**
- Setup: the patch `git diff 21c8644 7f04259` applied with `git
apply` to the same clone. The tree shows four ` M` paths and HEAD is
still `9a73a93f1`.
- Spec build: `pnpm --filter @objectstack/spec run build` gives `VERDICT
command-exit 0`. It prints:
- `ℹ️ authorable-defaults/ baseline (upstream 85c6d76) was read at
protocol major 17, and this build is major 18, so
DEFAULT_CHANGES_BY_MAJOR rows at majors 17–18 authorise`
- `📌 10 declared default change(s) accepted`
- then `gen:openapi`, tsup and DTS, `check-dts-emitted` (38/38),
`check-dts-references`, and the dev-prereqs stamp, all passing.
- Whole-repo build: the smoke's `Build` step (`turbo run build
--filter=!@objectstack/docs`, run here at `--concurrency=2`) gives
`Tasks: 73 successful, 73 total`, `VERDICT command-exit 0`.
- After the build, the tree carries no tracked change beyond the four
patched files.
**(c) `main` still builds `@objectstack/spec` green**, on this branch
(`7f04259ce`, off `main` `21c86444e`).
- Command: `pnpm --filter @objectstack/spec run build` gives `VERDICT
command-exit 0`, with `🔒 authorable-defaults/ verified against upstream
21c8644 — 1121 default(s) unchanged`. The window is a single major,
so the notice is not printed.
- `git status` is clean afterwards.
**Ablation** (the fix was committed first; done with
`scripts/ablation-replace.mjs`):
- Mutation: `for (const major of authorisingMajors(majors))` replaced by
`for (const major of [majors.current])`. The mutation landed: anchor 1 →
0, blob `68f3f7ea8795` → `b2f5507f9afb`.
- Result: `authorable-defaults.test.ts` gives `3 failed | 33 passed
(36)`. The three failures are the rolled-major acceptance, the
cross-roll chain and the cross-roll chain-tip tests. The red direction
was expected.
- Restore: `blob == HEAD (68f3f7e)`, `git diff HEAD` empty.
## Tests and gates (all at `7f04259ce`)
- `pnpm --filter @objectstack/spec exec vitest run --project local
scripts/authorable-defaults.test.ts`: 36 passed: the 27 existing tests
(their 10 `authoriseDefaultChanges` calls now pass the majors object),
plus 9 new tests covering the window, the roll and
`readProtocolMajorAtRev`.
- The spec `local` suite: `Test Files 659 passed (659)`, `Tests 19996
passed | 1 todo`.
- `pnpm --filter @objectstack/spec run typecheck`: exit 0. That covers
`tsc --noEmit`, `check:scripts-typecheck` and `check:test-typecheck`.
`tsc -p tsconfig.scripts.json --listFiles` lists all four changed files.
- Gate commands: 80 in total. That is the union of the 74 derived at
dispatch and the 62 derived on this branch, with 56 in both. Every final
exit is 0.
- `node scripts/pm/dispatch-gates.mjs --ran` answers `✓ 62 derived
famil(ies) accounted for — 62 run, 0 NOT-MEASURED`.
- Three gates first exited 3 (PREREQUISITE NOT MET). Each was
re-measured green after its prerequisite was supplied:
- `check-plugin-teardown-shape --self-test`: its pinned fixture commit
was absent from the shallow clone. That one commit was fetched.
- `check:dual-build-cjs-loads` and `check:lean-entry-closure`: no
package `dist/`. The repo was built first (73 tasks).
- Lint, narrowed to the changed files: eslint `--no-inline-config
--format json` on the four files reports 4 results, 0 errors, 0
warnings, and no file is ignored. `eslint.config.mjs` never enables
type-aware linting (no `parserOptions.project`), so this diff cannot
move a verdict on any untouched file. The repo-wide `pnpm lint` is CI's
to run.
## Changeset: `skip-changeset`
The diff is confined to `packages/spec/scripts/**`, which is not in
`packages/spec`'s `files[]`. After the build, the shipped paths `dist`,
`json-schema`, `liveness`, `prompts`, `llms.txt`, `README.md`,
`CHANGELOG.md`, `api-surface` and `src/**/*.zod.ts` were grepped:
- `authorisingMajors`, `readProtocolMajorAtRev`, `DefaultChangeMajors`
and `authoriseDefaultChanges` have 0 hits.
- The positive control, `defineStack`, hits 86 files in `dist`.
The change decides the gate's verdict and its console output. It changes
no emitted artifact, and the tracked artifacts are unchanged after the
build.
## Pin
**The next Publish Smoke after the fix lands is green on the release
branch.** The release refresh carries this fix onto
`changeset-release/main`, and the seat reads that run after landing.
Locally, the smoke steps after `Build` (pack, fresh install, auth and
CRUD) were not run, so they are NOT MEASURED here.
## Acceptance notes
- Inferred, not measured: once #21988 lands, `main` itself would be at
major 18 while `baseRev` still names `85c6d76ec42a` (17.4.0). Every
depth-1 build of `packages/spec` would then re-anchor and reach the same
refusal. The fix covers that case by the same mechanism.
- Environment observation, not filed: under a checkout path deep enough
that tsx's IPC socket path passes the 108-byte Unix limit, `tsx` fails
with `EADDRINUSE`. A repro clone under the agent scratchpad hit this
during `pnpm install`'s `prepare`. A shorter path cleared it. No public
door is affected.
---
_Generated by [Claude
Code](https://claude.ai/code/session_012zwsLMxQBwHUYJgPyrpEvx)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent e5f9f01 commit 0d43004
4 files changed
Lines changed: 252 additions & 29 deletions
File tree
- packages/spec/scripts
- lib
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
270 | 273 | | |
271 | 274 | | |
272 | 275 | | |
| 276 | + | |
| 277 | + | |
273 | 278 | | |
274 | 279 | | |
275 | 280 | | |
| |||
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
283 | | - | |
| 288 | + | |
284 | 289 | | |
285 | 290 | | |
286 | 291 | | |
| |||
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
292 | | - | |
| 297 | + | |
293 | 298 | | |
294 | 299 | | |
295 | 300 | | |
| |||
304 | 309 | | |
305 | 310 | | |
306 | 311 | | |
307 | | - | |
| 312 | + | |
308 | 313 | | |
309 | 314 | | |
310 | 315 | | |
| |||
315 | 320 | | |
316 | 321 | | |
317 | 322 | | |
318 | | - | |
| 323 | + | |
319 | 324 | | |
320 | 325 | | |
321 | 326 | | |
| |||
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
330 | | - | |
| 335 | + | |
331 | 336 | | |
332 | 337 | | |
333 | 338 | | |
334 | 339 | | |
335 | | - | |
| 340 | + | |
336 | 341 | | |
337 | 342 | | |
338 | 343 | | |
| |||
344 | 349 | | |
345 | 350 | | |
346 | 351 | | |
347 | | - | |
| 352 | + | |
348 | 353 | | |
349 | 354 | | |
350 | 355 | | |
| |||
355 | 360 | | |
356 | 361 | | |
357 | 362 | | |
358 | | - | |
| 363 | + | |
359 | 364 | | |
360 | 365 | | |
361 | 366 | | |
| |||
365 | 370 | | |
366 | 371 | | |
367 | 372 | | |
368 | | - | |
| 373 | + | |
369 | 374 | | |
370 | 375 | | |
371 | 376 | | |
| |||
375 | 380 | | |
376 | 381 | | |
377 | 382 | | |
378 | | - | |
| 383 | + | |
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
382 | 387 | | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
383 | 496 | | |
384 | 497 | | |
385 | 498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| |||
3215 | 3217 | | |
3216 | 3218 | | |
3217 | 3219 | | |
3218 | | - | |
3219 | | - | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
3220 | 3232 | | |
3221 | 3233 | | |
3222 | 3234 | | |
| |||
3234 | 3246 | | |
3235 | 3247 | | |
3236 | 3248 | | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
3237 | 3257 | | |
3238 | 3258 | | |
3239 | 3259 | | |
3240 | 3260 | | |
| 3261 | + | |
3241 | 3262 | | |
3242 | 3263 | | |
3243 | 3264 | | |
| |||
3250 | 3271 | | |
3251 | 3272 | | |
3252 | 3273 | | |
| 3274 | + | |
3253 | 3275 | | |
3254 | 3276 | | |
3255 | 3277 | | |
| |||
3261 | 3283 | | |
3262 | 3284 | | |
3263 | 3285 | | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
3264 | 3302 | | |
3265 | 3303 | | |
3266 | 3304 | | |
| |||
3270 | 3308 | | |
3271 | 3309 | | |
3272 | 3310 | | |
3273 | | - | |
| 3311 | + | |
3274 | 3312 | | |
3275 | 3313 | | |
3276 | 3314 | | |
| |||
3281 | 3319 | | |
3282 | 3320 | | |
3283 | 3321 | | |
3284 | | - | |
| 3322 | + | |
3285 | 3323 | | |
3286 | 3324 | | |
3287 | 3325 | | |
| |||
0 commit comments