Skip to content

fix(bybit-options): make the deploy script survive shell startup - #742

Merged
proerror77 merged 2 commits into
mainfrom
codex/bybit-deploy-script-dir-fix
Aug 7, 2026
Merged

fix(bybit-options): make the deploy script survive shell startup#742
proerror77 merged 2 commits into
mainfrom
codex/bybit-deploy-script-dir-fix

Conversation

@proerror77

@proerror77 proerror77 commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Change contract

bybit-options-archiver-deploy.sh declared readonly SCRIPT_DIR before assigning it, so every invocation died with SCRIPT_DIR: readonly variable (exit 1) before reaching any logic. This blocks the bybit-options archiver host cutover (contract #4): the governed staging lane cannot run at all. The release contract test only grepped the script text and never executed it, which is how the defect shipped.

One-line swap to assignment-then-readonly, matching every other deploy script in deployment/aliyun/ (verified: all 13 others use the correct order; this was the only inverted one).

Issue relationship

None

Out of scope

  • The bybit host cutover itself (artifact staging → shadow gate → cutover) continues under the runtime cutover plan after this merges.
  • host-bybit-options-shadow-gate.sh / host-bybit-options-cutover.sh were executed and start correctly (fail only on the expected root check).

Dependencies and merge order

None

Focused validation

  • Before: bash deployment/aliyun/bybit-options-archiver-deploy.shline 20: SCRIPT_DIR: readonly variable, exit 1.
  • After: same invocation reaches the usage contract, exit 2.
  • bash deployment/aliyun/test-bybit-options-release-contract.sh → passes, now including a new no-argument invocation smoke assertion (must exit 2 with usage text, not a shell startup error) so this regression class fails CI instead of the host cutover.
  • git diff --check clean.

Rollout and rollback

No production impact at merge; the script runs only on the governed host lane. Unblocks the pending bybit-options cutover. Rollback is revert.

Scope exception

None

Summary by CodeRabbit

  • Bug Fixes

    • Improved deployment script startup reliability by ensuring required path information is initialized before use.
    • The deployment command now consistently handles missing arguments by returning the expected error status and usage guidance.
  • Tests

    • Added release-contract coverage to verify startup behavior, argument validation, exit status, and usage output.

bybit-options-archiver-deploy.sh declared 'readonly SCRIPT_DIR' before
assigning it, so every invocation died with 'SCRIPT_DIR: readonly
variable' before reaching any logic. The release contract test only
grepped the script text and never executed it, so the defect shipped.

Swap the two lines to match every other deploy script in the directory,
and add a no-argument invocation smoke assertion to the contract test so
startup regressions fail CI instead of the host cutover.
@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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 873c6907-aa4d-45bc-b1f0-cf0cae65d069

📥 Commits

Reviewing files that changed from the base of the PR and between 52eb148 and 935723a.

📒 Files selected for processing (2)
  • deployment/aliyun/bybit-options-archiver-deploy.sh
  • deployment/aliyun/test-bybit-options-release-contract.sh

📝 Walkthrough

Walkthrough

The deployment script now initializes SCRIPT_DIR before declaring it readonly. A release-contract test verifies that a no-argument invocation exits with status 2 and prints the expected usage text.

Changes

Deploy script contract

Layer / File(s) Summary
Script initialization and usage validation
deployment/aliyun/bybit-options-archiver-deploy.sh, deployment/aliyun/test-bybit-options-release-contract.sh
SCRIPT_DIR is initialized before its readonly declaration. The release-contract test checks no-argument execution, exit status 2, and the documented install <artifact-dir> <source-revision> usage text.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the bybit-options deployment script fix and its purpose.
Description check ✅ Passed The description includes all required sections and provides clear change, validation, scope, rollout, and rollback details.
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-deploy-script-dir-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 merged commit 96b7703 into main Aug 7, 2026
47 checks passed
@proerror77
proerror77 deleted the codex/bybit-deploy-script-dir-fix branch August 7, 2026 16:06
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