List access attempts backed only by expired direct grants
Original fictional practice · CC BY 4.0 · 2026-11-11

TASK
Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.

OUTPUT
request_id, expired_grant_id

RULES
Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.
Return exactly the declared columns and order. Money uses integer cents; time and date units follow the task and field dictionary. NULL is unknown and differs from numeric zero.
These are original fictional records and exercise policies. Scenario data may be shared with related tasks, whose decisions and output contracts differ.

FIELD DICTIONARY
grants:
  id INTEGER — Stable source record identifier; not a row position.
  principal TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  resource TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  effect TEXT — Permission outcome, allow or deny.
  expires INTEGER — Expiry boundary; the goal declares whether equality is eligible.
  mask INTEGER — Privacy mask level; higher values require stricter masking.

members:
  member TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  parent TEXT — Immediate parent identifier, or NULL for a hierarchy root.

requests:
  id INTEGER — Stable source record identifier; not a row position.
  user TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  resource TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  day INTEGER — Integer day index, or ISO YYYY-MM-DD date when stored as text; the task declares cutoff semantics.

approvals:
  id INTEGER — Stable source record identifier; not a row position.
  requester TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  approver TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  resource TEXT — Literal business key or category label. Match exactly and retain NULL where present.

METHOD
Return request_id,expired_grant_id when an exact-resource direct allow to that user exists but expires<=request day. This is an expired-evidence report even if a group separately allows access. Sort both.
For the first output record, request_id = 3; expired_grant_id = 5.
Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.

COMMON WRONG TURN
Checking only final access decisions hides expired direct credentials that are still being presented.

RESULT CHECK
For the first output record, request_id = 3; expired_grant_id = 5.

Use setup.sql in a fresh SQLite database and run your own SELECT or WITH. reference.sql and expected.csv contain the full worked answer. All CSVs have UTF-8 headers; empty output fields represent NULL. The browser executes SQLite, not Excel formulas. No spreadsheet function engine is claimed.
