Skip to content

Harden research promotion idempotence and evidence gates - #98

Merged
Techris93 merged 2 commits into
mainfrom
codex/promotion-policy-hardening
Jul 29, 2026
Merged

Harden research promotion idempotence and evidence gates#98
Techris93 merged 2 commits into
mainfrom
codex/promotion-policy-hardening

Conversation

@Techris93

Copy link
Copy Markdown
Owner

Follow-up hardening for PR #97.

  • serializes promotion with BEGIN IMMEDIATE
  • deterministic case, subject, and evidence IDs
  • prevents duplicate cases on retries/concurrent apply
  • counts distinct evidence values rather than field names
  • adds duplicate-URL and retry-idempotence tests

Verification: focused promotion tests pass; full Core suite passed on the parent implementation.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 29, 2026

Copy link
Copy Markdown

Deploying website with  Cloudflare Pages  Cloudflare Pages

Latest commit: b573461
Status: ✅  Deploy successful!
Preview URL: https://12bbd3f7.website-bks.pages.dev
Branch Preview URL: https://codex-promotion-policy-harde.website-bks.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying secopsai with  Cloudflare Pages  Cloudflare Pages

Latest commit: b573461
Status: ✅  Deploy successful!
Preview URL: https://6dcd0666.secopsai.pages.dev
Branch Preview URL: https://codex-promotion-policy-harde.secopsai.pages.dev

View logs

@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: b5734617db

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

Comment thread secopsai/research_discovery.py Outdated
if evidence.get("metadata_url"):
add_evidence(case["case_id"], evidence_type="registry_metadata", title="Registry metadata captured during candidate discovery", locator=evidence["metadata_url"], provenance="official registry monitor", notes=candidate.get("reason") or "", metadata={"candidate_id": candidate["candidate_id"]}, db_path=db_path, actor=actor)
case_id = f"RSC-{hashlib.sha256(candidate['candidate_id'].encode()).hexdigest()[:12].upper()}"
subject_id = f"SUB-{hashlib.sha256(f'{case_id}|package|{candidate["ecosystem"]}|{candidate["package"]}|{candidate.get("version") or ""}'.encode()).hexdigest()[:16].upper()}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Use Python 3.10-compatible quoting for deterministic IDs

On the project's supported Python 3.10/3.11 runtimes, reusing the outer f-string's double quotes inside these expressions is a SyntaxError (the relaxed nested-f-string grammar only arrived in Python 3.12). Importing secopsai.research_discovery therefore fails before any command can run; rewrite this and the analogous evidence_id expression without same-quoted nested f-strings.

Useful? React with 👍 / 👎.

Comment on lines +602 to +604
connection.execute("""INSERT OR IGNORE INTO research_subjects
(subject_id, case_id, subject_type, ecosystem, name, version, publisher, status, metadata_json, created_at)
VALUES (?, ?, 'package', ?, ?, ?, ?, 'active', ?, ?)""",

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 Preserve the promoted subject's available registry state

Every successful promotion now inserts the subject without registry_state, so the schema migration supplies its unknown default. The replaced add_subject call explicitly recorded registry_state="available", which is appropriate because this candidate was observed through registry metadata; promoted cases now contain an inaccurate lifecycle state and require a redundant registry check to restore it.

Useful? React with 👍 / 👎.

@Techris93
Techris93 merged commit 86cd4cc into main Jul 29, 2026
13 of 14 checks passed
@Techris93
Techris93 deleted the codex/promotion-policy-hardening branch July 29, 2026 00:27
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