You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 90423f6
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/runtime/src/app-artifact-handlers.test.ts
+134-4Lines changed: 134 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -656,9 +656,12 @@ describe('[ADR-0150 D4] a multi-package artifact binds each body\'s hooks and fu
656
656
// or by beta and a package of another namespace too, as two namespaces may
657
657
// hold one function name since #31700: a bare read of that name is refused
658
658
// (409), so the teardown reads beta's own entry and never aborts on it.
659
+
// [#32907] …or by beta and the platform (an owner-less registration): that
660
+
// bare read is refused too since #32907, and the teardown still runs whole.
659
661
it.each([
660
662
['beta alone holds the name it keeps (CONTROL: the bare slot answers as before)',false],
661
-
['another namespace\'s package holds the name beta keeps too',true],
663
+
['another namespace\'s package holds the name beta keeps too','package'],
664
+
['the platform holds the name beta keeps too (#32907: its bare read is refused, and the teardown never asks it)','platform'],
662
665
]asconst)('a re-bind that moves a function to another owner takes it off the owner the previous bind gave it, which keeps its other functions — %s',async(_case,sharedKept)=>{
663
666
constGAMMA='com.qa.bodies.gamma';
664
667
constbody=(ns: Ns,hooks: unknown[])=>({
@@ -680,19 +683,26 @@ describe('[ADR-0150 D4] a multi-package artifact binds each body\'s hooks and fu
680
683
constql=engineFor(first,logger);
681
684
bind(ql,first,logger);
682
685
expect(ql.functionHoldersOf('qa_moving').packageHolders,'precondition: only beta\'s hook names it').toEqual([BETA]);
expect(errors.map((e)=>e.message),'the teardown ran whole').toEqual([]);
689
693
expect(ql.functionHoldersOf('qa_moving').packageHolders,'held once, by the artifact\'s id').toEqual([ALPHA]);
690
-
expect([...ql.functionHoldersOf('qa_kept').packageHolders].sort(),'beta keeps the function only its hook names').toEqual(sharedKept ? [BETA,GAMMA] : [BETA]);
694
+
expect([...ql.functionHoldersOf('qa_kept').packageHolders].sort(),'beta keeps the function only its hook names').toEqual(sharedKept==='package'? [BETA,GAMMA] : [BETA]);
expect(ql.functionHoldersOf('qa_kept').packageItem(GAMMA)?.packageId,'the other holder keeps its own').toBe(appArtifactHandlerOwner(GAMMA));
695
699
expect(()=>ql.resolveFunctionEntry('qa_kept'),'the bare read of a name two packages hold stays refused').toThrow(/com\.qa\.bodies\.beta[\s\S]*com\.qa\.bodies\.gamma|com\.qa\.bodies\.gamma[\s\S]*com\.qa\.bodies\.beta/);
700
+
}elseif(sharedKept==='platform'){
701
+
expect(ql.functionHoldersOf('qa_kept').platformItem?.(),'the platform keeps its own').toBeDefined();
expect(ql.registry.sealBareNameHolders(),'beta holds no claim on it any more').toEqual([]);
917
+
});
918
+
919
+
// D2-N1: what the old owner keeps is registered again BEFORE the
920
+
// release asks the engine what it still holds. A function the previous
921
+
// bind gave beta that the new bind neither moves nor gives back to it
922
+
// is held again only by that registration, and nothing re-claims it:
923
+
// the ordering alone keeps its claim.
924
+
it('CONTROL — the move path releases after the old owner\'s kept functions are registered again: a function the new bind neither moves nor gives back keeps its claim',()=>{
expect(ql.functionHoldersOf('qa_prev').packageHolders,'beta keeps the function the new bind does not name').toEqual([BETA]);
941
+
constprev=gammaBinds(ql,'qa_prev');
942
+
expect(prev?.code,'beta keeps its claim on it').toBe('NAMESPACE_CONFLICT');
943
+
expect(holdersNamed(prev)).toEqual([BETA]);
944
+
});
945
+
946
+
// D2-N2: the bare-id registration FIRST, then the bind under
947
+
// `app:<id>`: the engine's one holder entry for beta is the bind's, so
948
+
// the removal by `app:<id>` takes the name off beta and the release
949
+
// frees its claim. (The bare-id-last order is the two CONTROLs above.)
950
+
it.each([
951
+
['moved: the gaining owner\'s group binds','moved'],
952
+
['dropped: a co-owner binds the name','dropped'],
953
+
]asconst)('the package\'s bare-id registration before the bind: the removal takes the holder entry the bind replaced it with, and the claim is released — %s',(_case,shape)=>{
it('CONTROL — on a built artifact a body\'s hook binds the handler ref its runtime module serves at the top level; a residual hook binds under the artifact\'s id',async()=>{
0 commit comments