Slim root CLAUDE.md to global-only rules, move subsystem detail to nested files
DevPlace CI / test (push) Failing after 1h1m39s
DevPlace CI / test (push) Failing after 1h1m39s
This commit is contained in:
@@ -159,3 +159,14 @@ The rule generalizes: if the production function reads a random-ish input or a t
|
||||
| Admin page heading assertion fails | Admin pages use `<h2>` inside `.admin-toolbar`, not `<h1>` - assert `text=` or `.admin-toolbar h2:has-text(...)` |
|
||||
| `test_auth_matrix` reports `422` instead of `401`/`403` | A POST route's form params are undocumented in `docs_api.py`, so the matrix sends an empty body and FastAPI validation (422) fires before the auth guard. Document every required form param so auth is reached and tested |
|
||||
| `test_auth_matrix` reports `503` on a gateway endpoint | A prior test left the `openai` service stopped. Restore it in `finally` (see "Global `site_settings` tests -> Service enabled/disabled state") |
|
||||
|
||||
## Rigorous correctness verification (money, state machines, concurrency)
|
||||
|
||||
The persisted suite is example-based and blind to three bug classes: a formula wrong at an untried input, an invariant violated only after a long action sequence, and a race only two near-simultaneous requests trigger. Any feature touching a spendable resource (coins, credits, quotas), a bounded state machine (levels, tiers, counters with a floor/ceiling), or a read-then-write mutation reachable from more than one worker applies this procedure in addition to, not instead of, the persisted tests. Worked example with every bug it caught: Code Farm economy rebalance (`devplacepy/services/game/CLAUDE.md`).
|
||||
|
||||
Four escalating layers, in order, as disposable scripts calling the real functions against a temp DB (not pytest files unless separately requested):
|
||||
|
||||
1. **Property checks** on every pure formula over the full input domain (monotonicity, bounds, non-negativity, idempotency, additivity over a partition), iterating the real range (hundreds to thousands of values), not hand-picked spot checks.
|
||||
2. **Stateful fuzzing.** Many entities, long randomized action sequences, invariants re-checked after every action (balances never negative, monotonic counters never decrease, bounds never exceeded). Catch the expected exception type and continue; this proves safety, not liveness.
|
||||
3. **Concurrency with real separate OS processes, never threads.** Fresh production-representative state, never pre-seeded columns (NULL is not 0 in SQL, use `COALESCE`). Assert the exact right number of wins and hand-computed final totals. Fix races with one atomic conditional SQL statement at the chokepoint (`UPDATE ... WHERE <precondition>`, real driver `rowcount`), never a client-side lock.
|
||||
4. **Static analysis** beyond `py_compile`: `pyflakes`/`ruff check` on every touched file (catches missing function-level imports invisible to other checks).
|
||||
|
||||
Reference in New Issue
Block a user