Repository navigation
Commit 1d5d541
Fixes #20451
Clause-②: no
## What changes
`diffMetaItem` (`packages/metadata-protocol/src/protocol.ts`), the
default `from` side only. With no `fromVersion`, the from side is now
the **nearest earlier history row whose body differs from the to
side's**, by the diff's own equality: `diffShallow`'s three buckets not
all empty, with an absent body compared as `{}` (the same `?? {}` the
comparison below it uses). A body-less row (a delete's tombstone)
therefore differs from any non-empty to side, and the walk stops on it
(triage's answer A, 5875579209). With no earlier row that differs, the
from side is absent: `fromVersion: null`, everything added.
- The walk reads only the rows the function already has: the one `find`
over `sys_metadata_history` (no limit), which the function sorts by
`version` in memory. It adds no read and no cap. A unit pin asserts one
history read on a walk path.
- It reads no `operation_type` and adds no state column (ruling B on
#20378, 5865708652).
- An explicit `?from=` / `?to=` names exactly its versions. The to-side
default (the active row's own version, PR #20443) is untouched. An
explicit `?to=` with no `?from=` walks back from the named version's
body.
- The comparison runs on the stored bodies before redaction, as the diff
itself does, so a credential-only change still stops the walk and its
values are still not served (unit pin).
The four statements of the default rule now say the new rule, each in
its own words: the `diffMetaItem` docblock,
`DiffMetaItemResponseSchema`'s JSDoc (`packages/spec`), the route's
OpenAPI summary in `rest-server.ts`, and the SDK's `diffItem` docblock
(`packages/client`). Comment and summary text only: no schema, route or
signature change.
## Measured on the real REST stack
The REST pins
(`packages/rest/src/meta-diff-default-range-labels.test.ts`, real routes
and real writes over better-sqlite3 `:memory:`) were committed first
(`9b308b12b`) and run against the unchanged source with its closure
built: **3 failed, 9 passed**. After the change: **12 passed**.
| history (fixture-proved by reading `sys_metadata_history`) | before |
after |
|:--|:--|:--|
| v1 `create` A (active), v2 `create` B (draft save), v3 `publish` B |
`2 → 3`, empty | `1 → 3`, `label` and `columns` changed, equal to
`?from=1&to=3` |
| the same, then a v4 draft save | `2 → 3`, empty | `1 → 3` |
| v1 `create` A, v2 `delete` (no body), v3 `create` A2 (draft), v4
`publish` A2 | `3 → 4`, empty | `2 → 4`, everything added, equal to
`?from=2&to=4` |
| v1 `create` A, v2 `delete` (no body), v3 `create` B (active) | `2 →
3`, everything added | the same bytes (green before and after) |
| v1 `create` New (draft), v2 `publish` New | `1 → 2`, empty | `null →
2`, everything added |
| v1 `create` (active) only | `null → 1`, everything added | the same
bytes |
| explicit `?from=2&to=3` over the first lineage | `2 → 3`, empty | the
same bytes |
The unit pins in `protocol.diff-dead-history-read.test.ts` repeat these
lineages over seeded rows beside the file's read-counting double.
**Ablation**, from the committed state: `node
scripts/ablation-replace.mjs` replaced the walk's differ test (`if
(d.added.length || d.removed.length || d.changed.length) {` → `if (true)
{`, which is the old immediately-previous rule), anchor 1 → 0, blob
`a2d2b7686f29` → `dd9cffcbd1f9`; the file ran **6 failed / 14 passed**,
exactly the six walk-dependent pins; restored, blob == HEAD and `git
diff HEAD` empty. No build is involved: the metadata-protocol suite
imports `./index.js` from source.
## A pending release note corrected: needs confirmation (Check Changeset
stays red)
`.changeset/20397-diff-default-range-labels.md` (PR #20443, not yet
released) said "The default `fromVersion` is still the history version
immediately before that label." This PR makes that sentence false in the
same release, so it now reads: "The default `fromVersion` rule is not
changed by this entry (#20451, in the same release, then moves it to the
nearest earlier version whose body differs from the to side's)." One
sentence, nothing else in that file.
This is the DELIBERATE CORRECTION class `check-empty-changeset.mjs`
names, so that gate exits 1 locally and **Check Changeset will stay red
on purpose**. Please confirm the correction on this PR. It was outside
the claim's file surface. `skip-changeset` is not applied and must not
be.
## Changeset
`.changeset/20451-diff-default-from-differs.md`:
`@objectstack/metadata-protocol` `patch` and `@objectstack/rest`
`patch`, `Clause-②: no`. The rest line is there because the route's
OpenAPI summary is a runtime string served in the OpenAPI document. The
`packages/spec` JSDoc and the `packages/client` docblock are
comment-only, so they get no line, per the repo's rule that comments do
not publish. All three packages are in one `fixed` group, so versions do
not move differently either way.
## Verification (measured at `1f258bbd5`, after merging `origin/main`
`9449512a3` with a true merge commit)
- `node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack`: 88 commands, all run, each exit code
written to a file before any pipe. **87 exit 0; 1 exit 1**: `node
scripts/check-empty-changeset.mjs --base origin/main`, the release-note
correction above. Also run, outside the derivation: the four roster
gates whose roster sits under a changed path (`check-changeset-fixed`,
`check:meta-url-spelling`, `check:spec-changes`,
`check:error-code-casing`), all exit 0.
- `dispatch-gates --ran`: "88 derived famil(ies) accounted for — 88 run,
0 NOT-MEASURED".
- Tests, each through `os-verify-lock`: metadata-protocol 189 files
passed, 3 skipped (2759 tests); rest `--project local` 219 files passed
(4181 tests); client 50 files passed (641 tests); spec `--project local`
573 files passed (16801 tests).
- Typecheck: metadata-protocol, rest (with `check:test-typecheck`),
client (with `check:test-typecheck`) and spec all exit 0. Both edited
test files are in their tsc programs (`--listFiles`: 1 hit each).
- `pnpm --filter @objectstack/spec check:generated`: all 15 generated
artifacts up to date, against a spec `dist` built from this tree.
- Declared to CI, not run here: the five path-scheduled jobs (Test Core
shards, Temporal Conformance, Dogfood Regression, Dogfood Verify CLI,
Build Core) and the workspace type-check lanes, which `dispatch-gates`
lists as CI's own shell.
## Statements the census named, measured
- **Edited:** the four above, plus the header of
`meta-diff-default-range-labels.test.ts` (this PR adds to that file),
which said the from side is "the history row immediately preceding that
label".
- **Not false, not edited:**
`docs/qa/platform-checklist/areas/studio-authoring.json` lines 346 and
402 ("omit the params for previous-vs-current"). On that probe's
lifecycle (draft save, publish, second draft save, second publish) the
default range now compares the second published revision with the first
(`2 → 4`), which is the comparison those steps describe. Before this PR
it compared the second publish with its own draft save and answered "no
changes".
- **Not false, not edited:** the test title in
`rest-server-query-number-reads.test.ts:300` ("from/to still mean
previous-vs-current (no version members)"). It asserts only that no
version member reaches the verb, which still holds. This PR does not
touch that file.
## Acceptance notes
- The same checklist steps' explicit range `?from=1&to=2` compares the
probe's first draft save (v1) with its own publish (v2). In the
draft-then-publish lifecycle those two rows carry the same body, so that
range answers "no changes", before and after this PR. This is a
checklist wording issue, not a product defect. No card filed; carrier:
none.
- `DiffMetaItemResponseSchema.fromVersion`'s `.describe()` reads "`null`
when that side is absent (e.g. the item had no earlier version)". It is
still true, and now `null` also answers "no earlier version differs". It
was left as is: a `.describe()` edit regenerates spec docs, and the
claim limits `packages/spec` to comment text.
- `.changeset/20139-rest-query-number-census.md` says
"previous-vs-current on `/diff`" about absent parameters keeping their
default. That is still true of the parameter handling. It is somebody
else's pending note and is not touched.
- Test-side deviation: `seedLineage` in
`protocol.diff-dead-history-read.test.ts` moved from inside the #20397
`describe` to module scope, unchanged, so the #20451 block shares it
rather than copying it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01N8TPEsoJxPsdSdNKGnNGEN)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent fb194c7 commit 1d5d541
8 files changed
Lines changed: 515 additions & 57 deletions
File tree
- .changeset
- packages
- client/src
- metadata-protocol/src
- rest/src
- spec/src/api
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2192 | 2192 | | |
2193 | 2193 | | |
2194 | 2194 | | |
2195 | | - | |
2196 | | - | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
2197 | 2198 | | |
2198 | 2199 | | |
2199 | 2200 | | |
| |||
Lines changed: 248 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
286 | 326 | | |
287 | 327 | | |
288 | 328 | | |
| |||
297 | 337 | | |
298 | 338 | | |
299 | 339 | | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | 340 | | |
337 | 341 | | |
338 | 342 | | |
| |||
436 | 440 | | |
437 | 441 | | |
438 | 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 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
0 commit comments