A retrieved document is not yet a current decision: freshness in knowledge search

Six synthetic records show how to separate modification dates from applicability, apply source authority, and preserve uncertainty when decisions conflict.

A retrieved document still needs its applicability checked.
A retrieved document still needs its applicability checked.

Search returned a document containing the right term and displayed a recent modification date beside it. That may still be insufficient for an answer. The file could contain a draft, a copy of a superseded rule, or a decision for another product. Even a small, carefully assembled context can contain all these alternatives at once.

Consider a specific question: what thumbnail width has been approved for the public gallery? The teaching dataset contains six records with different values. We need to select the currently applicable basis for an answer and explain why the remaining records do not govern this decision. When the grounds contradict one another, the result must preserve that uncertainty.

A small Python exercise using the standard library was created for this purpose. It accepts a supplied synthetic document set and resolves the question according to explicit rules. It calls neither a search engine nor a model. This isolates the step between “the document was found” and “the document is an acceptable basis for answering.”

The question defines the selection boundary

The query contains three fields: scope=gallery/public, key=thumbnail_width_px, and as_of=2030-01-20. Every calendar value in the dataset is fictional and serves to explain time boundaries. These values do not describe the date of the author's practical work or a future product plan.

scope requires an exact match. A decision for gallery/staff does not apply to gallery/public merely because both contain the word “gallery.” key must also match: a width rule does not answer a question about file format. There is no automatic understanding of synonyms, inheritance between products, or selection of the nearest section.

Each document stores a ref, revision, value, status, authority class, and effective dates. The pair ref and revision identifies a specific revision. The revision number alone does not establish its approval.

Record Value, px Status Role in the answer for the public gallery
gallery-policy@1 240 superseded The replaced rule is retained to explain history
gallery-policy@2 320 current An eligible approved rule
gallery-policy@3 400 draft The draft does not determine the current value
ops-note@1 280 current An operational note has lower authority
staff-policy@1 640 current The decision belongs to another scope
future-policy@1 480 current The approved rule is not yet effective

The labels in the table are manually defined conditions of the exercise. A real process must establish where they come from and who may change them. An arbitrary document does not acquire authority simply by containing the term approved_policy.

File modification time and the rule's effective period

In the dataset, the old gallery-policy@1 has modified_on=2030-01-19, while the eligible gallery-policy@2 has 2030-01-05. The later modification could concern moving or annotating the historical record. Sorting only by that field would place the old rule above the current one.

Therefore, modified_on is retained in the explanation but does not rank authority. Applicability uses separate fields: effective_from and effective_until. The start date is included in the interval; the end date is excluded. A value of null means that the record specifies no end boundary.

The revision with width 320 applies from 2030-01-01 to 2030-02-01. It is eligible on the first day and no longer eligible on the last. The future approved rule with value 480 becomes effective on 2030-02-01. The draft with value 400 has that same start date, but the arrival of the date does not itself change the draft to current.

The exercise operates on calendar days. It restricts the format to YYYY-MM-DD and uses Python date.fromisoformat to validate the date. The method supports a wider range of ISO 8601 forms, so a format check precedes it. Times of day, time zones, and changes within a day would require a different contract.

There is also a separate historical limitation. The resolver reads statuses from the supplied dataset and does not reconstruct their history. If a record is marked superseded today, a query using a past date will not restore its former status. Answering “what applied then” requires the corresponding historical snapshot or a status change log.

Eligibility comes before authority

Selection follows a defined order. First, the shape of the entire dataset is validated. Records with another scope, another key, a draft or superseded status, or a future or expired interval are then excluded. Only after this step does the resolver compare the authority of the remaining sources.

The conditions of this task place approved_policy above operational_note. A final answer additionally requires an approved policy. When it is absent, a note does not become its substitute: the result is unknown with the reason insufficient_authority.

This is a deliberate policy for a question about an approved width. A task asking “what assumption was recorded during operation” could use different sources and a different sufficiency threshold. They should be defined before reading the results to avoid accidentally treating the most convenient document as the governing source.

Strict input validation also matters here. The default Python JSON decoder accepts repeated field names and keeps the last value. The exercise rejects duplicates so that two status fields cannot acquire an unnoticed precedence. File size, record count, types, permitted fields, and calendar values are also bounded. Invalid data returns a separate error rather than uncertainty that resembles a valid answer.

A larger number does not resolve a conflict

For the baseline dataset, the local resolver returned 320 and the specific revision gallery-policy@2. Now add another approved rule for the same scope, key, and period. It specifies 360 and has both a higher revision number and a later modification date.

Selection leaves two equally authoritative grounds with different values. The algorithm returns unknown, value=null, the reason conflicting_authorities, and both records. It does not vote by the number of copies, select the newest file, or fall back to a lower-level note.

The final decision depends on the values of all sources at the highest eligible authority level. After building top, the code expresses this directly:

values = {record["value"] for record in top}
decision = "known" if len(values) == 1 and rank == AUTHORITY[REQUIRED_AUTHORITY] else "unknown"

If both approved records specify 320, the answer becomes known while retaining both references. If two revisions of the same document are simultaneously marked current and specify different values, that is also a conflict. A higher revision does not resolve it by itself.

Relationships between revisions are worth preserving separately. For example, W3C PROV-O describes wasRevisionOf as a derivation relationship between a revised entity and an earlier one. This helps explain where a version came from. Approval conditions, applicability, and precedence still require an explicit model of the particular process. Our JSON does not implement PROV-O or a complete provenance graph.

Uncertainty should suggest the next action

The word unknown is useful when its reason is visible alongside it. The exercise distinguishes three situations:

Reason What happened What needs clarification
no_eligible_source No source matches the scope, key, status, and time requirements Whether the query is correct and the necessary source is present
insufficient_authority Only a lower-authority source is available Where approval is recorded or which threshold fits the task
conflicting_authorities Eligible, equally authoritative decisions contradict one another Which specific decision supersedes the other

A separate list explains the exclusion of every record. For the baseline example, it exposes the draft, the superseded rule, another scope, a future interval, and the note's lower authority. The absence of an answer becomes something more useful than an unexplained empty result.

If this result is later sent to a model, the reason and references should travel together. Turning unknown into a confident sentence would discard a useful property of the previous step. A known answer should also preserve the scope, applicability date, and revisions so that the next reader understands its boundary.

Reproducing the decision without a search service

The local run on Python 3.12.14 executed 55 scenarios; all produced the expected result. They covered the start and end of an interval, a future rule, a draft with a larger number, conflicting revisions, missing approval, invalid dates, duplicates, and separate CLI processes. The number of search-engine and model-provider calls was 0.

Three control cases show what this mechanism does not establish. If the value of an approved rule in the trusted dataset is changed to 999, the resolver accepts the label and returns 999. If the second conflicting source is not supplied, the resolver cannot discover it. If only a document's current status is provided, it cannot recover the document's past.

The preceding step therefore needs its own guarantees for provenance, access, and completeness of the necessary sources. The following step needs verification of how the answer is used. This exercise does not evaluate model quality, search completeness, or a deployed product implementation.

The practical result is a reproducible decision with visible grounds. For the public gallery, it is 320 based on a specific revision; for an unresolved conflict, it is explained uncertainty. A retrieved document becomes a checkable basis for work through its subject, authority, effective period, and preserved contradictions.

  1. Repository governance Rules that survive the next development session
  2. Standards & Governance From candidate to standard: when a rule earns mandatory status
  3. Knowledge & AI RAG for technical documentation: questions, sources and answer verification

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article