"""Original cache/ACL model with synthetic document; no model or search service."""
ACCESS={'alice':{'D7'},'ben':set()}
TEXT={'D7':'Original internal teaching note, not private customer data.'}
BAD_CACHE={'What is the policy?':TEXT['D7']}
INDEX_RESULT=['D7']
def authorised_context(user,candidate_ids):
    return [TEXT[doc] for doc in candidate_ids if doc in ACCESS[user]]
assert authorised_context('alice',INDEX_RESULT)==[TEXT['D7']]
assert authorised_context('ben',INDEX_RESULT)==[]
assert BAD_CACHE['What is the policy?']==TEXT['D7']  # A bad query-only cache ignores requester.
old_transcript=authorised_context('alice',INDEX_RESULT)[0]
ACCESS['alice'].remove('D7')
assert authorised_context('alice',INDEX_RESULT)==[]  # Stale cache/index IDs must be rechecked.
assert old_transcript==TEXT['D7']  # A new check cannot unsend previously delivered text.
print('5/5 synthetic boundary assertions passed; no model behaviour, network or actual revoked-data access tested.')
