From 973cec796c7e68b24f6a1aadd3aff1d8e6e0af11 Mon Sep 17 00:00:00 2001 From: Chris Huber Date: Wed, 25 Nov 2026 20:51:16 +0000 Subject: [PATCH] feat(workflow): publish docs PRs with GitHub App credentials and run on WP Codebox v0.34.0 - add optional PUBLISH_APP_ID / PUBLISH_APP_PRIVATE_KEY secrets, forwarded to WP Codebox as ACCESS_APP_ID / ACCESS_APP_PRIVATE_KEY; WP Codebox v0.34.0 mints an installation token so docs PRs open as the app and trigger pull_request CI (Automattic/wp-codebox#2596) - forward only an explicit PUBLISH_TOKEN as ACCESS_TOKEN; forwarding github.token would override the minted app token. WP Codebox owns the github.token fallback. - pin WP Codebox v0.34.0 (9fce8a7) with its published asset digests - document app credentials as the way to get CI on docs PRs Closes #195 AI assistance: Extra Chill Bot (Claude), direct fallback authorized by Chris after the Homeboy Lab refused Cook admission for hours. --- .github/workflows/README.md | 4 ++-- .github/workflows/maintain-docs.yml | 18 +++++++++++++----- .github/workflows/validate.yml | 2 +- README.md | 12 ++++++++++-- tests/validate-docs-agent-packages.php | 14 ++++++++++---- ...alidate-external-native-package-sources.php | 2 +- ...date-wp-codebox-run-agent-task-contract.php | 12 +++++++----- tests/wp-codebox-release.fixture.json | 14 +++++++------- 8 files changed, 51 insertions(+), 27 deletions(-) diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 0b40a29..96a9076 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -14,9 +14,9 @@ Maintenance permits a no-op only for a non-empty caller-bounded `source_delta`. The reusable workflow declares the expected typed review artifacts for Docs Agent runs: transcript, change summary, verification report, drift report, completion report, and workspace publication links. `maintain-docs.yml` writes those declarations into the portable recipe and exposes the declaration objects through `declared_artifacts_json`. The completion runtime declaration remains optional for producer lifecycle compatibility, but the final completion drift command has a mandatory generic `{name,type,path}` artifact output. The Docs Agent-owned validator generates canonical host-observed bytes under `.codebox/agent-task-artifacts`, and WP Codebox stages only that declared artifact for review. -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. Migrate its value to the exact one-line JSON in the root README: it authorizes the selected Docs Agent package, the pinned Agents API component, the pinned PHP AI Client overlay, and the checksum-pinned OpenAI provider artifact. Both secrets are forwarded to WP Codebox without serialization into the task descriptor. +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`. Optional `PUBLISH_APP_ID` / `PUBLISH_APP_PRIVATE_KEY` are forwarded as WP Codebox `ACCESS_APP_ID` / `ACCESS_APP_PRIVATE_KEY`; WP Codebox v0.34.0 mints a GitHub App installation token from them so docs pull requests open as the app and trigger `pull_request` workflows ([WP Codebox #2596](https://github.com/Automattic/wp-codebox/pull/2596)). An optional `PUBLISH_TOKEN` is forwarded as `ACCESS_TOKEN` and takes precedence; Docs Agent no longer forwards `github.token` itself, because an explicit token would override the minted app 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. Migrate its value to the exact one-line JSON in the root README: it authorizes the selected Docs Agent package, the pinned Agents API component, the pinned PHP AI Client overlay, and the checksum-pinned OpenAI provider artifact. Both secrets are forwarded to WP Codebox without serialization into the task descriptor. -Docs Agent consumes the reusable WP Codebox workflow and helper implementation at immutable revision `9764022156a61ba7d2b4d8a2196b01ccb33b82b5` and passes `wp_codebox_release_ref: v0.33.7` and `wp_codebox_workflow_ref: 9764022156a61ba7d2b4d8a2196b01ccb33b82b5`. That revision is the commit the annotated `v0.33.7` tag resolves to, so the reusable workflow, its helper scripts, and the release tag all name the same producer code; the fixed Docs Agent package revision stays separate. WP Codebox checks that the helper checkout matches `wp_codebox_workflow_ref` and that its `package.json` version equals the release tag, then installs its runtime from that checkout. WP Codebox materializes the declared native runtime closure, executes the selected package, applies bounded workspace changes, runs verification, and publishes approved host changes. The v0.33.7 release assets are `wp-codebox-cli-linux-x64.tar.gz`, `wp-codebox-workspace-0.33.7.tgz`, and `wp-codebox.zip`; `tests/wp-codebox-release.fixture.json` records their published SHA-256 digests. +Docs Agent consumes the reusable WP Codebox workflow and helper implementation at immutable revision `9fce8a758b44109b86da22db68a1b6c801bdd6bb` and passes `wp_codebox_release_ref: v0.34.0` and `wp_codebox_workflow_ref: 9fce8a758b44109b86da22db68a1b6c801bdd6bb`. That revision is the commit the annotated `v0.34.0` tag resolves to, so the reusable workflow, its helper scripts, and the release tag all name the same producer code; the fixed Docs Agent package revision stays separate. WP Codebox checks that the helper checkout matches `wp_codebox_workflow_ref` and that its `package.json` version equals the release tag, then installs its runtime from that checkout. WP Codebox materializes the declared native runtime closure, executes the selected package, applies bounded workspace changes, runs verification, and publishes approved host changes. The v0.34.0 release assets are `wp-codebox-cli-linux-x64.tar.gz`, `wp-codebox-workspace-0.34.0.tgz`, and `wp-codebox.zip`; `tests/wp-codebox-release.fixture.json` records their published SHA-256 digests. Provider artifacts retain only allowlisted review artifacts, controlled workflow envelopes, and canonical runtime-source and seed provenance. WP Codebox uploads a reviewer-safe workflow-result projection: public control, verification, workspace-apply, publication, output-projection, access, failure, artifact-declaration, and canonical transcript-provenance fields remain, while raw `runtime_result`, `outputs.engine_data`, model/provider/tool payloads, source content, private paths, and secrets are excluded. Before persistence or upload, it sanitizes private runtime paths from nested values, object keys, diagnostics, and command arguments. WP Codebox captures one trusted canonical `codebox-transcript` through a pre-sanitization reviewer-evidence descriptor, validates its artifact-root containment, schema, digest, and size, then emits the compact reviewer transcript as a `wp-codebox/reviewer-agent-transcript/v1` projection. Before apply-back, it compares the seed identity with the host workspace identity; rejected patches preserve the expected and actual identities plus patch and changed-file evidence for upload. Its pre-redaction trusted apply input preserves machine-applicable patch bytes in a private channel that is removed before durable artifact sanitization, as fixed in [WP Codebox #1842](https://github.com/Automattic/wp-codebox/pull/1842). Lifecycle and downstream failures retain runtime evidence in their internal normalized failed result even when artifact preparation cannot complete. Diagnostic messages that name runtime classes remain reviewable, while PHP-shaped runtime source remains blocked. See [WP Codebox #1767](https://github.com/Automattic/wp-codebox/issues/1767), [WP Codebox #1814](https://github.com/Automattic/wp-codebox/issues/1814), [WP Codebox #1815](https://github.com/Automattic/wp-codebox/pull/1815), and [WP Codebox #1823](https://github.com/Automattic/wp-codebox/pull/1823). Successful canonical reviewer-evidence reference: [run `29350690551`](https://github.com/Automattic/build-with-wordpress/actions/runs/29350690551). The [hosted failure `29468956857`](https://github.com/Automattic/agents-api/actions/runs/29468956857) executed WP Codebox v0.12.20, published [Agents API #430](https://github.com/Automattic/agents-api/pull/430), then failed during upload preparation; it motivated #1814/#1815. diff --git a/.github/workflows/maintain-docs.yml b/.github/workflows/maintain-docs.yml index e991bf6..efb734b 100644 --- a/.github/workflows/maintain-docs.yml +++ b/.github/workflows/maintain-docs.yml @@ -93,7 +93,13 @@ env: description: Version 1 JSON policy authorizing Docs Agent standalone native packages. required: true PUBLISH_TOKEN: - description: Optional token for checkout and publication. Defaults to the caller-scoped github.token. Pass a GitHub App installation token so the docs pull request opens as that app and triggers the repository's pull_request workflows, which GitHub suppresses for github.token. + description: Optional explicit token for checkout and publication. Takes precedence over PUBLISH_APP_ID/PUBLISH_APP_PRIVATE_KEY; when neither is set, WP Codebox uses the caller-scoped github.token, whose pull requests do not trigger pull_request workflows. + required: false + PUBLISH_APP_ID: + description: Optional GitHub App ID. With PUBLISH_APP_PRIVATE_KEY, WP Codebox mints an installation token for the target repository so the docs pull request opens as that app and triggers pull_request workflows. + required: false + PUBLISH_APP_PRIVATE_KEY: + description: Optional GitHub App private key; requires PUBLISH_APP_ID. required: false outputs: job_status: @@ -389,10 +395,10 @@ jobs: contents: write pull-requests: write issues: write - uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@9764022156a61ba7d2b4d8a2196b01ccb33b82b5 + uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@9fce8a758b44109b86da22db68a1b6c801bdd6bb with: - wp_codebox_release_ref: v0.33.7 - wp_codebox_workflow_ref: 9764022156a61ba7d2b4d8a2196b01ccb33b82b5 + wp_codebox_release_ref: v0.34.0 + wp_codebox_workflow_ref: 9fce8a758b44109b86da22db68a1b6c801bdd6bb external_package_source: ${{ needs.prepare.outputs.external_package_source }} runtime_sources: ${{ needs.prepare.outputs.runtime_sources }} workload_id: docs-agent-${{ inputs.audience }}-${{ inputs.run_kind }} @@ -419,5 +425,7 @@ jobs: time_budget_ms: ${{ inputs.time_budget_ms }} secrets: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN || github.token }} + ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN }} + ACCESS_APP_ID: ${{ secrets.PUBLISH_APP_ID }} + ACCESS_APP_PRIVATE_KEY: ${{ secrets.PUBLISH_APP_PRIVATE_KEY }} EXTERNAL_PACKAGE_SOURCE_POLICY: ${{ secrets.EXTERNAL_PACKAGE_SOURCE_POLICY }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 30d9a28..5304f7a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 with: repository: Automattic/wp-codebox - ref: 9764022156a61ba7d2b4d8a2196b01ccb33b82b5 + ref: 9fce8a758b44109b86da22db68a1b6c801bdd6bb path: .wp-codebox - name: Validate Docs Agent env: diff --git a/README.md b/README.md index 0ad5f39..b5053f3 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,15 @@ jobs: Docs Agent targets the calling repository and forwards its scoped `${{ github.token }}` to WP Codebox for checkout and publication. The consumer must grant `contents: write`, `pull-requests: write`, and `issues: write`; no `ACCESS_TOKEN` secret is required for this same-repository contract. `OPENAI_API_KEY` is optional in the reusable workflow schema but required for a live `run_agent: true` OpenAI run. `EXTERNAL_PACKAGE_SOURCE_POLICY` is a separate required secret: WP Codebox uses it to authorize the selected Docs Agent package and the complete WordPress-native runtime closure. Replace the prior v1 secret value with the exact value below; its secret name and workflow mapping are unchanged. -`PUBLISH_TOKEN` is optional. When it is empty, Docs Agent uses `${{ github.token }}` as above. GitHub does not start `pull_request` workflows for pull requests opened with `github.token`, so docs pull requests opened that way get no CI. To get CI on them, store a fine-grained personal access token as a repository secret and pass it as `PUBLISH_TOKEN`. Limit the token to the calling repository, with `contents`, `pull-requests`, and `issues` write. The pull request then opens as that token's account. Prefer a dedicated machine account, because the token reaches the agent run's checkout and publication. A GitHub App installation token minted in an earlier caller job does not work: GitHub drops job outputs that contain secrets, so the token cannot reach a reusable workflow call. +To give docs pull requests CI, publish them as a GitHub App. GitHub does not start `pull_request` workflows for pull requests opened with `github.token`. Pass the app's ID and private key as `PUBLISH_APP_ID` and `PUBLISH_APP_PRIVATE_KEY`. WP Codebox (v0.34.0+) mints an installation token for the calling repository inside the agent job, so the pull request opens as that app and triggers the repository's `pull_request` workflows. Install the app on the calling repository with `contents`, `pull-requests`, and `issues` write. Installation tokens last one hour, which covers the default 30-minute time budget. A token minted in an earlier caller job does not work, because GitHub drops job outputs that contain secrets, so pass the credentials instead. + +`PUBLISH_TOKEN` is an optional explicit override, for example a fine-grained personal access token from a machine account limited to the calling repository. It takes precedence over the app credentials. When neither is set, WP Codebox falls back to `${{ github.token }}` as above, and those docs pull requests get no CI. + +```yaml + secrets: + PUBLISH_APP_ID: ${{ secrets.MY_APP_ID }} + PUBLISH_APP_PRIVATE_KEY: ${{ secrets.MY_APP_PRIVATE_KEY }} +``` Configure `DOCS_AGENT_EXTERNAL_PACKAGE_SOURCE_POLICY` with this exact v1 JSON value: @@ -140,7 +148,7 @@ Docs Agent declares the review artifacts it expects the runner to materialize as `maintain-docs.yml` writes `expected_artifacts` and `artifact_declarations` into a portable Docs Agent recipe and exposes the same declaration objects as `declared_artifacts_json`. The runtime declaration for `docs_agent_completion_report` remains `required: false` because WP Codebox may evaluate runtime-level required artifacts before post-command validation. The final completion drift entry is mandatory and declares `{name,type,path}`; after deterministic host validation, the validator atomically writes canonical JSON to `.codebox/agent-task-artifacts/docs-agent-completion-report.json`, and WP Codebox stages that declared command artifact for reviewers. -The reusable workflow and helper implementation are pinned to WP Codebox `v0.33.7`: `wp_codebox_release_ref: v0.33.7` and `wp_codebox_workflow_ref` both resolve to the tag commit `9764022156a61ba7d2b4d8a2196b01ccb33b82b5`. This producer revision is independent of the fixed Docs Agent package revision. +The reusable workflow and helper implementation are pinned to WP Codebox `v0.34.0`: `wp_codebox_release_ref: v0.34.0` and `wp_codebox_workflow_ref` both resolve to the tag commit `9fce8a758b44109b86da22db68a1b6c801bdd6bb`. This producer revision is independent of the fixed Docs Agent package revision. WP Codebox v0.33.6 uploads a reviewer-safe workflow-result projection with public control, workspace-apply, and publication fields plus canonical transcript provenance. It excludes raw `runtime_result`, `outputs.engine_data`, model/provider/tool payloads, source content, private paths, secrets, Git-ignored verification artifacts such as pnpm's symlinked `node_modules` tree, and mutable `.codebox` runtime control files. Tracked or otherwise publishable symlinks remain rejected. Integrity failures retain bounded added, modified, and deleted path evidence, and non-Git workspaces retain a bounded filesystem snapshot fallback. Canonical GitHub repository identity is compared case-insensitively while pull-request URL syntax, pull number, target binding, and API resolution remain strict. The canonical `codebox-transcript` remains the bounded tool-observability surface: its pre-sanitization reviewer-evidence descriptor records the trusted artifact-relative path, schema, verified source digest, and size, which the uploader revalidates before producing the `wp-codebox/reviewer-agent-transcript/v1` projection. Since v0.33.6 that projection decodes the runtime output, so it includes tool observability and the content-free sandbox write ledger instead of a stub. Before apply-back, WP Codebox validates that the runner seed and host workspace identities match; rejected patches retain identity, patch, and changed-file evidence for review. The pre-redaction trusted apply input fixed by [WP Codebox #1842](https://github.com/Automattic/wp-codebox/pull/1842) retains machine-applicable patch bytes privately, then removes them before durable artifact sanitization. diff --git a/tests/validate-docs-agent-packages.php b/tests/validate-docs-agent-packages.php index ab5d710..90bebb5 100644 --- a/tests/validate-docs-agent-packages.php +++ b/tests/validate-docs-agent-packages.php @@ -73,10 +73,10 @@ $assert( str_contains( $maintain_docs_workflow, 'The host generates and stages the completion report from caller inputs, Git, and filesystem checks' ), 'maintain-docs.yml must make host-owned completion generation explicit.' ); $assert( ! str_contains( $maintain_docs_workflow, 'DOCS_AGENT_COMPLETION_REPORT' ), 'maintain-docs.yml must not request model-authored completion reports.' ); -$wp_codebox_producer_revision = '9764022156a61ba7d2b4d8a2196b01ccb33b82b5'; +$wp_codebox_producer_revision = '9fce8a758b44109b86da22db68a1b6c801bdd6bb'; $generic_codebox_agent_task_workflow = 'uses: Automattic/wp-codebox/.github/workflows/run-agent-task.yml@' . $wp_codebox_producer_revision; $assert( str_contains( $maintain_docs_workflow, $generic_codebox_agent_task_workflow ), 'maintain-docs.yml must call the immutable generic Codebox agent-task workflow candidate.' ); -$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_release_ref: v0.33.7' ), 'maintain-docs.yml must pass the matching WP Codebox release tag.' ); +$assert( str_contains( $maintain_docs_workflow, 'wp_codebox_release_ref: v0.34.0' ), 'maintain-docs.yml must pass the matching WP Codebox release tag.' ); $assert( str_contains( $maintain_docs_workflow, 'wp_codebox_workflow_ref: ' . $wp_codebox_producer_revision ), 'maintain-docs.yml must execute helpers from the accepted producer revision.' ); $assert( str_contains( $maintain_docs_workflow, '--arg writablePaths "$INPUT_WRITABLE_PATHS"' ), 'maintain-docs.yml must include writable paths in the portable recipe.' ); @@ -95,7 +95,13 @@ $assert( str_contains( $maintain_docs_workflow, 'artifact:{name:"docs_agent_completion_report",type:"DocsAgentCompletionReport",path:$path}' ), 'The mandatory completion drift check must declare the generic WP Codebox command artifact shape.' ); $assert( str_contains( $maintain_docs_workflow, 'output_projections:' ), 'maintain-docs.yml must project the bounded runner publication result.' ); $assert( str_contains( $maintain_docs_workflow, 'OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}' ), 'maintain-docs.yml must explicitly forward OPENAI_API_KEY to the native runner.' ); -$assert( str_contains( $maintain_docs_workflow, 'ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN || github.token }}' ), 'maintain-docs.yml must forward an optional PUBLISH_TOKEN and fall back to the caller-scoped GitHub token.' ); +$assert( str_contains( $maintain_docs_workflow, 'ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN }}' ), 'maintain-docs.yml must forward only an explicit PUBLISH_TOKEN; WP Codebox owns the github.token fallback.' ); +$assert( ! str_contains( $maintain_docs_workflow, 'ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN || github.token }}' ), 'maintain-docs.yml must not forward github.token as ACCESS_TOKEN, which would override minted app tokens.' ); +$assert( str_contains( $maintain_docs_workflow, 'ACCESS_APP_ID: ${{ secrets.PUBLISH_APP_ID }}' ), 'maintain-docs.yml must forward PUBLISH_APP_ID as ACCESS_APP_ID.' ); +$assert( str_contains( $maintain_docs_workflow, 'ACCESS_APP_PRIVATE_KEY: ${{ secrets.PUBLISH_APP_PRIVATE_KEY }}' ), 'maintain-docs.yml must forward PUBLISH_APP_PRIVATE_KEY as ACCESS_APP_PRIVATE_KEY.' ); +foreach ( array( 'PUBLISH_APP_ID', 'PUBLISH_APP_PRIVATE_KEY' ) as $app_secret ) { + $assert( preg_match( '/ ' . $app_secret . ':\n(?: .*\n)*? required: false/m', $maintain_docs_workflow ) === 1, "{$app_secret} must be an optional reusable-workflow secret." ); +} $assert( str_contains( $maintain_docs_workflow, 'EXTERNAL_PACKAGE_SOURCE_POLICY: ${{ secrets.EXTERNAL_PACKAGE_SOURCE_POLICY }}' ), 'maintain-docs.yml must explicitly forward the external package source policy.' ); $assert( str_contains( $maintain_docs_workflow, 'runtime_sources: ${{ needs.prepare.outputs.runtime_sources }}' ), 'maintain-docs.yml must pass its complete native runtime closure to WP Codebox.' ); @@ -103,7 +109,7 @@ foreach ( array( 'Docs Agent Runner Recipe', 'portable recipe', 'Docs Agent owns the native package' ) as $migration_note_text ) { $assert( str_contains( $workflow_readme, $migration_note_text ), "Workflow README missing agent runtime note: {$migration_note_text}" ); } -$assert( str_contains( $workflow_readme, 'v0.33.7' ), 'Workflow README must record the WP Codebox release tag.' ); +$assert( str_contains( $workflow_readme, 'v0.34.0' ), 'Workflow README must record the WP Codebox release tag.' ); $assert( str_contains( $workflow_readme, 'Diagnostic messages that name runtime classes remain reviewable' ), 'Workflow README must document diagnostic-versus-source detection.' ); $assert( str_contains( $workflow_readme, 'allowlisted review artifacts' ), 'Workflow README must document the WP Codebox upload allowlist.' ); $assert( str_contains( $workflow_readme, 'normalized failed result' ), 'Workflow README must document normalized WP Codebox failures.' ); diff --git a/tests/validate-external-native-package-sources.php b/tests/validate-external-native-package-sources.php index d3cb230..7d52f37 100644 --- a/tests/validate-external-native-package-sources.php +++ b/tests/validate-external-native-package-sources.php @@ -73,7 +73,7 @@ $assert( ! str_contains( $workflow, 'pipeline_slug' ) && ! str_contains( $workflow, 'flow_slug' ) && ! str_contains( $workflow, 'bundle_path' ), 'The active workflow must not pass legacy bundle envelopes.' ); $assert( str_contains( $workflow, 'EXTERNAL_PACKAGE_SOURCE_POLICY:' ) && str_contains( $workflow, 'EXTERNAL_PACKAGE_SOURCE_POLICY: ${{ secrets.EXTERNAL_PACKAGE_SOURCE_POLICY }}' ), 'The policy secret must be required and forwarded without serialization.' ); $assert( str_contains( $workflow, 'OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}' ), 'OPENAI_API_KEY must be forwarded without serialization.' ); -$assert( str_contains( $workflow, 'ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN || github.token }}' ), 'Same-repository publication must default to the caller-scoped GitHub token.' ); +$assert( str_contains( $workflow, 'ACCESS_TOKEN: ${{ secrets.PUBLISH_TOKEN }}' ), 'Same-repository publication must default to the caller-scoped GitHub token.' ); $assert( ! str_contains( $workflow, 'secrets.ACCESS_TOKEN' ), 'Docs Agent must not accept a raw ACCESS_TOKEN override.' ); $assert( preg_match( '/ PUBLISH_TOKEN:\n(?: .*\n)*? required: false/m', $workflow ) === 1, 'PUBLISH_TOKEN must stay optional so callers need no extra secret.' ); diff --git a/tests/validate-wp-codebox-run-agent-task-contract.php b/tests/validate-wp-codebox-run-agent-task-contract.php index 2a615eb..52c6247 100644 --- a/tests/validate-wp-codebox-run-agent-task-contract.php +++ b/tests/validate-wp-codebox-run-agent-task-contract.php @@ -58,10 +58,10 @@ $published_assets = $release['published_assets'] ?? null; $assert( is_array( $published_assets ), 'WP Codebox release fixture must record published release assets.' ); $assert( array( - 'wp-codebox-cli-linux-x64.tar.gz' => 'sha256:c0973033d6dd3adf87004e45d3fb8c0a495ea9dcf7d54a62c543e5926483dcd5', - 'wp-codebox-workspace-0.33.7.tgz' => 'sha256:61bbab7b894d6bcc8b817e835a639d9fa99487bd5d263e4aa1a6ff238df08bb4', - 'wp-codebox.zip' => 'sha256:363b409666c2478982f391a2b30e1d08be5dfc2aed36cc2da12f537de677ad02', -) === $published_assets, 'WP Codebox release fixture must retain the published v0.33.7 asset digests.' ); + 'wp-codebox-cli-linux-x64.tar.gz' => 'sha256:a885d9e3384beeea7697c40c91f83518a7e89a6aaec23e4c9f09bbdb4c513c4a', + 'wp-codebox-workspace-0.34.0.tgz' => 'sha256:287cb43ad832579178e513d0d7fa0fa0348b235e4a3d5c0f5afdb0f4f9e3fa9c', + 'wp-codebox.zip' => 'sha256:4bb7fcc8eef152840a24330f115222fa14052fe1fc8094ddb9b2cc55e831aa34', +) === $published_assets, 'WP Codebox release fixture must retain the published v0.34.0 asset digests.' ); $run = $release['run'] ?? null; $assert( is_string( $run ) && preg_match( '/^\d+$/', $run ) === 1, 'WP Codebox release fixture must retain the regression run reference.' ); $diagnostic_regression_run = $release['diagnostic_regression_run'] ?? null; @@ -211,7 +211,9 @@ } } -$assert( '${{ secrets.PUBLISH_TOKEN || github.token }}' === ( $caller_secrets['ACCESS_TOKEN'] ?? null ), 'Docs Agent must forward ACCESS_TOKEN as the optional PUBLISH_TOKEN, falling back to the caller-scoped GitHub token.' ); +$assert( '${{ secrets.PUBLISH_TOKEN }}' === ( $caller_secrets['ACCESS_TOKEN'] ?? null ), 'Docs Agent must forward ACCESS_TOKEN as the optional PUBLISH_TOKEN only; WP Codebox falls back to the caller-scoped GitHub token.' ); +$assert( '${{ secrets.PUBLISH_APP_ID }}' === ( $caller_secrets['ACCESS_APP_ID'] ?? null ), 'Docs Agent must forward PUBLISH_APP_ID as ACCESS_APP_ID.' ); +$assert( '${{ secrets.PUBLISH_APP_PRIVATE_KEY }}' === ( $caller_secrets['ACCESS_APP_PRIVATE_KEY'] ?? null ), 'Docs Agent must forward PUBLISH_APP_PRIVATE_KEY as ACCESS_APP_PRIVATE_KEY.' ); $assert( '${{ secrets.OPENAI_API_KEY }}' === ( $caller_secrets['OPENAI_API_KEY'] ?? null ), 'Docs Agent must explicitly forward OPENAI_API_KEY.' ); $assert( '${{ secrets.EXTERNAL_PACKAGE_SOURCE_POLICY }}' === ( $caller_secrets['EXTERNAL_PACKAGE_SOURCE_POLICY'] ?? null ), 'Docs Agent must explicitly forward the external package policy secret.' ); $assert( preg_match( '/secrets:\n OPENAI_API_KEY:\n(?: .*\n)* required: false/m', $workflow ) === 1, 'Docs Agent must expose OPENAI_API_KEY as an optional reusable-workflow secret.' ); diff --git a/tests/wp-codebox-release.fixture.json b/tests/wp-codebox-release.fixture.json index 10c9c93..3ca2279 100644 --- a/tests/wp-codebox-release.fixture.json +++ b/tests/wp-codebox-release.fixture.json @@ -1,12 +1,12 @@ { - "tag": "v0.33.7", - "revision": "9764022156a61ba7d2b4d8a2196b01ccb33b82b5", - "producer_revision": "9764022156a61ba7d2b4d8a2196b01ccb33b82b5", - "package_version": "0.33.7", + "tag": "v0.34.0", + "revision": "9fce8a758b44109b86da22db68a1b6c801bdd6bb", + "producer_revision": "9fce8a758b44109b86da22db68a1b6c801bdd6bb", + "package_version": "0.34.0", "published_assets": { - "wp-codebox-cli-linux-x64.tar.gz": "sha256:c0973033d6dd3adf87004e45d3fb8c0a495ea9dcf7d54a62c543e5926483dcd5", - "wp-codebox-workspace-0.33.7.tgz": "sha256:61bbab7b894d6bcc8b817e835a639d9fa99487bd5d263e4aa1a6ff238df08bb4", - "wp-codebox.zip": "sha256:363b409666c2478982f391a2b30e1d08be5dfc2aed36cc2da12f537de677ad02" + "wp-codebox-cli-linux-x64.tar.gz": "sha256:a885d9e3384beeea7697c40c91f83518a7e89a6aaec23e4c9f09bbdb4c513c4a", + "wp-codebox-workspace-0.34.0.tgz": "sha256:287cb43ad832579178e513d0d7fa0fa0348b235e4a3d5c0f5afdb0f4f9e3fa9c", + "wp-codebox.zip": "sha256:4bb7fcc8eef152840a24330f115222fa14052fe1fc8094ddb9b2cc55e831aa34" }, "run": "29350690551", "diagnostic_regression_run": "29307978522",