~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A record read again keeps its place in the index

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/index-order

What changes

A whole read of a writer's repo took out all its index rows and put each back with a new sequence number and indexed_at. A repo here, the group's own among them, is always read whole, so every write the group made in a space sent all its records there to the top of listSpaceRecords with today's createdAt, in path order rather than time. Now Store::index keeps a row whose path and CID are unchanged, puts in only what changed or came, and on a whole read takes out only what is gone. The same holds when reading on. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdcudh6zc5.

docs/design/spaces.md says what createdAt is.

How it was checked

keeps_a_record_read_again_where_it_was (index), failing before the change: a record read again unchanged keeps its place and its first time, a changed and a new one go to the top, and a whole read without one takes it out. The index, members, spaces and migration tests pass; clippy is clean.

🤖 Generated with Claude Code

Approved

Store::index now reads the rows already held for the repo. It skips any path whose CID is unchanged and re-inserts only changed or new records. On a whole read it deletes only the paths that are gone. I read the full function in crates/group-host/src/store.rs. A deletion in a read-on (None) still unindexes the row. A whole read that leaves a path out removes it. The index_repo state is still written in the same transaction. The new test covers an unchanged, a changed, a new and a removed record, and the spaces.md text matches the new behaviour. I found nothing that needs changing.

Merged as c7ea703
Merging this pull closed these issues