Fix on-demand persist reverting profile hash after concurrent generate - #57
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
In-flight tool generation could finish after Generate Full Report and write the old profileDataHash plus a stale report onto the new natal charts. Re-read the live user hash before persist and return 409 when it no longer matches. Co-authored-by: Andy Oliver Rozario <andyrozario7@gmail.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
8 tasks
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.
What changed
users.profileDataHashno longer matches the hash captured at generation start, so an in-flight Tarot (or other tool) write cannot revert a newer Generate Full Report.409 profile_hash_changedfromPOST /api/profile/ensure-tool-reportinstead of storing the stale reading.Why this change is safe
persistOnDemandToolReportsalways wroteusers.profileDataHash, the tool report, and generation lock/job docs from the request-start hash, with no live-hash check. Ensure-tool-report can run up to 90s and does not hold the generation lock.Bug and impact
profileDataHash: H1, an old-birth tool report onto the new natal profile, and marks generation locks/jobs completed.That reverts the stored hash while birth fields stay H2, so the next Generate is treated as another hash-change regen (possible extra PAYG debit) and mixed-generation reports remain stored.
This is complementary to open PR #53, which clears stale catalog fields at generate time and gates display on hash match. #53 does not stop a persist that finishes after generate.
Verification
pnpm exec eslinton touched files (0 errors).pnpm test— 70 suites / 384 tests passed.pnpm run securitypassed (audit + security lint).Regression prevention
tests/unit/onDemandStalePersist.test.tsproving a live H2 hash blocks H1 persist writes.skippedStaleHash.users.profileDataHashas before.Release checklist (solo-friendly)
CI / Lint + JestCI / Playwright smokemain.