Skip to content

fix(bybit-options): pass SHADOW_SPOOL to the shadow gate receipt jq - #744

Merged
proerror77 merged 1 commit into
mainfrom
codex/bybit-gate-receipt-jq-fix
Aug 7, 2026
Merged

fix(bybit-options): pass SHADOW_SPOOL to the shadow gate receipt jq#744
proerror77 merged 1 commit into
mainfrom
codex/bybit-gate-receipt-jq-fix

Conversation

@proerror77

@proerror77 proerror77 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Change contract

host-bybit-options-shadow-gate.sh builds its final gate receipt with a jq program that references $SHADOW_SPOOL in the service block, but never passes --arg SHADOW_SPOOL. Result: after a full passing 3600-second observation window, the gate died with jq: $SHADOW_SPOOL is not defined (exit 3) instead of writing the receipt — the second never-executed-on-host startup defect in contract #4's scripts (the first was the deploy script's readonly SCRIPT_DIR ordering, fixed in #742).

Host evidence (gate run d9c9196ae1e14ee69749573c19762c62, candidate 55664299…, 2026-08-08 00:46–01:48 CST): the shadow collector ran the entire hour, collected symbols, and uploaded 2 segments to OSS with verified readback (uploaded=2, upload-only oneshot success) — only the receipt step failed.

Issue relationship

None

Out of scope

  • The bybit gate rerun and cutover with the fixed script (continues under the runtime cutover plan after merge; the staged release stays intact).

Dependencies and merge order

None

Focused validation

  • Before: jq compile error at receipt build (host journal, 01:48:39 CST).
  • After: --arg SHADOW_SPOOL "$SHADOW_SPOOL" precedes the jq program; bash -n clean.
  • test-bybit-options-shadow-gate.sh now asserts the argument is passed (same literal-grep style as the existing host-script contract block) and passes; test-bybit-options-release-contract.sh passes; git diff --check clean.

Rollout and rollback

No production impact at merge. The fixed script ships to the host as deploy assets; the staged release 55664299… is re-installed with the new bundle (candidate-only, no production unit references it) and the 1-hour gate reruns. Rollback is revert.

Scope exception

None

Summary by CodeRabbit

  • Bug Fixes

    • Service evidence now includes the configured shadow spool directory, improving deployment verification accuracy.
  • Tests

    • Added coverage to verify that the configured spool directory is passed through during evidence generation.

The gate receipt jq program references $SHADOW_SPOOL in the service block,
but the argument was never passed, so after a full passing 3600-second
observation window the gate died with 'jq: $SHADOW_SPOOL is not defined'
(exit 3) instead of writing its receipt. Host evidence: shadow gate run
d9c9196ae1e14ee69749573c19762c62 on 2026-08-08, candidate 55664299, where
the shadow collector itself collected and uploaded with verified OSS
readback for the whole hour.

Pass --arg SHADOW_SPOOL and add a contract assertion so the missing-arg
class fails CI instead of the host gate.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The shadow-gate script passes SHADOW_SPOOL to the evidence-generation jq command. A contract test verifies that the argument remains present.

Changes

Shadow-gate evidence generation

Layer / File(s) Summary
Spool argument contract
deployment/aliyun/host-bybit-options-shadow-gate.sh, deployment/aliyun/test-bybit-options-shadow-gate.sh
The host script passes SHADOW_SPOOL to jq. The contract test checks the required argument.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary fix: passing SHADOW_SPOOL to the Bybit options shadow-gate receipt jq program.
Description check ✅ Passed The description covers the change contract, issue relationship, scope, dependencies, validation, rollout, rollback, and scope exception.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/bybit-gate-receipt-jq-fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proerror77
proerror77 enabled auto-merge (squash) August 7, 2026 17:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
deployment/aliyun/test-bybit-options-shadow-gate.sh (1)

149-153: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Scope the contract assertion to the receipt jq invocation.

grep -Fq only checks that the file contains this text. It can pass if the text appears in a comment or a different command. Check the evidence-generation jq block, or stub jq and assert the recorded arguments.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@deployment/aliyun/test-bybit-options-shadow-gate.sh` around lines 149 - 153,
Scope the assertion in the test around the receipt evidence-generation jq
invocation rather than searching the entire shadow_gate file with grep. Stub or
intercept jq and verify that the receipt jq call receives the SHADOW_SPOOL
argument, ensuring comments or unrelated commands cannot satisfy the contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@deployment/aliyun/test-bybit-options-shadow-gate.sh`:
- Around line 149-153: Scope the assertion in the test around the receipt
evidence-generation jq invocation rather than searching the entire shadow_gate
file with grep. Stub or intercept jq and verify that the receipt jq call
receives the SHADOW_SPOOL argument, ensuring comments or unrelated commands
cannot satisfy the contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 350bcefa-963a-4438-a6f8-c3147650a25a

📥 Commits

Reviewing files that changed from the base of the PR and between 7b8a61a and 2809040.

📒 Files selected for processing (2)
  • deployment/aliyun/host-bybit-options-shadow-gate.sh
  • deployment/aliyun/test-bybit-options-shadow-gate.sh

@proerror77
proerror77 merged commit fdbd87f into main Aug 7, 2026
48 checks passed
@proerror77
proerror77 deleted the codex/bybit-gate-receipt-jq-fix branch August 7, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant