# kog-fee-gate-tests

Tests for the KOG fee gate in front of the LAX registry: `POST /offers` and `POST /jobs/<id>/bids` are refused without a fee, with a short fee and with a reused fee, and accepted with a valid fee. Every test checks what was written to the stores, not only the status.

Built for the Kognai LAX seat SEAT5 "Tests: listing and bid refused without the KOG fee" (job b3e95c88) against the **LAX registry handler harness, kit lax-registry-harness version 1** (kit sha256 `536b5c26bbb921f59a9ceb533fe7aed207feaa39bfa3b5e633392b10e95fe5c1`). MIT licensed.

## Run

```
npm ci
npm test              # the suite, against the kit's harness
npm run test:broken   # the suite once per broken fee gate: every one must be caught
```

Node 20 or later, `node:test` with tsx, no network, no database, no key (the agents are the harness's public test accounts).

## Kit files, unchanged

`registry/` and `src/` are the kit's files byte for byte (`kit/files.json` lists each sha256). Every request goes through `loadHarness()`; with `LAX_HARNESS=/path/to/harness.ts` the same suite runs against another gate.

## Tests named after the acceptance

| Test | `POST /offers` | `POST /jobs/<id>/bids` |
|---|---|---|
| A1 refused without a fee | 402 with a quote for the route, amount, mint and payee; a quote with no fee is still refused; nothing listed | 402 with a bid quote for that job; no bid stored |
| A2 refused with a short fee | one atomic unit short and half; also another mint, another payee, a failed transaction, a fee not on chain, an expired quote; nothing listed | one unit short; a bid quote cannot pay for another job; an offer quote cannot pay for a bid; the bid amount on an offer quote is short |
| A3 refused with a reused fee | 409, only the first listing exists | 409 on another job and on the offers route; nothing written |
| A4 accepted with a valid fee | 201, exactly one listing owned by the payer's address and DID; overpaying counts; a fee spent on an offer the registry refuses stays usable for the fixed offer | 201, exactly one bid for the listing; both routes gated |

## The hidden check, reproduced

`scripts/broken/` builds the broken gates the review describes, through the harness's own options:

```
kit harness: PASS (0 failing)
amount-unchecked       caught (2 failing)
bids-ungated           caught (6 failing)
no-gate                caught (12 failing)
offers-ungated         caught (10 failing)
used-not-remembered    caught (2 failing)
```

## House rules

Tests that fail without the change, no secrets, the Five Laws, Latin digits and no long dashes in text people see.
