Skip to content

Commit 272ab90

Browse files
authored
Use WP Codebox v0.12.4 release (#125)
1 parent dc074d5 commit 272ab90

6 files changed

Lines changed: 31 additions & 9 deletions

File tree

.github/workflows/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The reusable workflow declares the expected typed review artifacts for Docs Agen
1212

1313
The target repository grants `contents: write`, `pull-requests: write`, and `issues: write`. Docs Agent forwards the caller-scoped `${{ github.token }}` to WP Codebox for same-repository publication, so consumers do not configure `ACCESS_TOKEN`. `OPENAI_API_KEY` is an optional workflow secret and is required only for a live OpenAI run; skipped and dry-run calls do not require it. `EXTERNAL_PACKAGE_SOURCE_POLICY` remains a separate required v1 JSON secret that authorizes only the selected public standalone Docs Agent package. Both secrets are forwarded to WP Codebox without serialization into the task descriptor.
1414

15-
Docs Agent pins the WP Codebox producer to [#1756](https://github.com/Automattic/wp-codebox/pull/1756) (`ca1cc53ea76d09dc53dd02df89e41ad7fe143a27`). That producer pins its helper checkout independently of reusable-workflow caller context, preventing the helper-resolution regression recorded by failed Build runs `29281470179` and `29281470159`.
15+
Docs Agent consumes the released [WP Codebox v0.12.4](https://github.com/Automattic/wp-codebox/releases/tag/v0.12.4) workflow and passes the matching `wp_codebox_release_ref: v0.12.4` input. WP Codebox validates that the paired tags match, resolves the release tag, and verifies its package version before running the task. See [WP Codebox #1759](https://github.com/Automattic/wp-codebox/issues/1759).
1616

1717
## Docs Agent Runner Recipe
1818

.github/workflows/maintain-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ jobs:
235235
contents: write
236236
pull-requests: write
237237
issues: write
238-
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@ca1cc53ea76d09dc53dd02df89e41ad7fe143a27
238+
uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@v0.12.4
239239
with:
240+
wp_codebox_release_ref: v0.12.4
240241
external_package_source: ${{ needs.prepare.outputs.external_package_source }}
241242
workload_id: docs-agent-${{ inputs.audience }}-${{ inputs.run_kind }}
242243
workload_label: Run Docs Agent
@@ -249,7 +250,6 @@ jobs:
249250
drift_checks: ${{ needs.prepare.outputs.drift_checks }}
250251
success_requires_pr: ${{ needs.prepare.outputs.success_requires_pr == 'true' }}
251252
access_token_repos: ${{ github.repository }}
252-
require_access_token: true
253253
allowed_repos: '["${{ github.repository }}"]'
254254
expected_artifacts: ${{ needs.prepare.outputs.expected_artifacts }}
255255
artifact_declarations: ${{ needs.prepare.outputs.artifact_declarations }}

.github/workflows/validate.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
uses: actions/checkout@v4
1818
with:
1919
repository: Automattic/wp-codebox
20-
ref: ca1cc53ea76d09dc53dd02df89e41ad7fe143a27
20+
ref: v0.12.4
2121
path: .wp-codebox
2222
- name: Validate Docs Agent
2323
env:

tests/validate-docs-agent-bundle.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@
196196

197197
$transitional_homeboy_extensions_workflow = 'uses: Extra-Chill/homeboy-extensions/.github/workflows/runtime-agent-full-run.yml@main';
198198
$forbidden_docs_agent_codebox_workflow = 'uses: Automattic/wp-codebox/.github/workflows/docs-agent-runner.yml@main';
199-
$generic_codebox_agent_task_workflow = 'uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@ca1cc53ea76d09dc53dd02df89e41ad7fe143a27';
199+
$generic_codebox_agent_task_workflow = 'uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@v0.12.4';
200200
$assert( ! str_contains( $maintain_docs_workflow, $transitional_homeboy_extensions_workflow ), 'maintain-docs.yml must not call Homeboy Extensions directly.' );
201201
$assert( ! str_contains( $maintain_docs_workflow, $forbidden_docs_agent_codebox_workflow ), 'maintain-docs.yml must not call a Codebox-owned Docs Agent wrapper.' );
202202
$assert( str_contains( $maintain_docs_workflow, $generic_codebox_agent_task_workflow ), 'maintain-docs.yml must call the generic Codebox agent-task workflow.' );
203+
$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_release_ref: v0.12.4' ), 'maintain-docs.yml must pass the matching WP Codebox release tag.' );
203204

204205
$workflow_blocked_runtime_fragments = array_values( array_diff( $blocked_runtime_fragments, array( 'wp-codebox', 'Automattic/wp-codebox', 'OPENAI_API_KEY' ) ) );
205206
$workflow_internal_fragments = array_merge( $workflow_blocked_runtime_fragments, array( 'homeboy_extensions_ref:', 'runtime_ref:', 'runtime_ref }}', 'runtime_provider:', 'runtime_provider }}', 'runtime_profile:', 'runtime_profile }}', 'runtime_profiles:', 'runtime_profiles }}', 'runtime_execution:', 'runtime_execution }}', 'runtime_config:', 'runtime_config }}', 'component_contracts:', 'component_contracts }}', 'ability_requirements:', 'ability_requirements }}', 'runtime_components:', 'runtime_components }}', 'runtime_mounts:', 'runtime_mounts }}', 'required_abilities:', 'required_abilities }}', 'extra_wp_config_defines:' ) );
@@ -235,8 +236,8 @@
235236
foreach ( array( 'Docs Agent Runner Recipe', 'portable recipe', 'Docs Agent owns the native package' ) as $migration_note_text ) {
236237
$assert( str_contains( $workflow_readme, $migration_note_text ), "Workflow README missing agent runtime note: {$migration_note_text}" );
237238
}
238-
$assert( str_contains( $workflow_readme, 'ca1cc53ea76d09dc53dd02df89e41ad7fe143a27' ), 'Workflow README must record the #1756 WP Codebox producer revision.' );
239-
$assert( str_contains( $workflow_readme, '29281470179' ) && str_contains( $workflow_readme, '29281470159' ), 'Workflow README must retain the failed Build run regression references.' );
239+
$assert( str_contains( $workflow_readme, 'v0.12.4' ), 'Workflow README must record the WP Codebox release tag.' );
240+
$assert( str_contains( $workflow_readme, 'https://github.com/Automattic/wp-codebox/issues/1759' ), 'Workflow README must link the WP Codebox release contract issue.' );
240241
$assert( str_contains( $workflow_readme, 'blocks concrete runner workflow calls' ), 'Workflow README must document blocked concrete runner calls.' );
241242
$assert( str_contains( $workflow_readme, 'runtime ability names, component paths, mount directives, provider defaults, and define directives' ), 'Workflow README must document blocked runtime substrate surfaces.' );
242243

tests/validate-wp-codebox-run-agent-task-contract.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,15 @@
4747
$contract = $read_json( rtrim( $wp_codebox_dir, '/' ) . '/contracts/run-agent-task-reusable-workflow-interface.v1.json' );
4848
$assert( 'wp-codebox/reusable-workflow-interface/v1' === ( $contract['schema'] ?? null ), 'WP Codebox producer schema version mismatch.' );
4949
$assert( '.github/workflows/run-agent-task.yml' === ( $contract['workflow'] ?? null ), 'WP Codebox producer contract targets an unexpected workflow.' );
50+
$release = $read_json( $root . '/tests/wp-codebox-release.fixture.json' );
51+
$release_tag = $release['tag'] ?? null;
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+
$assert( substr( $release_tag, 1 ) === ( $release['package_version'] ?? null ), 'WP Codebox release fixture package version must match its tag.' );
54+
$producer_package = $read_json( rtrim( $wp_codebox_dir, '/' ) . '/package.json' );
55+
$assert( ( $release['package_version'] ?? null ) === ( $producer_package['version'] ?? null ), 'Checked-out WP Codebox package version must match the release fixture.' );
5056

5157
$workflow = (string) file_get_contents( $root . '/.github/workflows/maintain-docs.yml' );
52-
$assert( preg_match( '/^\s*uses: Automattic\/wp-codebox\/\.github\/workflows\/run-agent-task\.yml@ca1cc53ea76d09dc53dd02df89e41ad7fe143a27$/m', $workflow ) === 1, 'Docs Agent must call the #1756 producer workflow revision.' );
58+
$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.' );
5359

5460
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 );
5561
$assert( isset( $caller['inputs'], $caller['secrets'] ), 'Docs Agent must declare producer inputs and secrets.' );
@@ -74,6 +80,18 @@
7480
}
7581
}
7682

