Skip to content

A search that returns a document of a decaying source counts as a use of it - #20

Merged
gedaiu merged 1 commit into
re-devfrom
feat/source-decay-record
Oct 22, 2026
Merged

gedaiu merged 1 commit into
re-devfrom
feat/source-decay-record

Conversation

@gedaiu

@gedaiu gedaiu commented Oct 22, 2026

Copy link
Copy Markdown

Slice 3 of 5 of RC-003 (a source may decay), on top of #19. A search that hands back a document of a source with decay set records the use; nothing reads the record yet, so ranking does not change.

What is in it.

  • decay::record_retrievals: one statement for all the documents of a read. For a document of a decaying source it adds one to retrieval_count, sets last_retrieved_at, and adds 2 days to the half-life up to 365 (a first retrieval starts from the source's half_life_days). Documents of other sources get no row.
  • POST .../search and the search_chunks tool record what they return, spawned off the request path: a failure is logged and never fails the read. The REST body takes record: false for probes, evals and health checks. Chat's automatic prefetch does not count.
  • docs/design/chat-and-mcp.md says so.

Tests. A store test pins: only the decaying source's document is written, +2 days per retrieval, the 365 cap, and an unknown id or an empty list writes nothing. A unit test pins that record defaults to true.

Checked locally on the rebased branch: cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace (1684 passed, 0 failed).

🤖 Generated with Claude Code

@gedaiu
gedaiu merged commit 9fec557 into re-dev Oct 22, 2026
6 checks passed
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