跳到正文
FunCoding

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:

  1. Seeds a local CSV and an Arrow-accelerated file: dataset events under a fresh mktemp -d work directory (override with WORK_DIR, which must be empty or new).
  2. Refuses to run if anything already answers on HTTP_ADDR, then starts only this spiced on HTTP_ADDR (default 127.0.0.1:18391) plus side ports, logging to $WORK_DIR/spiced.log, and records its pid.
  3. Waits for GET /v1/ready to be 200 (90s timeout). An open port is not ready.
  4. Sends each body shape and prints one line per case: case | HTTP status | body.
  5. Stops the pid it started (never pkill) and removes the work directory it created unless KEEP=1. A WORK_DIR you 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

caseexpected
no body, no Content-Type201
empty body, Content-Type: application/json201
empty body, Content-Type: application/x-www-form-urlencoded201
whitespace body, Content-Type: application/json201
{}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-Type201, unchanged: the body is ignored, as Option<Json<T>> did
malformed JSON {not json400 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

精选

internal-comms

写内部沟通文档,遵循公司格式,包括状态报告、领导更新和公司通讯。

ANanthropics/skills204k近 7 天新增 2,876 个 star

canary

GAgarrytan/gstack143k

observability-and-instrumentation

ADaddyosmani/agent-skills123k近 7 天新增 1,882 个 star

精选

shipping-and-launch

上线前逐项检查,规划监控、分阶段发布和回滚方案。

ADaddyosmani/agent-skills123k近 7 天新增 1,882 个 star

paperclip-board

PApaperclipai/paperclip120k近 7 天新增 1,909 个 star

ruview-configure

RUruvnet/RuView106k近 7 天新增 765 个 star