Data and Knowledge SystemsIngestion and freshnessPrincipal
How should an assistant select the policy version effective for a particular transaction?
By Amit Kumar3 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A policy is published on 20 September but takes effect on 1 October. A question concerns a transaction on 28 September, while retrieval ranks the newest document first. Later, a correction is published with a retroactive effective date. Design policy selection, conflict handling and citations for both “what rule applies to this transaction?” and “what did the agent know when it acted?”
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Publication time records when a document became available. Effective time records which transactions its rule governs. The newest available document can therefore be the wrong policy for the transaction being evaluated. A policy approved on 20 September may be published immediately but take effect on 1 October. The search index sees a fresh and highly relevant document. The assistant uses it to answer a question about a transaction on 28 September. Retrieval did its ordinary relevance job and still selected the wrong rule for the decision time.
I would keep at least the policy version, effective-from and effective-until times, publication state and source authority with each indexed passage. The answer needs an explicit as-of time. For “what applies to this transaction,” that may be the transaction time under the organization's rules, not the current clock. A query about a historical case can require a different version from a question about a future plan. PostgreSQL's range-type documentation describes temporal ranges and nonoverlap constraints. Those are useful implementation tools for the authoritative rule table, but a vector index alone does not become a policy engine just because each chunk has a date.
Filter or validate candidates against the effective interval before a rule is used for an action. Do it in the trusted service against the authoritative version if the decision is consequential. Handle timezone and half-open interval boundaries explicitly. If two conflicting versions claim the same time or no authoritative version covers it, return a conflict or ask for review instead of letting relevance score pick the winner. Cite the version and applicable interval in the answer so a reader can audit the choice.
A simple authoritative lookup can use a half-open interval: effective_from <= transaction_time and transaction_time < effective_until, with an explicit convention for an open-ended current version. For a hypothetical 20 September publication effective 1 October, a 28 September transaction remains under the prior applicable rule. A search rank cannot override that interval. Validate overlap and gaps for the same policy scope, rather than applying one global nonoverlap constraint to unrelated products or regions.
There is a second clock too. When did our system learn that a correction was made? A rule corrected on 5 October with a retroactive effective date of 1 September may change today's answer to “which rule is now recorded as governing 28 September,” while leaving a separate audit question about what the agent knew on 28 September. Keep source history if both questions matter. Which policy source wins when the newer indexed copy is wrong? addresses a newer indexed copy contradicting its authoritative source. This case can have two valid source versions. The error is choosing by freshness when the query is about effective time.
The policy service should return a decision record containing the policy identity, scope, effective interval, source revision and recorded-at cutoff. Retrieval can then fetch explanatory passages belonging to that selected revision. If the vector store has only an older version, do not combine the new rule’s decision with the old rule’s explanation. Fetch the matching source or report that the explanatory evidence is unavailable. A cached answer needs the same policy and time dimensions in its key or validation path.
Test a transaction exactly at the October boundary, a policy scoped to a different region, overlapping approved versions and a retroactive correction. For the correction, keep both expected answers: the currently recorded rule for the September transaction and the rule available to the agent on that September date. Overwriting the old document may make the first query easy while making the second impossible. Version history costs storage, but it preserves the evidence needed to explain a consequential decision.
Related questions
Keep practising data and knowledge systems
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux