Skip to content

[codex] harden dependency pin guard#194

Merged
Pigbibi merged 1 commit into
mainfrom
codex/harden-dependency-pin-guard-20260703
Jul 3, 2026
Merged

[codex] harden dependency pin guard#194
Pigbibi merged 1 commit into
mainfrom
codex/harden-dependency-pin-guard-20260703

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • expand the dependency pin guard from QPK-only checks to all QuantStrategyLab direct git refs
  • include constraints*.txt in the scanned dependency files
  • make the CI pin guard blocking where it was previously continue-on-error
  • add regression coverage for constraints scanning, blocking CI, and internal pin drift detection

Why

A deployment can fail when requirements.txt and constraints.txt carry different git refs for the same internal package. This hardens CI so that drift is caught before Docker/Cloud Run deploy.

Validation

  • python3 scripts/check_qpk_pin_consistency.py
  • python3 -m pytest -q tests/test_dependency_pin_guard.py
  • actionlint .github/workflows/ci.yml
  • git diff --check

Co-Authored-By: Codex <noreply@openai.com>
@Pigbibi
Pigbibi merged commit 9d312f4 into main Jul 3, 2026
2 checks passed
@Pigbibi
Pigbibi deleted the codex/harden-dependency-pin-guard-20260703 branch July 3, 2026 05:58

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bc421b1529

ℹ️ 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".


QPK_PIN_URL = "https://raw.githubusercontent.com/QuantStrategyLab/QuantPlatformKit/main/QPK_PIN"
QPK_REF_RE = re.compile(r"QuantPlatformKit\.git@([a-f0-9]{40})")
QSL_REF_RE = re.compile(r"github\.com/QuantStrategyLab/([A-Za-z0-9_.-]+)\.git@([A-Za-z0-9._/-]+)")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject unpinned QSL git refs

When a QuantStrategyLab dependency is changed to a moving ref such as @main in both requirements.txt and constraints.txt, this pattern records main as a valid ref and the later consistency check passes because there is only one unique ref; an unversioned URL without @<sha> is ignored entirely. That leaves deploys installing a changing commit even though constraints.txt declares git-based dependency SHAs as the source of truth, so the guard should fail refs that are not 40-hex SHAs instead of only comparing whatever token follows @.

Useful? React with 👍 / 👎.

for m in QPK_REF_RE.finditer(content):
sha = m.group(1)
for line_no, line in enumerate(content.splitlines(), start=1):
for repo, ref in QSL_REF_RE.findall(line):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Skip commented dependency lines

If a dependency file keeps an old QuantStrategyLab URL in a commented-out line, this still records its ref and can report drift against the active pin even though pip ignores that line. Because the new drift check runs the regex over every line rather than skipping lines whose first non-whitespace character is #, adding a commented example or temporarily disabled QSL dependency can block CI with a false mismatch.

Useful? React with 👍 / 👎.

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