@@ -821,6 +821,15 @@ const PROMPT_EFFECT = "agent_prompt"; // packages/core/src/agent/journal.ts
821821const EVALUATION_EFFECT = "generated_xmd" ; // packages/core/src/generated-xmd.ts
822822const FILE_EFFECT = WORKSPACE_FILE ;
823823
824+ /**
825+ * What core's own declaration offers the paired `<Dir>` as.
826+ *
827+ * Spelled here rather than imported, because a case about what a retained
828+ * admission holds has to name the string the journal holds: reading it from the
829+ * component the resume also reads would agree with itself after a rename.
830+ */
831+ const DIR_ENSURE = "https://executable.md/components/dir/ensure" ;
832+
824833/** Every prompt this run's agent was actually asked. */
825834interface AgentCalls {
826835 readonly prompts : string [ ] ;
@@ -1508,10 +1517,10 @@ the retained note
15081517 } ) ;
15091518 }
15101519
1511- // WGAC17: `allow={["write"]}` admits the versioned paired `<Dir>`, and that
1512- // entry now authorizes persistent recursive creation. The former identity
1513- // authorized placement that created nothing, so a run admitted under it must
1514- // not silently receive the wider permission.
1520+ // WGAC17: `allow={["write"]}` admits the paired `<Dir>`, which authorizes
1521+ // persistent recursive creation. A run admitted under a different identity
1522+ // for that spelling was granted something else, so it must not silently
1523+ // receive this permission on resume .
15151524 //
15161525 // Two halves, and neither is evidence alone. The control shows the current
15171526 // admission really does execute its generated `<Dir>` and really does resume
@@ -1541,12 +1550,14 @@ the retained note
15411550
15421551 const suspended = retained ( path ) ;
15431552 expect ( suspended . status ) . toBe ( "suspended" ) ;
1544- // The admission carries the versioned identity. It is a structural record
1545- // rather than a spelling, and the version is the `revision` member — so
1546- // that is what this reads, and what the refusal below moves.
1553+ // The admission carries the identity core's own declaration offers the
1554+ // paired spelling as, in the write table that admitted it — so that is what
1555+ // this reads, and what the refusal below moves.
15471556 expect (
15481557 readRecords ( path ) . some (
1549- ( record ) => record . includes ( `"key":"Dir"` ) && record . includes ( `"revision":"3"` ) ,
1558+ ( record ) =>
1559+ record . includes ( `"name":"Dir","form":"paired","identity":"${ DIR_ENSURE } "` ) &&
1560+ record . includes ( `"effect":"write"` ) ,
15501561 ) ,
15511562 ) . toBe ( true ) ;
15521563
@@ -1616,19 +1627,18 @@ the retained note
16161627 expect ( counts ( path ) ) . toEqual ( atSuspension ) ;
16171628 } ) ;
16181629
1619- it ( "WGAC17: a continuation retaining the former Dir identity refuses before generated execution and mutation" , function * ( ) {
1630+ it ( "WGAC17: a continuation retaining another Dir identity refuses before generated execution and mutation" , function * ( ) {
16201631 const store = yield * useRunStore ( ) ;
16211632 const { runId, path, rendered, calls } = yield * wgac17 ( store ) ;
16221633
1623- // The run becomes one admitted under the former identity. Nothing else
1624- // changes — same source, roots and selection — so the identity is the only
1625- // thing the resume can disagree about.
1626- //
1627- // The version is the `revision` member, and core's own entries state `2`,
1628- // so `"revision":"3"` names the Dir entry and nothing else. Moving it back
1629- // is exactly "admitted under the earlier revision", which is the grant the
1630- // former placement-only Dir had.
1631- rewriteRecords ( path , ( record ) => record . replaceAll ( `"revision":"3"` , `"revision":"2"` ) ) ;
1634+ // The run becomes one admitted under a different identity for the same
1635+ // spelling of the same name. Nothing else changes — same source, roots and
1636+ // selection — so the identity is the only thing the resume can disagree
1637+ // about, and it is still a URL this engine can read: the refusal is the
1638+ // grant comparison rather than an unreadable record.
1639+ rewriteRecords ( path , ( record ) =>
1640+ record . replaceAll ( DIR_ENSURE , "https://executable.md/components/dir/placement" ) ,
1641+ ) ;
16321642 const beforeResume = counts ( path ) ;
16331643 const rootsBeforeResume = workspaceRootState ( path ) ;
16341644
@@ -1646,11 +1656,10 @@ the retained note
16461656 expect ( workspaceRootState ( path ) ) . toEqual ( rootsBeforeResume ) ;
16471657 // Nothing after the wait reached the document either.
16481658 expect ( rendered ) . toEqual ( [ ] ) ;
1649- // And the refusal does not publish which identity moved. The identity is
1650- // four members now, so this reads the two a refusal could carry: the origin
1651- // that owns the implementation, and the member the rewrite actually moved.
1659+ // And the refusal does not publish which identity moved: neither the one
1660+ // the admission holds nor the one the rewrite put there.
16521661 const reported = resumed . written . err . join ( "\n" ) ;
1653- expect ( reported ) . not . toContain ( "@executablemd/workflow/composition" ) ;
1654- expect ( reported ) . not . toContain ( "revision " ) ;
1662+ expect ( reported ) . not . toContain ( DIR_ENSURE ) ;
1663+ expect ( reported ) . not . toContain ( "/components/dir/placement " ) ;
16551664 } ) ;
16561665} ) ;
0 commit comments