Skip to content

Commit 1e0d2f1

Browse files
dmikushinclaude
andcommitted
fix(persistence): skip upsert_page archive when source_hash is unchanged
Previously upsert_page always archived the existing PageVersion and incremented the version counter, even when the source file had not changed. Now it returns early if existing.source_hash == source_hash, avoiding unnecessary PageVersion rows and redundant writes during Phase 4 batch persist after incremental per-page saves in Phase 3. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2ad7b7f commit 1e0d2f1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • packages/core/src/repowise/core/persistence

packages/core/src/repowise/core/persistence/crud.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ async def upsert_page(
239239
existing = existing_result.scalar_one_or_none()
240240

241241
if existing is not None:
242+
# Skip update if source content has not changed
243+
if existing.source_hash == source_hash:
244+
return existing
245+
242246
# Archive the current state before overwriting
243247
snapshot = PageVersion(
244248
id=_new_uuid(),

0 commit comments

Comments
 (0)