Skip to content

fix: Gate PAPER WIF checks after target selection (R2) - #703

Merged
Pigbibi merged 1 commit into
mainfrom
fix/paper-wif-selection-r2
Nov 5, 2026
Merged

Pigbibi merged 1 commit into
mainfrom
fix/paper-wif-selection-r2

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

AI assistance

Codex (GPT-6).

What changed

R2 follow-up for original PR #702, reviewed head 895ae02ce31fbc03d04d46761c52f4737b177aca, squash commit 44a4a811d99161626dbc2d2af9a69c84d49bfb8c: fix post-merge finding F1 (P2). An excluded or disabled PAPER matrix row currently reads and validates PAPER WIF Secrets before selection. Select and check enablement first with inherited identity fields blanked; only a selected, enabled PAPER row reads Secrets and runs the unchanged strict validation and early component masking, before checkout.

Files touched:

  • sync-cloud-run-env.yml: reorder selection and gate PAPER identity masking on enabled selection.
  • runtime-target-manifest.md: describe selection before PAPER Secret access.
  • test_paper_deploy_wif_binding.py: exercise actual script sequencing, disabled/excluded cases, fail-closed validation, and masking order.
  • test_sync_cloud_run_env_workflow.sh: preserve existing contracts and add selection/blank-environment assertions.

Follow-up to a post-merge re-review; no approval implied.

How verified

Fresh independent worktrees from live main c9cb033cf434fcadeb3547c92c08f984fe2a73c3; source checkout read only. Baseline tracked tree remained unmodified. Dependency refs and lockfile unchanged. SG egress guard passed before network work.

  • Fail-before with regression tests on unchanged workflow: 9 failed, 31 passed; shell contract also failed. Pass-after focused suite: 46 passed (unmodified main: 36 passed).
  • Full CI test command on BOTH trees: PYTHONPATH=. uv run --no-sync python -m pytest -q tests --cov --cov-report=term --cov-report=xml (Python 3.12.15, PYTEST_ADDOPTS=-rs only to disclose skip reasons). Main: 3007 passed, 1 skipped, 420 subtests passed; candidate: 3017 passed, 1 skipped, 420 subtests passed. Both exited 0 with the same two warnings and 74% coverage.
  • Identical baseline skip: tests/test_phase5_offline_adapter.py:159, reason approved local frozen research inputs not attached. It is baseline, not a new failure; no tests were skipped, deleted, weakened or retuned by this patch. The older job's skip description was not reused as current evidence.
  • Baseline-red classification: none; every check exited 0 on main and candidate. Introduced failures: 0. The identical conditional skip is disclosed under the owner's baseline-skip rule.
  • Both trees: locked shared-ref/import smoke checks, QPK pin consistency, uv lock --check, ruff, bounded deployment shell contract (92 image-only and 9 lifecycle cases), Dot review (11 tests), public configuration scanner regressions (14 tests) and real scan, docs checker tests (36), phase-2 docs check, actionlint 1.7.12 and git diff --check passed. Docs check has the same existing README-outline advisory.
  • Central checker commit 6ad9627e588bfe474fa14130fb03af948f74d03e: PASS, total matches 0, blocking 0, advisory 0. Loaded the exact pinned script from the organization repository using git show, without modifying it, and ran its naming/link/language/leak/internal-path checks over all four changed complete files including documentation. Root context was the clean candidate; unrelated metadata checks were excluded from this bounded result. Normal full repository docs checks also passed.
  • Publication checker publication-check/2.0-advisory, build 2947dd7867b4, advisory mode: 97 matching lines / 97 findings on exactly the four changed complete files, equal to 97 / 97 on their unmodified-main counterparts. No matched new-content line is absent from its baseline file. These are existing matches; the owner explicitly authorized advisory publication for this M04 follow-up. Full tracked-tree scan is recorded in the worker report. No real credential is included.

Publication checker first 20 changed-file locations (no matching values):

  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:79
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:84
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:122
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:127
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:162
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:212
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:213
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:214
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:215
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:216
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:217
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:295
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:343
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:457
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:463
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:501
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:533
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:586
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:600
  • .<PROJECT_ID>/workflows/sync-cloud-run-env.yml:614

