@@ -14,6 +14,10 @@ const execFileAsync = promisify(execFile)
1414async function run ( mode = "success" ) {
1515 const temp = await mkdtemp ( join ( tmpdir ( ) , "wp-codebox-native-lifecycle-" ) )
1616 const workspace = join ( temp , "workspace" )
17+ const targetRepo = mode === "canonical-casing" ? "automattic/build-with-wordpress" : "owner/repo"
18+ const publicationRepo = mode === "canonical-casing"
19+ ? "Automattic/build-with-wordpress"
20+ : mode === "different-repo" ? "other/repo" : targetRepo
1721 await mkdir ( join ( workspace , ".codebox" ) , { recursive : true } )
1822 await writeFile ( join ( workspace , "README.md" ) , "OPENAI_API_KEY\nbefore\n" )
1923
@@ -28,12 +32,12 @@ async function run(mode = "success") {
2832 } ,
2933 runtime_sources : [ ] ,
3034 workload : { id : "run-1" , label : "Update" } ,
31- target_repo : "owner/repo" ,
35+ target_repo : targetRepo ,
3236 prompt : "Edit README using workspace_read and workspace_edit." ,
3337 writable_paths : mode === "deny" ? "src/**" : "README.md" ,
3438 runner_workspace : {
3539 enabled : true ,
36- repo : "owner/repo" ,
40+ repo : targetRepo ,
3741 base : "main" ,
3842 branch_prefix : "wp-codebox/agent-task/" ,
3943 } ,
@@ -44,9 +48,9 @@ async function run(mode = "success") {
4448 drift_checks : [ { command : "echo drift >> .codebox/order" } ] ,
4549 success : { requires_pr : mode !== "no-op-maintenance" } ,
4650 access : {
47- caller_repo : "owner/repo" ,
48- allowed_repos : [ "owner/repo" ] ,
49- access_token_repos : [ "owner/repo" ] ,
51+ caller_repo : targetRepo ,
52+ allowed_repos : [ targetRepo ] ,
53+ access_token_repos : [ targetRepo ] ,
5054 } ,
5155 limits : { max_turns : 1 , time_budget_ms : 1000 } ,
5256 artifacts : { expected : [ ] , declarations : [ ] } ,
@@ -127,16 +131,16 @@ export async function publishRunnerWorkspace({ testHook }) {
127131 success: true,
128132 status: "published",
129133 backend: "fixture",
130- pull_request: { url: " https://github.com/owner/repo/ pull/1" , reused: false, opened: true },
134+ pull_request: { url: ${ JSON . stringify ( ` https://github.com/${ publicationRepo } / pull/1` ) } , reused: false, opened: true },
131135 }
132136}
133137` )
134138
135139 const gh = join ( temp , "gh" )
136140 await writeFile ( gh , `#!/usr/bin/env node
137141process.stdout.write(JSON.stringify({
138- html_url: " https://github.com/owner/repo/ pull/1" ,
139- base: { repo: { full_name: "owner/repo" } },
142+ html_url: ${ JSON . stringify ( ` https://github.com/${ publicationRepo } / pull/1` ) } ,
143+ base: { repo: { full_name: ${ JSON . stringify ( publicationRepo ) } } },
140144}))
141145` )
142146 await chmod ( gh , 0o755 )
@@ -190,6 +194,15 @@ assert.equal(success.result.runtime_result.agent_runtime_diagnostics.prepared_pa
190194assert . equal ( success . result . runtime_result . agent_runtime_diagnostics . sandbox_workspace . mounts [ 0 ] . target , "/workspace" )
191195assert . equal ( success . result . runtime_result . agent_runtime_diagnostics . local_executor_root , "/workspace" )
192196
197+ const canonicalCasing = await run ( "canonical-casing" )
198+ assert . equal ( canonicalCasing . code , 0 , `${ canonicalCasing . stderr } \n${ JSON . stringify ( canonicalCasing . result ) } ` )
199+ assert . equal ( canonicalCasing . result . publication_verification . valid , true )
200+
201+ const differentRepository = await run ( "different-repo" )
202+ assert . equal ( differentRepository . code , 1 )
203+ assert . equal ( differentRepository . result . publication_verification . valid , false )
204+ assert . match ( differentRepository . result . failure . message , / v a l i d c a n o n i c a l p u l l - r e q u e s t r e s u l t / )
205+
193206const failedVerification = await run ( "verify-fail" )
194207assert . equal ( failedVerification . code , 1 )
195208assert ( ! failedVerification . order . includes ( "publish" ) )
0 commit comments