-
Notifications
You must be signed in to change notification settings - Fork 1
feat: publish bounded consumer-sync shadow evidence #2757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
stranske
merged 8 commits into
main
from
codex/issue-2753-consumer-sync-shadow-producer
Jul 11, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
daf87bb
feat(sync): publish bounded shadow evidence
codex-automation d4fcd84
fix: register shadow workflow in canonical inventory
codex-automation dd2834f
fix: make shadow artifacts rerun-safe
codex-automation 810c00b
chore(codex-keepalive): apply updates (PR #2757)
github-actions[bot] 6f3d30c
chore(codex-autofix): apply updates (PR #2757)
github-actions[bot] a6a59ef
fix: harden consumer sync shadow workflow
codex-automation d71bd6b
chore(codex-keepalive): apply updates (PR #2757)
github-actions[bot] 86cc3b3
chore(autofix): formatting/lint
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
.github/workflows/health-69-consumer-sync-shadow-evidence.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| name: Health 69 Consumer Sync Shadow Evidence | ||
|
stranske marked this conversation as resolved.
|
||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: '17 8 * * 1' | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - '.github/sync-manifest.yml' | ||
| - 'scripts/sync_manifest_compiler.py' | ||
| - 'scripts/build_consumer_sync_shadow_handoff.py' | ||
| - 'templates/consumer-repo/**' | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: consumer-sync-shadow-evidence | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| produce: | ||
| name: Produce read-only shadow evidence | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Install compiler dependency | ||
| run: python -m pip install "pyyaml==6.0.2" | ||
|
|
||
| - name: Compile typed consumer sync plan | ||
| run: | | ||
| mkdir -p consumer-sync-shadow-evidence | ||
| python scripts/sync_manifest_compiler.py \ | ||
| --manifest .github/sync-manifest.yml \ | ||
| --output-json consumer-sync-shadow-evidence/consumer-sync-plan.json | ||
|
|
||
| - name: Build non-authorizing Orchestrator handoff | ||
| env: | ||
| SHADOW_RUN_REF: >- | ||
| github-actions:${{ github.repository }}:${{ github.run_id }}:${{ github.run_attempt }} | ||
| run: | | ||
| python scripts/build_consumer_sync_shadow_handoff.py \ | ||
| --plan consumer-sync-shadow-evidence/consumer-sync-plan.json \ | ||
| --run-ref "$SHADOW_RUN_REF" \ | ||
| --output consumer-sync-shadow-evidence/handoff.json | ||
|
|
||
| - name: Upload shadow evidence | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: consumer-sync-shadow-evidence-${{ github.run_id }}-${{ github.run_attempt }} | ||
| path: consumer-sync-shadow-evidence/ | ||
| retention-days: 30 | ||
|
|
||
| - name: Summarize shadow boundary | ||
| run: | | ||
| python - <<'PY' >> "$GITHUB_STEP_SUMMARY" | ||
| import json | ||
| from pathlib import Path | ||
|
|
||
| handoff = json.loads( | ||
| Path('consumer-sync-shadow-evidence/handoff.json').read_text() | ||
| ) | ||
| print('## Consumer sync shadow evidence') | ||
| print(f"- Plan: {handoff['plan_id']}") | ||
| print(f"- Copy entries: {handoff['entry_count']}") | ||
| print(f"- Removals: {handoff['removal_count']}") | ||
| print('- Supervision: shadow') | ||
| print('- Write authority: false') | ||
| print('- Promotion allowed: false') | ||
| PY | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/usr/bin/env python3 | ||
| """Build a bounded handoff for Orchestrator's consumer-sync shadow rail.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import hashlib | ||
| import json | ||
| import re | ||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
||
| try: | ||
| from scripts.sync_manifest_compiler import PLAN_SCHEMA | ||
| except ImportError: | ||
| from sync_manifest_compiler import PLAN_SCHEMA # type: ignore[no-redef] | ||
|
|
||
|
|
||
| HANDOFF_SCHEMA = "workflows.consumer-sync-shadow-handoff/v1" | ||
| CAPABILITY_ID = "capability:reference-sync-hygiene-test-gate" | ||
| SHA256_RE = re.compile(r"^sha256:[0-9a-f]{64}$") | ||
| RUN_REF_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._:/#@-]{0,255}$") | ||
| EFFECT_ALLOWLIST = ("create", "update", "remove", "skip", "no_change") | ||
|
|
||
|
|
||
| class ShadowHandoffError(ValueError): | ||
| pass | ||
|
|
||
|
|
||
| def _stable_hash(namespace: str, value: Any) -> str: | ||
| encoded = json.dumps(value, sort_keys=True, separators=(",", ":")).encode() | ||
| return "sha256:" + hashlib.sha256(namespace.encode() + b"\0" + encoded).hexdigest() | ||
|
|
||
|
|
||
| def build_handoff(plan: Any, *, run_ref: str) -> dict[str, Any]: | ||
| """Validate the compiler identity and emit a deterministic, non-authorizing handoff.""" | ||
| if not isinstance(plan, dict) or set(plan) != { | ||
| "schema", | ||
| "version", | ||
| "plan_id", | ||
| "manifest_sha256", | ||
| "entries", | ||
| "removals", | ||
| }: | ||
| raise ShadowHandoffError("invalid_consumer_sync_plan_fields") | ||
| if plan.get("schema") != PLAN_SCHEMA or plan.get("version") != 1: | ||
| raise ShadowHandoffError("unsupported_consumer_sync_plan_schema") | ||
| if not SHA256_RE.fullmatch(str(plan.get("plan_id") or "")): | ||
| raise ShadowHandoffError("invalid_consumer_sync_plan_id") | ||
| if not SHA256_RE.fullmatch(str(plan.get("manifest_sha256") or "")): | ||
| raise ShadowHandoffError("invalid_consumer_sync_manifest_hash") | ||
| if not isinstance(plan.get("entries"), list) or not isinstance(plan.get("removals"), list): | ||
| raise ShadowHandoffError("consumer_sync_plan_collections_not_arrays") | ||
| if not RUN_REF_RE.fullmatch(run_ref): | ||
| raise ShadowHandoffError("invalid_shadow_run_ref") | ||
| if any( | ||
| marker in run_ref.lower() for marker in ("token", "secret", "password", "api-key", "apikey") | ||
| ): | ||
| raise ShadowHandoffError("secret_like_shadow_run_ref") | ||
| core = { | ||
| "schema": HANDOFF_SCHEMA, | ||
| "version": 1, | ||
| "capability_id": CAPABILITY_ID, | ||
| "plan_schema": PLAN_SCHEMA, | ||
| "plan_id": plan["plan_id"], | ||
| "manifest_sha256": plan["manifest_sha256"], | ||
| "entry_count": len(plan["entries"]), | ||
| "removal_count": len(plan["removals"]), | ||
| "plan_filename": "consumer-sync-plan.json", | ||
| "run_ref": run_ref, | ||
| "supervision_mode": "shadow", | ||
| "write_authority": False, | ||
| "promotion_allowed": False, | ||
| "effect_allowlist": list(EFFECT_ALLOWLIST), | ||
| "kill_switch": "ORCH_REFERENCE_WORKFLOW_DISABLED=1", | ||
| "consumer": "Orchestrator/consumer_sync_shadow.py", | ||
| } | ||
| return {**core, "handoff_id": _stable_hash("consumer-sync-shadow-handoff", core)} | ||
|
|
||
|
|
||
| def main(argv: list[str] | None = None) -> int: | ||
| parser = argparse.ArgumentParser(description=__doc__) | ||
| parser.add_argument("--plan", type=Path, required=True) | ||
| parser.add_argument("--run-ref", required=True) | ||
| parser.add_argument("--output", type=Path, required=True) | ||
| args = parser.parse_args(argv) | ||
| try: | ||
| plan = json.loads(args.plan.read_text(encoding="utf-8")) | ||
| handoff = build_handoff(plan, run_ref=args.run_ref) | ||
| except (OSError, json.JSONDecodeError, ShadowHandoffError) as exc: | ||
| parser.error(str(exc)) | ||
| args.output.write_text( | ||
| json.dumps(handoff, indent=2, sort_keys=True) + "\n", | ||
| encoding="utf-8", | ||
| ) | ||
| print(json.dumps(handoff, sort_keys=True)) | ||
| return 0 | ||
|
stranske marked this conversation as resolved.
|
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.