Skip to content

[D] Release reconciliation, health, and ops docs - #20

Merged
FlyOverCoderKY merged 3 commits into
mainfrom
grok/github-release-webhook-phase-d
Jul 29, 2026
Merged

FlyOverCoderKY merged 3 commits into
mainfrom
grok/github-release-webhook-phase-d

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Summary

Implements Phase D of docs/GITHUB_RELEASE_WEBHOOK_PLAN.md: recovery and operations for GitHub release projections.

  • Initial backfill and six-hour reconciliation via public GitHub /releases/latest (conditional ETags, timeouts, body bounds)
  • Authoritative apply so a missed delete/unpublish converges to GitHub's preceding stable release
  • Separate cron 0 */6 * * * beside minute Identity maintenance
  • Health detail githubReleases (configured flags, last webhook/recon times, stale, count)
  • Operator docs: secret install, org webhook, redelivery, recon, rollback

Phase D exit criteria

  • Initial backfill (same path as reconciliation; no receipt rows)
  • Six-hour reconciliation beside, not inside, Identity maintenance
  • Extend health and structured logs
  • Document secret installation, org webhook, redelivery, recon, rollback
  • Missed/deleted delivery converges without operator D1 edits

Test evidence

npm run check — pass
npm test — 105 node + 1 D1 tests pass
npm run build — pass

Residual risks

  • Production secret + org webhook remain Phase E
  • Unauthenticated GitHub API rate limits are fine at current repo count; escalate to a least-privileged App token only if needed

Backfill and six-hour GitHub reconciliation converge current stable releases without webhook receipts. Cron dispatch keeps Identity minute maintenance independent. Health exposes configuration, timestamps, staleness, and release counts; README documents secrets, webhooks, redelivery, and rollback.

Part of docs/GITHUB_RELEASE_WEBHOOK_PLAN.md Phase D.
Copilot AI review requested due to automatic review settings July 29, 2026 02:19
@cursor

cursor Bot commented Jul 29, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements Phase D of the GitHub release webhook plan for the Worker: adds an initial backfill + 6-hour reconciliation loop against GitHub’s public /releases/latest, persists durable ops markers (webhook/recon timestamps + ETags), extends health output, and documents operator procedures.

Changes:

  • Add a 6-hour scheduled reconciliation job (separate from minute Identity maintenance) plus reconciliation/backfill implementation with ETag + bounded fetch.
  • Introduce durable ops state for release ingestion (last success markers, per-repo ETags) and expose githubReleases health detail.
  • Add operator documentation and tests for reconciliation + ops state.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
worker/wrangler.jsonc Adds separate 6-hour cron trigger alongside minute maintenance.
worker/src/release-reconciliation.ts Implements backfill + reconciliation against GitHub /releases/latest, including ETag handling and ops marker writes.
worker/src/release-reconciliation.test.ts Adds reconciliation/backfill tests (ETag, clear-on-404, partial failure behavior, etc.).
worker/src/release-projection.ts Adds authoritative apply path for reconciliation/backfill writes.
worker/src/release-ops-state.ts Adds durable ops state storage for webhook/reconciliation markers + per-repo ETags and stale detection helper.
worker/src/release-ops-state.test.ts Tests ops marker persistence and staleness classification.
worker/src/release-health.ts Adds health detail loader for release ingestion/read configuration and ops state.
worker/src/index.ts Wires githubReleases health detail and dispatches reconciliation scheduled runs by cron string.
worker/src/github-release-webhook.ts Records webhook success marker after processing deliveries.
worker/README.md Documents operator setup (secret install, schedules, org webhook, redelivery, reconciliation, rollback, health fields).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/release-projection.ts Resolved

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

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

};
// Authoritative path: GitHub's current stable wins even when older than a
// local row left behind by a missed delete/unpublish webhook.
const wrote = await applyAuthoritativeCurrentRelease(store, release);

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 Guard authoritative writes against concurrent webhooks

If GitHub prepares a response for release A and release B is published while that request is in flight, the webhook can store B before this unconditional authoritative write stores the stale A response over it. The public endpoint then advertises A until the next six-hour reconciliation, so capture the projection version before fetching and condition the reconciliation write on that version remaining unchanged, or otherwise verify response freshness before replacing a webhook update.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Intentional for Phase D exit criterion: reconciliation must force-write GitHub's current stable even when it is older than a local row left by a missed delete/unpublish. Guarding with "local newer wins" re-breaks that path. A concurrent publish during the GitHub GET is a rare race; the webhook itself or the next six-hour recon restores truth. Leaving unresolved for human visibility.

Comment thread worker/src/release-reconciliation.ts Resolved
Comment thread worker/src/github-release-webhook.ts Resolved
…ers.

Refresh observation timestamps on 304 and identical content, isolate repository errors, fail closed on unusable 2xx bodies, and keep webhook 204 when only the health marker write fails.
@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 243c0c90bc

ℹ️ 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 worker/src/release-reconciliation.ts Resolved
Comment on lines +188 to +189
changed = 'written';
return { action: 'write', value: release };

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 webhook updates that race with reconciliation

When GitHub publishes, edits, unpublishes, or deletes a release after this reconciliation's GET but before this update, the webhook can first write the newer state and this unconditional write then replace it with the stale response. The public endpoint remains wrong until the next six-hour run, so the authoritative write should be conditional on the projection version observed before the request and skipped when a webhook changed it in the meantime.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same intentional trade-off as the earlier concurrent-webhook thread: force-write is required for missed delete/unpublish convergence (Phase D exit). A publish that lands between GET and store is rare; the webhook or next recon repairs it within the six-hour cadence. Leaving unresolved for human visibility.

Address releases by numeric repository ID and reject nested repository mismatches so rename or recreate cannot attach another repo's facts to an allowlisted slot.
@FlyOverCoderKY

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 28927440b6

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

@FlyOverCoderKY
FlyOverCoderKY merged commit 9313773 into main Jul 29, 2026
1 check passed
@FlyOverCoderKY
FlyOverCoderKY deleted the grok/github-release-webhook-phase-d branch July 29, 2026 02:33
FlyOverCoderKY added a commit that referenced this pull request Jul 29, 2026
Reconcile plan status with merged PRs #19 and #20. Production secret and organization webhook activation remain.
FlyOverCoderKY added a commit that referenced this pull request Jul 29, 2026
* [docs] Mark GitHub release webhook Phases C–D complete; Phase E open.

Reconcile plan status with merged PRs #19 and #20. Production secret and organization webhook activation remain.

* Clarify Phase D/E wording from Copilot review.

* Note ETag invalidation/epoch follow-up in Phase D reconciliation.
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.

2 participants