File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -776,6 +776,13 @@ function relativeToActiveRoot(target, filePath) {
776776 return path . relative ( target . activeRoot , filePath ) . replace ( / \\ / g, '/' )
777777}
778778
779+ function relativeExistingToActiveRoot ( target , filePath ) {
780+ const realpath = fs . realpathSync . native
781+ ? candidate => fs . realpathSync . native ( candidate )
782+ : candidate => fs . realpathSync ( candidate )
783+ return path . relative ( realpath ( target . activeRoot ) , realpath ( filePath ) ) . replace ( / \\ / g, '/' )
784+ }
785+
779786function memoryLinkCapability ( target , surface ) {
780787 return createLinkCapabilityDecision ( {
781788 surface,
@@ -2922,7 +2929,7 @@ function handleMemoryCpConfirm(args) {
29222929 throw new Error ( `ConfirmBindingGate: artifactPath changed during verification: ${ artifactPath } ` )
29232930 }
29242931 artifactPath = afterRead . relative
2925- artifactTargetPath = relativeToActiveRoot ( target , afterRead . currentPath )
2932+ artifactTargetPath = relativeExistingToActiveRoot ( target , afterRead . currentPath )
29262933 const rootStat = fs . statSync ( canonicalRoot )
29272934 artifactAuthority = {
29282935 schemaVersion : 'MemoryCpArtifactAuthorityV1' ,
Original file line number Diff line number Diff line change @@ -1049,6 +1049,10 @@ function testMemoryCpConfirmPreservesOrdinaryTables() {
10491049 assert . strictEqual ( confirmation . structuredContent . artifactAuthority . rootKind , 'task' )
10501050 assert . strictEqual ( confirmation . structuredContent . artifactAuthority . canonicalRelativePath , '02-技术方案.md' )
10511051 assert . match ( confirmation . structuredContent . artifactAuthority . rootIdentity , / ^ [ a - f 0 - 9 ] { 64 } $ / )
1052+ assert . strictEqual (
1053+ confirmation . structuredContent . artifactLinks . links [ 0 ] . targetPath ,
1054+ 'requirements/表格任务/02-技术方案.md'
1055+ )
10521056 let sessions = fs . readFileSync ( sessionsPath , 'utf8' )
10531057 assert . ok ( sessions . startsWith ( ordinaryTable . trimEnd ( ) ) , 'ordinary session table must remain unchanged' )
10541058 assert . strictEqual ( ( sessions . match ( / ^ # # # C P 确 认 记 录 $ / gm) || [ ] ) . length , 1 )
You can’t perform that action at this time.
0 commit comments