Commit ef9428b
## Summary
- **PUT /api/filters/{hash}/tests** — new endpoint for replacing the
test suite of a published filter. Uses a DB transaction with `SELECT ...
FOR UPDATE` row lock. Uploads new storage objects before DB commit;
deletes old ones after (best-effort cleanup).
- **Server-side test validation** — all test files are validated via
`tokf_common::test_case::validate()` on both publish and update paths.
Rejects invalid TOML, empty names, missing `[[expect]]` blocks, and bad
regexes.
- **`tokf publish --update-tests`** — CLI flag to update test files for
an already-published filter. Includes client-side validation, stdlib
guard, and explicit 403/404 error messages.
- **Shared `TestCase`/`Expectation` types** — moved to `tokf-common`
with a `validation` feature gate for `toml` + `regex` deps.
- **`StorageClient::delete()`** — new trait method with R2, in-memory
mock (with `delete_calls` counter), and no-op implementations.
- **`AppError::Forbidden`** — new 403 variant for authorization errors.
- **10 new e2e tests** — publish lifecycle, update round-trips,
non-author rejection, invalid content rejection.
- **13 new server unit tests** — hash validation, semantic validation,
zero-to-N update, double update, storage cleanup verification.
- **3 new validation unit tests** — whitespace-only names, multiple
expect blocks, mixed valid/invalid regexes.
## Test plan
- [x] `cargo build --workspace` — clean
- [x] `cargo clippy --workspace --all-targets -- -D warnings` — no
warnings
- [x] `cargo fmt -- --check` — formatted
- [x] `cargo test --workspace` — 1126 tests pass
- [x] `cargo test -p tokf-common --features validation -- test_case` —
13 validation tests pass
- [x] `cargo test -p tokf-server -- storage` — 25 storage tests pass
- [x] `cargo test -p e2e-tests --no-run` — e2e tests compile (require
DATABASE_URL to run)
- [ ] Manual: `tokf publish --update-tests <filter>` against staging
server
- [ ] E2E: run with `DATABASE_URL` against CockroachDB
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
1 parent 3253f2f commit ef9428b
30 files changed
Lines changed: 1871 additions & 181 deletions
File tree
- crates
- e2e-tests/tests
- harness
- tokf-cli
- src
- remote
- verify_cmd
- tokf-common
- src
- tokf-server
- src
- routes
- filters
- storage
- docs
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
857 | 890 | | |
858 | 891 | | |
859 | 892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
55 | 70 | | |
56 | 71 | | |
57 | 72 | | |
58 | 73 | | |
59 | 74 | | |
60 | 75 | | |
61 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
62 | 90 | | |
63 | 91 | | |
64 | 92 | | |
65 | 93 | | |
66 | | - | |
67 | | - | |
| 94 | + | |
| 95 | + | |
68 | 96 | | |
| 97 | + | |
69 | 98 | | |
70 | 99 | | |
71 | 100 | | |
| |||
109 | 138 | | |
110 | 139 | | |
111 | 140 | | |
| 141 | + | |
112 | 142 | | |
113 | 143 | | |
114 | 144 | | |
115 | 145 | | |
116 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
117 | 153 | | |
118 | 154 | | |
119 | 155 | | |
| |||
310 | 346 | | |
311 | 347 | | |
312 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
313 | 475 | | |
0 commit comments