|
51 | 51 | $release_tag = $release['tag'] ?? null; |
52 | 52 | $assert( is_string( $release_tag ) && preg_match( '/^v\d+\.\d+\.\d+$/', $release_tag ) === 1, 'WP Codebox release fixture must declare an exact release tag.' ); |
53 | 53 | $assert( substr( $release_tag, 1 ) === ( $release['package_version'] ?? null ), 'WP Codebox release fixture package version must match its tag.' ); |
54 | | -$failed_run = $release['failed_run'] ?? null; |
55 | | -$assert( is_string( $failed_run ) && preg_match( '/^\d+$/', $failed_run ) === 1, 'WP Codebox release fixture must retain the failed-run regression reference.' ); |
| 54 | +$run = $release['run'] ?? null; |
| 55 | +$assert( is_string( $run ) && preg_match( '/^\d+$/', $run ) === 1, 'WP Codebox release fixture must retain the regression run reference.' ); |
| 56 | +$native_result_path = $release['native_result_path'] ?? null; |
| 57 | +$workflow_result_path = $release['workflow_result_path'] ?? null; |
| 58 | +$assert( '.codebox/native-agent-task-result.json' === $native_result_path, 'WP Codebox release fixture must declare the controlled native result path.' ); |
| 59 | +$assert( '.codebox/agent-task-workflow-result.json' === $workflow_result_path, 'WP Codebox release fixture must declare the workflow result path.' ); |
56 | 60 | $producer_package = $read_json( rtrim( $wp_codebox_dir, '/' ) . '/package.json' ); |
57 | 61 | $assert( ( $release['package_version'] ?? null ) === ( $producer_package['version'] ?? null ), 'Checked-out WP Codebox package version must match the release fixture.' ); |
58 | 62 |
|
59 | 63 | $workflow = (string) file_get_contents( $root . '/.github/workflows/maintain-docs.yml' ); |
60 | 64 | $assert( preg_match( '/^\s*uses: Automattic\/wp-codebox\/\.github\/workflows\/run-agent-task\.yml@' . preg_quote( $release_tag, '/' ) . '$/m', $workflow ) === 1, 'Docs Agent must call the released WP Codebox workflow tag.' ); |
61 | 65 | $workflow_readme = (string) file_get_contents( $root . '/.github/workflows/README.md' ); |
62 | | -$assert( str_contains( $workflow_readme, 'failed run `' . $failed_run . '`' ), 'Workflow documentation must retain the failed-run regression reference.' ); |
| 66 | +$assert( str_contains( $workflow_readme, 'run `' . $run . '`' ), 'Workflow documentation must retain the regression run reference.' ); |
| 67 | + |
| 68 | +$producer_workflow = (string) file_get_contents( rtrim( $wp_codebox_dir, '/' ) . '/.github/workflows/run-agent-task.yml' ); |
| 69 | +$producer_execute = (string) file_get_contents( rtrim( $wp_codebox_dir, '/' ) . '/.github/scripts/run-agent-task/execute-native-agent-task.mjs' ); |
| 70 | +$producer_result = $read_json( rtrim( $wp_codebox_dir, '/' ) . '/contracts/agent-task-workflow-result.fixture.json' ); |
| 71 | +$assert( str_contains( $producer_workflow, $workflow_result_path ), 'WP Codebox producer workflow must upload the workflow result file.' ); |
| 72 | +$assert( str_contains( $producer_execute, '"--result-file", nativeResultPath' ), 'WP Codebox producer must pass the native result-file argument.' ); |
| 73 | +$assert( str_contains( $producer_execute, 'const nativeResultPath = join(controlledCodeboxPath, "native-agent-task-result.json")' ), 'WP Codebox producer must constrain the native result path to .codebox.' ); |
| 74 | +$assert( str_contains( $producer_execute, 'const resultPath = join(workspace, ".codebox", "agent-task-workflow-result.json")' ), 'WP Codebox producer must write the workflow result at the declared path.' ); |
| 75 | +$assert( 'wp-codebox/agent-task-workflow-result/v1' === ( $producer_result['schema'] ?? null ), 'WP Codebox workflow-result fixture schema mismatch.' ); |
| 76 | +$assert( 'skipped' === ( $producer_result['status'] ?? null ), 'WP Codebox workflow-result fixture must model the skipped contract.' ); |
| 77 | +$assert( '.codebox/agent-task-request.json' === ( $producer_result['request_path'] ?? null ), 'WP Codebox workflow-result fixture request path mismatch.' ); |
63 | 78 |
|
64 | 79 | preg_match( '/uses: Automattic\/wp-codebox\/\.github\/workflows\/run-agent-task\.yml@[^\n]+\n with:\n(?<inputs>.*?)\n secrets:\n(?<secrets>(?: [^\n]*\n?)*)/s', $workflow, $caller ); |
65 | 80 | $assert( isset( $caller['inputs'], $caller['secrets'] ), 'Docs Agent must declare producer inputs and secrets.' ); |
|
0 commit comments