Skip to content

fix(orphan-pr): seed cache from open PR branches + discard by PR number#17

Merged
nokternol merged 7 commits into
mainfrom
fix/orphan-pr-discard
Mar 9, 2026
Merged

fix(orphan-pr): seed cache from open PR branches + discard by PR number#17
nokternol merged 7 commits into
mainfrom
fix/orphan-pr-discard

Conversation

@nokternol

Copy link
Copy Markdown
Owner

Summary

Fixes the orphan PR cache miss bug that recurs on every container restart.

  • Track A (root cause): seedDraftEntries — on startup, read all open PR branches, parse + normalize each document, upsert into cache with branch/pr metadata. After restart all in-flight items are immediately actionable again.
  • Track B (safety net): POST /api/inflight/:pr/discard — closes an orphan PR by number when no cache entry exists. UI now routes doDiscard to this endpoint when item.id is missing.
  • Brain normalization: normalizeDocument (idempotent schema migration fn) + POST /api/admin/normalize endpoint + weekly Sunday 03:00 cron to keep committed docs in canonical schema form. Webhook extended to normalize the just-merged file before rebuilding the index.

Test plan

  • bash scripts/check.sh — all 8 checks green (verified locally)
  • gh run watch — CI green
  • Manually: capture an idea, restart API container, confirm /review shows full action set (not just Discard-only)
  • Manually: with a true orphan PR (no cache entry), confirm Discard closes the PR and item disappears from /review on reload

🤖 Generated with Claude Code

nokternol and others added 7 commits March 9, 2026 20:15
…all documents

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on startup

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uild

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…review page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nokternol nokternol merged commit 08b53a1 into main Mar 9, 2026
3 checks passed
@nokternol nokternol deleted the fix/orphan-pr-discard branch March 9, 2026 20:21
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