83+
$assert( $release_tag === ( $caller_inputs['wp_codebox_release_ref'] ?? null ), 'Docs Agent must pass the WP Codebox release tag required by the producer contract.' );
84+
$is_coherent_release_pair = static function ( string $consumer_workflow ): bool {
85+
preg_match( '/uses: Automattic\/wp-codebox\/\.github\/workflows\/run-agent-task\.yml@(?<workflow_tag>[^\s]+)/', $consumer_workflow, $workflow_match );
86+
preg_match( '/^\s+wp_codebox_release_ref: (?<helper_tag>[^\s]+)$/m', $consumer_workflow, $helper_match );
87+
88+
return isset( $workflow_match['workflow_tag'], $helper_match['helper_tag'] )
89+
&& preg_match( '/^v\d+\.\d+\.\d+$/', $workflow_match['workflow_tag'] ) === 1
90+
&& $workflow_match['workflow_tag'] === $helper_match['helper_tag'];
91+
};
92+
$assert( $is_coherent_release_pair( $workflow ), 'Docs Agent must use matching exact WP Codebox release tags.' );
93+
$assert( ! $is_coherent_release_pair( str_replace( 'wp_codebox_release_ref: ' . $release_tag, 'wp_codebox_release_ref: v0.12.3', $workflow ) ), 'A mismatched WP Codebox workflow and helper release tag must fail.' );
94+
7795
$caller_secrets = array();
7896
preg_match_all( '/^ (?<name>[A-Z0-9_]+): (?<value>[^\n]+)$/m', $caller['secrets'], $matches, PREG_SET_ORDER );
7997
foreach ( $matches as $match ) {
@@ -87,7 +105,6 @@
87105
}
88106
}
89107

90-
$assert( 'true' === ( $caller_inputs['require_access_token'] ?? null ), 'Docs Agent must require the caller-scoped publication token.' );
91108
$assert( '${{ github.token }}' === ( $caller_secrets['ACCESS_TOKEN'] ?? null ), 'Docs Agent must explicitly forward the caller-scoped GitHub token as ACCESS_TOKEN.' );
92109
$assert( '${{ secrets.OPENAI_API_KEY }}' === ( $caller_secrets['OPENAI_API_KEY'] ?? null ), 'Docs Agent must explicitly forward OPENAI_API_KEY.' );
93110
$assert( '${{ secrets.EXTERNAL_PACKAGE_SOURCE_POLICY }}' === ( $caller_secrets['EXTERNAL_PACKAGE_SOURCE_POLICY'] ?? null ), 'Docs Agent must explicitly forward the external package policy secret.' );
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"tag": "v0.12.4",
3+
"package_version": "0.12.4"
4+
}

0 commit comments

Comments
 (0)