Skip to content

Add chunk store upsert, prune, and nearest queries - #44

Merged
xquantize merged 1 commit into
developfrom
agent/stage-3-chunk-store
Oct 28, 2026
Merged

xquantize merged 1 commit into
developfrom
agent/stage-3-chunk-store

Conversation

@xquantize

Copy link
Copy Markdown
Owner

XQU-28: chunk store upsert, prune, and nearest-neighbour search.

Acceptance criteria:

  • tests/test_db_chunks.py covers nearest order, public_only filter, idempotent upsert, and prune, all marked db and skipped without DATABASE_URL
  • Store functions do not call commit() (caller owns the transaction; tests ROLLBACK)
  • nearest(..., public_only=True) excludes usage = 'private'; open/permission remain; public_only=False can return private
  • nearest uses <=> (cosine) and returns closest-first ChunkHit rows with citation fields plus distance
  • upsert_chunks raises ValueError on length mismatch or wrong embedding dimension
  • delete_chunks_except with empty keep_ids removes only that document's chunks
  • docs/plans/stage-3.md has the Slice 5 box ticked and no other change (slice 6 still open)
  • bash scripts/check.sh prints CHECK PASSED (db tests skipped locally without DATABASE_URL)
  • Only these files changed vs develop: src/swellsense/db/chunks.py, tests/test_db_chunks.py, src/swellsense/db/init.py, docs/plans/stage-3.md
  • After you push and CI runs: check passes and the new db tests execute (not skipped)

Review: all checks passed. check.sh: CHECK PASSED locally.

Made with Cursor

Slice 5 exposes document/chunk upserts and cosine nearest search without
committing inside store helpers so callers and tests own transactions.

Co-authored-by: Cursor <cursoragent@cursor.com>
@xquantize
xquantize merged commit ff478ab into develop Oct 28, 2026
1 check passed
@xquantize
xquantize deleted the agent/stage-3-chunk-store branch October 28, 2026 03:37
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