fix(exchange): rule whether a conditional ICPC decision still counts as ?overdue=true

What

Maintainer ruling needed. This issue asks for a product decision. Nothing gets implemented until the decision is recorded here.

GET /v1/exchange/icpc?overdue=true uses the same predicate for the list (services/craig-exchange/src/store/icpc.rs:136-139) and for the count (:175-178):

deadline_at IS NOT NULL AND deadline_at < now()
  AND status NOT IN ('completed', 'withdrawn', 'approved', 'denied')

?overdue=false is the exact complement. Line numbers are from main d28a0e70; the file is unchanged on the pending #1734 (closed) branch.

A request leaves home_study_in_progress through one of three decision states: approved, conditional or denied. Each of them can only move on to completed (services/craig-exchange/src/transitions.rs:53-77, can_icpc_request_transition; the oracle icpc_status_transition_matrix in compliance/scenario-inventory/exchange.toml:20). The predicate does not treat the three alike:

Decision ?overdue=true once deadline_at has passed
approved not listed, from the moment the decision is recorded
denied not listed, from the moment the decision is recorded
conditional still listed until the request moves to completed

The scenario pack records this as open, not decided:

  • rulesets/georgia/scenarios/exchange.toml:12 (the journey of georgia.exchange.icpc-deadline-84d; it moves to :15 once #1734 (closed) merges): "so a CONDITIONAL decision stays overdue-eligible until completed while approved/denied stop counting — an asymmetry recorded, not ruled. … no test drives the predicate."
  • The oracle icpc_overdue_predicate_conditional_still_counts (:20-23 on main) has enforcement = "none".

The query parameter is not documented either. overdue in services/craig-exchange/src/api/icpc/mod.rs:185-186 has no doc comment, so the generated docs/modules/ROOT/pages/api/craig-exchange.adoc describes it only as "Overdue". The parameter is also exposed as craig icpc list --overdue (services/craig-cli/src/cmd/icpc.rs:182-183).

Options

  • A — count a conditional decision as decided. Add 'conditional' to the excluded status list in both predicates, so ?overdue=false includes it. The case for A: the clock is the home-study window. Under 42 U.S.C. § 671(a)(26)(A)(i) the receiving State has 60 days to complete the home study. A conditional decision is a finished study with conditions attached, so it has met the clock just as an approval or a denial has.
  • B — keep a conditional decision open until it completes (what the code does today). The case for B: the conditions are still outstanding work, so a conditional request needs coordinator action and belongs on the overdue tab until it is completed. The SQL stays as it is, and the ruling is written down and pinned by a test.

Why

The overdue tab and the overdue count are the core of the ICPC worklist design (docs/modules/ROOT/pages/design/icpc.adoc:40-42). Today, whether a conditional request appears there comes from whatever the predicate happens to do, not from a decision. No doc states the behaviour and no test pins it, so a later change could flip it silently. Two decisions that are equally "made" are counted differently, and nobody has ruled that this is intended.

Acceptance criteria

These apply once the maintainer has ruled.

  • The maintainer records the ruling (A or B) as a comment on this issue.
  • Under A, 'conditional' is added to both the NOT IN list and the IN list of both predicates (list and count in store/icpc.rs), taken from one shared definition so the four lists cannot drift apart.
  • Under B, the SQL is unchanged, and a comment at the predicate cites the ruling.
  • An API test in services/craig-exchange/tests/api/icpc.rs sets up requests in home_study_in_progress, approved, denied and conditional, each with a deadline_at in the past.
  • That test asserts which of those requests ?overdue=true lists, and that the response total matches.
  • The same test asserts that ?overdue=false lists the complement.
  • Under A, the test's conditional assertion fails on main.
  • The scenario in rulesets/georgia/scenarios/exchange.toml states the ruled behaviour, and the words "not ruled" are gone.
  • The overdue oracle is bound to the new test, so its enforcement is no longer none. The coverage ledger is forward-only, so if a key is renamed, follow the rule in that file's header.
  • The overdue query parameter has a doc comment stating the definition, and docs/modules/ROOT/pages/api/craig-exchange.adoc is regenerated.
  • Under A, CHANGELOG.adoc == Unreleased records the change to the filter's behaviour.

References

  • #1734 (closed): contract finding D7, out of scope there: "The ?overdue=true approved/denied vs conditional asymmetry, which the scenario records 'not ruled'". The MR notes repeat it.
  • #1609 (closed): the taxonomy v2 pass that wrote the ICPC lifecycle scenarios.