Skip to content

fix(ops): block concentrated district pending spikes in auto-publish - #357

Open
rudrakshbhandari wants to merge 2 commits into
mainfrom
fix/auto-publish-district-delta-gate
Open

fix(ops): block concentrated district pending spikes in auto-publish#357
rudrakshbhandari wants to merge 2 commits into
mainfrom
fix/auto-publish-district-delta-gate

Conversation

@rudrakshbhandari

Copy link
Copy Markdown
Owner

Summary

  • Hardens the auto-publish gate after Gujarat's Jul 12 Surat-driven spike auto-published at only +8.8% state delta, then blocked daily thereafter at ~−23%.
  • Adds a secondary absolute pending floor (>100k cases and >5%) so large sub-20% state moves still require human review.
  • Adds a lower-court concentrated-district gate (>40% district swing, ≥25k abs, ≥50% of state delta) wired through publish-pending via the latest published snapshot's district map.
  • Documents the stronger guardrails in README.md.

Live follow-up already done

  • Manually published Gujarat run_3943381e-9ba0-4510-a857-bc81d778bace as publication_e402ffc3-eaec-48da-9ee0-e58c4ae5ae82.
  • Public /v1/states/gujarat/stats now shows pendingCases=1602737 from that run.

Test plan

  • npx vitest run tests/auto-publish-gate.test.ts tests/auto-publish-runner.test.ts tests/publish-pending-runner.test.ts
  • Confirm CI passes on this PR
  • After merge/deploy, next GJ daily fetch should auto-publish if pending stays near ~1.60M (no more outlier SNS unless another real swing appears)

Catch Gujarat-style reporting corrections that stay under the 20% state
threshold by adding an absolute pending floor and a single-district
concentration gate for lower-court publish-pending sweeps.

@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: 880847a01e

ℹ️ 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 src/ops/auto-publish-gate.ts Outdated
@github-actions

Copy link
Copy Markdown

Preview ready: https://mvhppzh383.ap-south-1.awsapprunner.com

Service: nyaaywatch-pr-357
Mode: fixture-backed public web preview

Walk the union of previous and current district maps so NJDG add, rename,
and drop events still trip the concentrated-district review path.
@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.

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