fix(bulk-upload): re-run existing personal drafts in place instead of duplicating#13
Closed
rayopavri wants to merge 1 commit into
Closed
fix(bulk-upload): re-run existing personal drafts in place instead of duplicating#13rayopavri wants to merge 1 commit into
rayopavri wants to merge 1 commit into
Conversation
… duplicating When a submitted URL already had a 'personal' draft bundle, bulk-upload treated it as re-generatable and INSERTed a second bundle row, piling up duplicate drafts on every run. Published/pending_review URLs were skipped, but personal drafts were not. Now a personal draft is re-run in place: the job is enqueued with targetBundleId set so the pipeline UPDATEs the existing draft. If several stale drafts exist for one normalized URL, the newest is targeted and the older ones are archived. Published/pending_review still skip; flagged/ rejected/archived keep prior behavior. author-design-md: gate the 'preserve status on re-run' rule on isRerun && !autoPublish. Editor re-runs (always autoPublish=false) keep preserving curated status; bulk-upload re-runs (autoPublish=true) of a personal draft re-evaluate promotion like a fresh generation, so a refreshed draft can publish instead of staying personal forever. https://claude.ai/code/session_01DrHoAz6ZpPWURR9m4eNU6s
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
Closing — this change was pushed directly to Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Bulk-upload was re-processing URLs that already had a bundle (e.g. hashicorp.com), producing duplicate draft rows on every run.
The dedup only skips a URL when the existing bundle is
publishedorpending_review(route.ts).personaldrafts were deliberately left "re-generatable" so a junk draft couldn't block a URL forever — but the pipeline then INSERTs a new bundle rather than updating the existing draft, so duplicates pile up. The affected bundles render publicly (the slug query only hidesarchived) and show theAUTO-DISCOVEREDbadge (isCurated=false), which is the tell that they never auto-published.Fix
Add a third outcome — re-run in place — between "skip" and "insert new":
published/pending_review→ skip (unchanged)personal(draft) → re-run in place: the job is enqueued withtargetBundleIdset, sowriteDraftBundleUPDATEs the existing draft instead of inserting a duplicate. If several stale drafts exist for the same normalized URL, the newest is targeted and the older ones are archived (cleans up existing pile-up).flagged/rejected/archived→ unchangedauthor-design-md.ts: the "preserve status on re-run" rule is now gated onisRerun && !autoPublish. Editor re-runs (alwaysautoPublish=false) keep preserving curated status exactly as before; bulk-upload re-runs (autoPublish=true) of a personal draft re-evaluate promotion like a fresh generation — otherwise a refreshed draft would staypersonalforever and never publish.Why this approach
It satisfies both requirements at once: URLs aren't permanently blocked (you still get a regeneration) and no duplicate draft rows accumulate. It reuses machinery already wired through both workers (
targetBundleId+isRerun), so the change is to which job rows get created, not to pipeline behavior — low risk. The simpler "just addpersonalto the skip list" alternative would re-introduce the original "bad draft blocks the URL forever" bug.Verification
pnpm typecheck— clean (0 errors insrc/)pnpm eslinton both changed files — cleanNot yet runtime-verified end to end; left as a draft for review before the merge triggers a production deploy.
Note on workflow
AGENTS.mdprescribes committing directly tomainfor this solo project. This branch has diverged fromorigin/main(it's missing commits that are onmain), so a clean fast-forward isn't possible and force-pushingmainwould clobber those commits. A PR is the safe path here — merging it does the proper merge and triggers the usual production deploy. If you'd rather I rebase onto currentmainand push there directly per the usual flow, say the word.https://claude.ai/code/session_01DrHoAz6ZpPWURR9m4eNU6s
Generated by Claude Code