Full tracked candidate tree: checker publication-check/2.0-advisory, build 2947dd7867b4, 1474 total findings / 1463 matching lines, advisory, exit 0. Unchanged files are inherited from the exact baseline; changed-file finding counts are equal to baseline. First 20 full-tree masked matches:

Masked whole-tree scanner receipt
  • .env.example:21: TELEGRAM_TOKEN=<<HOST>>
  • .<PROJECT_ID>/CODEOWNERS:7: /.env.example @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:8: /.<PROJECT_ID>/CODEOWNERS @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:9: /.<PROJECT_ID>/workflows/ @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:10: /application/account_new_risk_gate_support.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:11: /application/durable_execution_commands.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:12: /application/execution_receipt_adapter.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:13: /application/execution_service.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:14: /application/execution_state.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:15: /application/longbridge_execution.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:16: /application/paper_execution_command_consumer.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:17: /application/paper_strategy_risk_state.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:18: /runtime_execution_policy.py @<PROJECT_ID>
  • .<PROJECT_ID>/CODEOWNERS:19: /scripts/execution_report_heartbeat.py @<PROJECT_ID>
  • .<PROJECT_ID>/dot-review/review.cjs:106: const token = <REDACTED> core.getIDToken(audienceText); // Exact bytes; URL normalization may change an audience.
  • .<PROJECT_ID>/dot-review/review.cjs:190: const <PROJECT_ID> = {...pr,head:{...pr.head,sha:pair.target},base:{...pr.base,sha:pair.base}};
  • .<PROJECT_ID>/dot-review/review.cjs:191: const binding = {...b.binding({repository:trust.repo.full_name,pr:<PROJECT_ID>,policyCommit:trust.commit,files},trust.policySha),
  • .<PROJECT_ID>/dot-review/test-review.cjs:81: const content='<PROJECT_ID> source\n', sourceSHA='d'.repeat(40);
  • .<PROJECT_ID>/dot-review/test-review.cjs:82: const pr={number:7,changed_files:1,commits:1,title:'<PROJECT_ID> change',body:'<PROJECT_ID> body',
  • .<PROJECT_ID>/dot-review/test-review.cjs:100: assert.equal(audience,'https://audience.example.test');return '<PROJECT_ID>-only';},summary};

Detailed fail-before, pass-after, baseline/candidate validation and scanner receipts are retained in the worker job's out/ artifacts, outside the repository.

Why

A PAPER row excluded by HK-only targeting, or with automation disabled, must not fail because unused PAPER identity Secrets are missing or malformed. Enabled PAPER rows must continue to fail closed on malformed/missing identities and register component masks before later step logs can expose them.

Risk

Workflow authentication ordering is affected, so treat the workflow path as high risk. The selected/enabled PAPER validation script is unchanged; regression tests retain missing/malformed account/provider checks and the image-only first-step masking requirement. Selection blanks all five inherited cloud identity fields and binds no PAPER Secrets. Concurrency/restart and stale-snapshot checklist items are N/A: this is sequential per-job selection without new shared or persisted state.

Validation is offline. No hosted deployment, Secret binding, WIF authentication or runtime adoption is claimed. No deployment, workflow dispatch, configuration, IAM, Secret/Variable, trading, Kelly or stop-loss operation is part of this follow-up. This is a Draft PR awaiting the established review-and-merge bot.

@Pigbibi

Pigbibi commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T10:01:51.345286Z 3667743 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 36677431b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Pigbibi Pigbibi added the owner-approved Owner approval for high-risk PRs. AI agents must never apply this label. label Nov 5, 2026
@Pigbibi
Pigbibi marked this pull request as ready for review November 5, 2026 10:00
@Pigbibi
Pigbibi merged commit 731b50a into main Nov 5, 2026
10 of 11 checks passed
@Pigbibi
Pigbibi deleted the fix/paper-wif-selection-r2 branch November 5, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved Owner approval for high-risk PRs. AI agents must never apply this label.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant