HANDOFF NOTE: project "queue" (target only)

1. Interface and contract (fixed)
evaluate(payload) -> {ready:[id], waiting:[{id,at}], dead:[id], cancelled:[id]}
- Input is an integer "now" plus jobs. Each job has id, key, priority, created, attempt, last_code, cancelled, due, failed_at.
- All numbers are nonnegative integers. last_code 0 means no failure. Do not mutate the input.

2. CURRENT configuration (after Updates 1-5; later updates replace only the keys they name)
- base_delay = 200
- exponential = false
- max_attempts = 4
- retryable_codes = [408, 503]
- cancel_wins = false (Update 4 overrode Update 2's true)
- dedup_key = "key" (Update 5 overrode Update 2's "id")
- fifo_ties = false (Update 5 overrode Update 2's true)
- priority_high_first = false (Update 4 overrode Update 2's true)
- dead_order = "input" (Update 3)
- delay_cap = 400 (Update 3)
- stale_after = 1000 (Update 5)
- stale_inclusive = true (Update 5)

3. Algorithm (as specified)
a. Deduplicate by the field named by dedup_key (currently "key"). Keep the last job for each value, and keep that job's actual original input index as its "selected original index".
b. A job is retryable if last_code is in retryable_codes.
c. Cancelled jobs: go to cancelled if cancel_wins, or if the job is not retryable. With cancel_wins=false, a cancelled retryable job is not placed in cancelled and continues through the later steps.
d. Dead if any of these holds:
   - now - created >= stale_after (inclusive; with stale_inclusive=false it would be >)
   - attempt >= max_attempts
   - last_code is nonzero and not retryable
e. Otherwise, for a retryable job with a failure: due = max(due, failed_at + min(base_delay * (2**max(0, attempt-1) if exponential else 1), delay_cap)). With the current settings the delay multiplier is 1, so the delay is min(200, 400) = 200. Jobs without a failure keep their due.
f. If due > now the job goes to waiting as {id, at: due}. Otherwise it goes to ready.

4. Ordering
- ready: priority ascending (priority_high_first=false), then created descending (fifo_ties=false), then selected original index.
- dead: original index order (dead_order="input"; "id" would sort by id).
- waiting and cancelled: always selected original index.

5. Unresolved or ambiguous items (none resolved by the source)
- Whether a retryable job that has no failure (last_code 0) counts as retryable. Per the spec, 0 means no failure, so it is not in retryable_codes, and the cancelled-routing rule treats it as non-retryable.
- Order of the checks relative to the cancelled rule: follow the spec text as written (cancelled first, then dead, then due).
- Whether the dedup keep-last behavior should consider cancelled jobs. The spec does not exempt them, so dedup applies to all jobs first.
- The output format of the waiting "at" value is the computed due.

6. Ignore
All "archived work record" entries concern other projects (archive-north/south/east/west-NN) and do not apply to queue. Their values were discarded.

7. Next steps
Apply any future "Update N; target project queue" by replacing only the named keys. Then answer questions using the current configuration above.