Skip to content
GitHub
Customer

Decide Round Trip

Generated

This page is generated from qa/customer/specs/decide-round-trip.md — the source of truth. Edit the spec, not this page.

Last run: not yet recorded (run the replay suite to populate status).

Overview

POST /decide is the customer decision surface — the executable payoff of the whole loop. It authenticates with a domain-bound API key (org + domain resolve from the key, ADR-077 D7), evaluates the deployed world model version for the supplied context, and returns a binding { status, work_frame, decision_metadata } (ADR-077 D3; decision_metadata carries the evaluation trace). This is an API round-trip, not a browser action, so it is driven at the HTTP level (a Playwright request test) using the fixed QA decision key from the fixtures. In replay mode the predicates execute deterministically.

Preconditions

  • The stack is running in replay mode; the customer fixture is seeded (tools/dev/qa_fixtures.py → fixed decision API key, org/domain bound to a deployed world model version that declares the review_income action).
  • The fixed decision API key is available to the test as SPECTRAL_QA_DECISION_KEY (the same value as FIXTURE_DECISION_API_KEY).

Scenarios

1. Decide returns a GREEN binding for an eligible context

  • POST /decide with the domain-bound API key, action: "review_income", and an eligible decision context
  • Expected: HTTP 200 with a binding whose status is GREEN (eligible) and a work_frame. The call routes to the deployed review_income module.

2. Decide returns a YELLOW binding for a disqualified context

  • POST /decide with the domain-bound API key, action: "review_income", and a disqualifying context
  • Expected: HTTP 200 with a binding whose status is YELLOW (disqualified) and a trace identifying the rule that fired.

3. Decide rejects a missing/invalid API key

  • POST /decide with no API key (or a malformed one)
  • Expected: The request is rejected (401/403); no binding is returned.

4. Decide is deterministic under replay

  • Issue the same eligible /decide request twice
  • Expected: Both responses return the same binding (the cassette-backed predicates evaluate deterministically).

Test Data

LabelValueNotes
Decision API key(env SPECTRAL_QA_DECISION_KEY = fixture key)Domain-bound; from qa_fixtures
Actionreview_incomeThe declared, deployed, approved action the call routes on
Eligible context(filing-status context that satisfies the rules)Drives GREEN
Disqualifying context(context that trips a rule)Drives YELLOW