Commit 66dc6ab
fix(core): plugin startup elapsed time is
* fix(core): plugin startup elapsed time is `duration`, the name its spec contract already uses
`PluginStartupResult.startTime` has always carried `Date.now() - startTime`, an
elapsed duration, so the name asserts the opposite of the value: a reader who
correctly takes it for an instant and writes `Date.now() - result.startTime`
gets an age near the epoch. `packages/spec/src/kernel/startup-orchestrator.zod.ts`
already declares the correct name for the same measure (`duration`, "Time taken
to start the plugin in milliseconds"), and `PluginLoadResult.loadTime` twelve
lines above the defect already spells the identical computation truthfully -- so
this is a declared-vs-enforced divergence between `packages/core` and the spec
contract it implements, not a naming preference.
Three sites, all additive (nothing is removed, so no consumer changes):
- `PluginStartupResult` gains `duration?: number`; `startTime` stays,
populated with the same value, marked `@deprecated` with a doc comment that
states plainly what it holds (ADR-0087 L1 -- the old shape keeps working).
- the private `pluginStartTimes` map is renamed `pluginStartupDurations`
(private; measured zero readers outside `kernel.ts`).
- `getPluginStartupDurations()` is added and `getPluginMetrics()` becomes a
deprecated delegating alias.
Pin tests assert the value is a bounded elapsed duration rather than an
epoch-millisecond instant, on the success and the failure path -- the assertion
`toBeGreaterThan(0)` could never make.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* test(core): type the pin-test plugin metadata instead of casting it
`PluginMetadata` requires `init`, so the object-literal `as` casts tripped
TS2352 under `tsconfig.test.json`.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* chore(changeset): minor for the additive `duration` widening on @objectstack/core
Additive widening of a published package's public surface (a new exported
member on `PluginStartupResult`, a new method on `ObjectKernel`) takes at
least `minor` per the `Check Changeset` step's WHICH LEVEL prose; the act
wins over the `fix(` commit type.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* docs(core): say 'declares the same measure', not 'the contract this result implements'
Measured: `packages/core` neither imports nor references
`packages/spec/src/kernel/startup-orchestrator.zod.ts`, and nothing in the repo
implements `IStartupOrchestrator`. The two `PluginStartupResult` declarations
describe the same domain result and share no shape, so 'implements' overstated a
relationship that does not exist in code. The reason to take the contract's name
is unchanged: it is the name the spec surface declares for this measure.
Filed separately as the wider question this made visible.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
* fix(core): spell the plugin startup elapsed time `durationMs`, the unit-bearing name its spec contract declares
Discharges contract review 5555409410 on PR #16057 (head 4d20aa7): the new
published member was spelled `duration`, a key `packages/spec` has since
retired. Measured on origin/main f377394:
`packages/spec/src/kernel/startup-orchestrator.zod.ts:173` declares
`durationMs`; `:176` tombstones `duration` with `retiredKey()` ("Rename the
key to `durationMs`"); the gate
`packages/spec/scripts/check-duration-unit-keys.ts` is in the tree (landed
e9fcd6b). Two maintainer rulings make the rule govern every runtime-emitted
duration, and a per-plugin startup elapsed time on a public result type is one.
- `PluginStartupResult.durationMs?: number` replaces the never-released
`duration?: number`; both emit sites in `kernel.ts` follow; `startTime`
keeps its deprecated-alias treatment exactly as before.
- The provenance sentence in the interface JSDoc (which ships in the published
`dist/index.d.ts`), in `kernel.ts`'s `{@link}` and in the changeset cited
the retired `PluginStartupResultSchema.duration`; all three now cite
`durationMs` and say the bare spelling is retired.
- The two pin tests read `.durationMs`; their ceiling assertion is unchanged.
No ADR-0087 treatment on the core side: the spec tombstone entry
(`packages/spec/src/migrations/entries/retired-keys/18.kernel__PluginStartupResult__duration.ts`)
records that core's interface is a different type and not a reader of the
schema; core simply does not adopt the retired spelling.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
---------
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>durationMs, the unit-bearing name its spec contract declares (#16057)1 parent eddd612 commit 66dc6ab
6 files changed
Lines changed: 151 additions & 13 deletions
File tree
- .changeset
- packages/core
- examples
- src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
| 227 | + | |
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | 231 | | |
231 | | - | |
232 | | - | |
233 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
234 | 235 | | |
235 | 236 | | |
236 | 237 | | |
| |||
327 | 328 | | |
328 | 329 | | |
329 | 330 | | |
330 | | - | |
| 331 | + | |
| 332 | + | |
331 | 333 | | |
332 | 334 | | |
333 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
582 | 583 | | |
583 | 584 | | |
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 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
585 | 657 | | |
586 | 658 | | |
587 | 659 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
| |||
533 | 538 | | |
534 | 539 | | |
535 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
536 | 550 | | |
537 | 551 | | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
538 | 556 | | |
539 | 557 | | |
540 | | - | |
| 558 | + | |
541 | 559 | | |
542 | 560 | | |
543 | 561 | | |
| |||
684 | 702 | | |
685 | 703 | | |
686 | 704 | | |
687 | | - | |
| 705 | + | |
688 | 706 | | |
689 | 707 | | |
690 | 708 | | |
691 | 709 | | |
692 | 710 | | |
693 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
694 | 715 | | |
695 | 716 | | |
696 | 717 | | |
| |||
701 | 722 | | |
702 | 723 | | |
703 | 724 | | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
704 | 728 | | |
705 | 729 | | |
706 | 730 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
94 | 115 | | |
95 | 116 | | |
96 | 117 | | |
| |||
0 commit comments