-
Notifications
You must be signed in to change notification settings - Fork 10
refactor(storage): retire result-bearing coalesced control barriers from first-party composition #2195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jurij89
merged 11 commits into
integration/2052-system-record-sync
from
refactor/2179-retire-string-barriers
Aug 9, 2026
Merged
refactor(storage): retire result-bearing coalesced control barriers from first-party composition #2195
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
0ad693b
refactor(storage): retire the purpose-string barrier from first-party…
Jurij89 771b084
refactor(storage): make the managed lane typed-only structurally, not…
Jurij89 5c973e6
refactor(storage): share controller deps across barrier routes; refre…
Jurij89 3c2b001
refactor(storage): one controller constructor; registration guard bef…
Jurij89 d545ce5
refactor(storage): prove the barrier-mode split by narrowing, not a cast
Jurij89 1baa406
test(storage): move compile-only barrier contracts to a dedicated typ…
Jurij89 cd99757
docs(storage): one home for the barrier rationale; accurate lane comment
Jurij89 4d38087
feat(storage): publish the typed-only controller deps from the barrel
Jurij89 199eae7
refactor(storage): extract the controller-barrier contract; pin the t…
Jurij89 beff604
refactor(storage): stop re-exporting the normalizer and shared base
Jurij89 6ccc1e1
refactor(storage): private typed-only core under the one exported con…
Jurij89 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/storage/test/store-control-barrier-contract-v1.typetest.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /** | ||
| * Compile-only negative type contracts for typed control-barrier keys (#2179). | ||
| * | ||
| * NEVER EXECUTED: this file is compiled by `typecheck:type-contracts` | ||
| * (tsconfig.typetests.json) and is not matched by the vitest include glob, so | ||
| * intentionally-invalid expressions prove type-level properties without | ||
| * enqueueing real barriers or floating promises. Each `@ts-expect-error` here | ||
| * is a live assertion — if the error it suppresses stops existing, the lane | ||
| * fails with TS2578 (unused directive). All values are `declare`d: there is | ||
| * no runtime, only shapes. | ||
| */ | ||
| import type { ManagedSystemRecordCoordinatorOptionsV1 } from '../src/adapters/system-record-managed-coordinator-v1-internal.js'; | ||
| import type { StoreControlBarrierKeyV1 } from '../src/store-control-barrier-key-v1.js'; | ||
| import type { StorePriorityScheduler } from '../src/store-priority-scheduler.js'; | ||
|
|
||
| declare const scheduler: StorePriorityScheduler; | ||
| declare const epochKey: StoreControlBarrierKeyV1<{ epoch: string }>; | ||
| declare const takeOptions: (options: ManagedSystemRecordCoordinatorOptionsV1) => void; | ||
|
|
||
| // A transition cannot smuggle a different result type past its key. | ||
| // @ts-expect-error — the epoch key demands { epoch: string }, not number | ||
| void scheduler.runTypedControlBarrier({}, epochKey, async () => 7); | ||
|
|
||
| // A key cannot be forged from a plain literal: the module-private brand is a | ||
| // required member no caller outside the factory can produce. | ||
| // @ts-expect-error — structural literal lacks the private brand | ||
| void scheduler.runTypedControlBarrier({}, { purpose: 'forged' }, async () => 7); | ||
|
|
||
| // The managed coordinator is typed-only STRUCTURALLY: its options carry no | ||
| // string-barrier member, so first-party composition cannot regress onto the | ||
| // purpose-string contract without editing that interface. The literal below is | ||
| // COMPLETE apart from `barrier`, deliberately: with every required member | ||
| // present, the excess `barrier` property is the ONLY error, so re-adding the | ||
| // member to the interface turns the suppression below into an unused | ||
| // directive (TS2578) and fails the typecheck lane. (An incomplete literal | ||
| // could not discriminate — missing-member errors would keep the suppression | ||
| // alive either way.) NOTE: never let the directive token itself start a | ||
| // wrapped comment line here — tsc parses any comment line beginning with the | ||
| // expect-error token as a REAL directive, and a phantom directive on a prose | ||
| // line reads as unused and fails this lane. That exact wrap bug shipped in | ||
| // this file's first version. | ||
| void takeOptions({ | ||
| lease: null as never, | ||
| handoff: null as never, | ||
| storeId: {}, | ||
| queryEndpoint: '', | ||
| updateEndpoint: '', | ||
| resolveClient: () => null, | ||
| applyLegacy: null as never, | ||
| typedBarrier: null as never, | ||
| setAdmissionActive: () => {}, | ||
| // @ts-expect-error — a string `barrier` member does not exist on the | ||
|
Jurij89 marked this conversation as resolved.
|
||
| // managed coordinator's options | ||
| barrier: null as never, | ||
| }); | ||
|
|
||
| export {}; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.