verify-refresh-request-body
Drive a real `spiced` over HTTP to prove how `POST /v1/datasets/{name}/acceleration/refresh` (and any other route using the shared `OptionalJson` extractor) treats its optional JSON body across header shapes - no body, an empty body with a JSON or form `Content-Type`, whitespace, `{}`, valid overrides, a JSON body under a form `Content-Type`, malformed JSON, and an unknown `refresh_mode`. Use when changing `crates/runtime/src/http/optional_json.rs`, the refresh handler, or HTTP body extraction.
- Star
- 3,147
- 分类
- 运维与云
- 许可证
- Apache-2.0
- 最近提交
- 2026年12月5日
.agents/skills/verify-refresh-request-body/SKILL.md
在 GitHub 上查看Verify the refresh request body
Unit tests in crates/runtime/src/http/optional_json.rs cover the extractor alone. This skill proves the route a user calls, on a built spiced, the way curl, the SDKs, and a proxy that adds Content-Type: application/json to a body-less POST call it.
Build
CC=cc CXX=g++ cargo build -p spiced --no-default-features
The file connector and Arrow acceleration are always linked, so no network or extra features are needed.
Run
.agents/skills/verify-refresh-request-body/helpers/verify-refresh-body.sh target/debug/spiced
The helper:
- Seeds a local CSV and an Arrow-accelerated
file:dataseteventsunder a freshmktemp -dwork directory (override withWORK_DIR, which must be empty or new). - Refuses to run if anything already answers on
HTTP_ADDR, then starts only thisspicedonHTTP_ADDR(default127.0.0.1:18391) plus side ports, logging to$WORK_DIR/spiced.log, and records its pid. - Waits for
GET /v1/readyto be200(90s timeout). An open port is not ready. - Sends each body shape and prints one line per case:
case | HTTP status | body. - Stops the pid it started (never
pkill) and removes the work directory it created unlessKEEP=1. AWORK_DIRyou pass is never removed.
To point it at an already-running instance, pass --url http://host:port instead of a binary; it then skips launch and teardown. Use a dataset name with DATASET= if it is not events.
Expected after the OptionalJson fix
| case | expected |
|---|---|
| no body, no Content-Type | 201 |
empty body, Content-Type: application/json | 201 |
empty body, Content-Type: application/x-www-form-urlencoded | 201 |
whitespace body, Content-Type: application/json | 201 |
{} | 201 |
{"refresh_mode":"full"} | 201 |
{"refresh_mode":"bogus"} under application/x-www-form-urlencoded (curl -d) | 415, unchanged: a form or text/plain body is a cross-site simple request and must not carry overrides |
{"refresh_mode":"bogus"} with no Content-Type | 201, unchanged: the body is ignored, as Option<Json<T>> did |
malformed JSON {not json | 400 Failed to parse the request body as JSON |
{"refresh_mode":"bogus"} | 422 (400 on runtimes that validate the mode later) |
Before the fix, the empty and whitespace bodies with Content-Type: application/json return 400 Failed to parse the request body as JSON: EOF while parsing a value at line 1 column 0, and an empty body under a form Content-Type returns 415. Every other row is unchanged by the fix.
Proof
Run the helper against the binary built before the change and the one after, and keep both outputs. A compile or the unit tests alone are not proof.
相似的 Skill
canary
GAgarrytan/gstack143k
observability-and-instrumentation
ADaddyosmani/agent-skills123k近 7 天新增 1,882 个 star
paperclip-board
PApaperclipai/paperclip120k近 7 天新增 1,909 个 star
ruview-configure
RUruvnet/RuView106k近 7 天新增 765 个 star