Skip to content

Commit 7b7c66f

Browse files
Pigbibiclaude
andcommitted
refactor(cloud): decouple GCP-specific naming, add cloud-neutral API and AWS provider
Phase 1 — Internal naming unification: - Rename gcp_project_id → project_id, gcs_prefix_uri → cloud_prefix_uri - Rename gcs_uri → cloud_uri, _gcs_* → _cloud_*, _parse_gcs_uri → _parse_cloud_uri - All public APIs keep backward-compat aliases with DeprecationWarning - Env vars: new CLOUD_* names with fallback to old GCS_* names - URI parsers now accept both gs:// and s3:// Phase 2 — AWS provider: - Add aws_provider.py implementing all 6 Protocol types - SecretStore → AWS Secrets Manager, ObjectStore → S3 - DocumentStore → DynamoDB, ComputeDiscovery → EC2 - Register aws in all factory functions (QSL_CLOUD_PROVIDER=aws) Phase 3 — Downstream repos: - BinancePlatform: remove hardcoded google.cloud.firestore import - CryptoLivePoolPipelines: rename gcp_project_id/gcs_bucket/gcs_root_prefix - All platform repos: update kwarg names to cloud-neutral variants Tests: 366 passed, 0 failed, +7 new AWS provider registration tests. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 21dcef8 commit 7b7c66f

24 files changed

Lines changed: 1855 additions & 169 deletions
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"version": 1,
3+
"auto_merge_label": "auto-merge-ok",
4+
"human_review_label": "human-review-required",
5+
"monthly_marker_prefix": "<!-- codex-monthly-remediation:issue-",
6+
"blocked_path_patterns": [
7+
"(^|/)(\\.env|.*secret.*|.*credential.*|.*token.*|.*private.*|.*\\.pem|.*\\.key)$"
8+
],
9+
"risk_policy": {
10+
"low": {
11+
"prefixes": [
12+
"docs/",
13+
"tests/"
14+
],
15+
"exact": [
16+
"README.md",
17+
"README.zh-CN.md"
18+
],
19+
"reason": "docs/tests/readme-only changes"
20+
},
21+
"high": {
22+
"reason": "source code changes require review"
23+
}
24+
},
25+
"max_changed_files": 30,
26+
"max_changed_lines": 2000,
27+
"pr_review": {
28+
"enabled": true,
29+
"block_severities": [
30+
"critical",
31+
"high"
32+
],
33+
"skip_paths": [
34+
"docs/**",
35+
"**.md",
36+
"**.txt",
37+
"**.json",
38+
"**.csv",
39+
"LICENSE",
40+
".github/dependabot*"
41+
],
42+
"skip_risk_levels": [
43+
"low"
44+
],
45+
"timeout_minutes": 20,
46+
"max_diff_lines": 2400,
47+
"block_on_review_failure": false
48+
}
49+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Codex PR Review
2+
3+
# Always run on PRs to guarantee a check run exists for branch protection.
4+
# The Python script handles skip logic internally for trivial changes.
5+
on:
6+
pull_request:
7+
types: [opened, synchronize, reopened]
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
issues: write
13+
pull-requests: write
14+
15+
concurrency:
16+
group: codex-pr-review-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
review:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 30
23+
env:
24+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v6
29+
30+
- name: Set up Python
31+
uses: actions/setup-python@v6
32+
with:
33+
python-version: "3.11"
34+
35+
- name: Run Codex PR Review
36+
id: review
37+
env:
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
40+
ANTHROPIC_MODEL: ${{ vars.ANTHROPIC_MODEL || 'claude-sonnet-4-6' }}
41+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
42+
OPENAI_MODEL: ${{ vars.OPENAI_MODEL || 'gpt-5.4-mini' }}
43+
CODEX_AUDIT_SERVICE_URL: ${{ secrets.CODEX_AUDIT_SERVICE_URL }}
44+
CODEX_AUDIT_SERVICE_AUDIENCE: ${{ vars.CODEX_AUDIT_SERVICE_AUDIENCE || 'quant-codex-audit' }}
45+
run: python scripts/run_codex_pr_review.py
46+
47+
- name: Upload review diagnostics
48+
if: always()
49+
uses: actions/upload-artifact@v7
50+
with:
51+
name: codex-pr-review-${{ github.event.pull_request.number }}-${{ github.run_id }}
52+
path: data/output/codex_pr_review/
53+
if-no-files-found: warn

prompts/pr_review.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
You are reviewing a pull request for a **production quantitative trading and data pipeline codebase**.
2+
3+
## Review priorities (in order)
4+
5+
1. **Security**: credential leaks, injection vectors, unauthorized data access
6+
2. **Correctness**: logic errors, wrong calculations, data corruption
7+
3. **Crash risks**: unhandled exceptions, null pointer dereferences, resource exhaustion
8+
4. **Data integrity**: silent data loss, incorrect transformations, schema violations
9+
5. **API compatibility**: breaking changes to function signatures, configuration formats
10+
6. **Race conditions**: concurrent access to shared state, inconsistent reads
11+
12+
## What NOT to flag
13+
14+
- Code style or formatting preferences
15+
- Variable/function naming suggestions
16+
- Missing type annotations
17+
- Documentation quality
18+
- Minor refactoring opportunities
19+
- Test coverage suggestions
20+
21+
## Severity definitions
22+
23+
| Severity | Definition | Example |
24+
|----------|-----------|---------|
25+
| critical | Causes data loss, security breach, or production crash | SQL injection, credential in plaintext, deletion without backup |
26+
| high | Produces wrong results or breaks downstream systems | Wrong formula, API signature change, resource leak |
27+
| medium | Degrades reliability or performance under load | Missing error handling, N+1 query, unbounded growth |
28+
| low | Misleading or confusing but not dangerous | Stale comment, redundant code, unclear intent |
29+
30+
## Output format
31+
32+
Return exactly one JSON object (do not wrap in markdown fences):
33+
34+
```json
35+
{
36+
"summary": "Brief assessment of the PR (1-3 sentences)",
37+
"findings": [
38+
{
39+
"severity": "critical",
40+
"category": "security",
41+
"file": "path/to/file.py",
42+
"line": 42,
43+
"description": "What's wrong",
44+
"suggestion": "How to fix it"
45+
}
46+
]
47+
}
48+
```
49+
50+
If no issues found, return `"findings": []`.

scripts/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)