fix: undated uploads using extraction-time recording anchors - #730
AaronProbha18 wants to merge 1 commit into
Conversation
WaylandYang
left a comment
There was a problem hiding this comment.
Thanks for picking this up. The prompt half is exactly what #714 asked for. The anchor half needs another pass, and a few requirements from the issue thread are still missing.
1. Prompt: keep it. prompt_doc_time is None for upload_time, so a "last year" in an undated upload no longer resolves against the upload day. 👍
2. Anchor: please drop the Utc::now() fallback. Extraction time is still a transaction-axis timestamp, the same kind of value #714 is about. It just comes from a different clock.
- In the normal flow, extraction runs minutes after upload, so the anchors barely change.
- On re-extraction, the anchor drifts later.
- The direction we've taken is recorded in 0045 (#724): attested time stays null for an undated document, and closing a timeline no longer depends on it. That work lands with 0045's cuts.
- So please leave the four anchor sites as they are on dev for now, and remove the 0022 revision note (it would record the opposite direction).
3. Tests. Please add the ones asked for in the thread, scoped to what this PR now changes:
- an undated upload (
doc_time_source = 'upload_time') builds a prompt with no document date; - a dated document (
content/source) still gets its date in the prompt.
4. CI.
cargo fmt --all --checkfails on thevalidity_ofcall.- The commit has no
Signed-off-by, so DCO is red.git commit --amend -sand a force-push will fix it.
With 1–4 done this is a small, safe merge.
|
All four done — thanks, the 0045 pointer is the part I'd missed. 1. Kept, and pulled out into 2. Dropped. The four anchor sites are back to 3. Two unit tests beside it:
Extracting the helper was mostly so these could be plain unit tests rather than 4. The |
`documents.create` writes `doc_time = now()` with `doc_time_source = 'upload_time'` for an upload that carries no date of its own. Extraction read `doc.doc_time` straight into the prompt, so the model was told an undated memo was written on the day it was uploaded, and a "last year" in it resolved against that day (deeplethe#714). `prompt_doc_date` gates the prompt's date on the source: `upload_time` means no date, and `build_messages` already says the date is unknown when it gets None. Dated documents (`content` / `source`) are unchanged. The recording-axis anchors are left alone. Extraction time is a transaction-axis value too, only from a different clock, and 0045 (deeplethe#724) has the direction for those: attested time stays null for an undated document, and closing a timeline stops depending on it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Aaron Personal <aaronprobha@gmail.com>
5290ccf to
13c0ffa
Compare
|
Thank you for this. It is superseded by #740 (0045): the open contract no longer sends any document date to the model, and migration 0064 sets |
What changed
documents.createstoresdoc_time = now()withdoc_time_source = 'upload_time'for an undated upload — a record-axis timestamp standing in a world-axis column.
extraction.rsreaddoc.doc_timeat five sites and never looked atdoc_time_source, so an upload-time value was used both as "the document's owndate" in the prompt and as the recording anchor for every fact and name fact
extracted from it. A memo uploaded today that says "last year" resolved to last
year from today, and every fact it produced anchored on today.
The two sites want different things, so they stop sharing a value:
prompt_doc_timeisNonewhendoc_time_source == "upload_time";build_messagesalready handles that.attest_earlierno-ops onNone("nowcan't be earlier than any existing evidence"), so a null anchor would leave
close_with_unknown_endnothing to close against and an ended relation wouldgo on reading as still holding.
recording_anchorfalls back to this run'sUtc::now()— 0022 section 3's "the moment of recording", now meaning themoment of extraction rather than of upload. Computed once per run so every
fact from one document shares an anchor.
All four anchor sites take
Some(recording_anchor); no site readsdoc.doc_timedirectly any more.graph.rs,temporal.rsandnames.rsareunchanged — their logic was already right given a real anchor; the bug was
entirely in what extraction handed them. No schema change.
Dated documents (
doc_time_sourceofcontentorsource) behave exactly asbefore.
0022 section 3 gets a dated revision note.