cli: enumerate the bridge's finite request params #204

Merged
natsukium merged 1 commit from fix/bridge-schema-enums-178 into main 2026-09-07 22:27:01 +09:00
Owner

Fixes #178.

source and attachment were bare strings in the published bridge request grammar, so a consumer could validate a line
locally and still be answered malformed_request by a live bridge — the schema bundle promised more than the runtime
honors.

  • source now carries the value set the runtime parses, read off the --source ValueEnum so the schema and the
    parser cannot drift.
  • attachment now carries the decimal pattern the roster prints.
  • The bridge charges a bad attachment to the request's spelling rather than to the request, matching the rule the schema
    now states.
  • New invalid-request fixtures (req-source-is-not-a-region.json, req-attachment-is-not-decimal.json) pin both
    rejections.

Doc cascade: docs/reference/cli.md records the two newly-bounded request params; CHANGELOG.md notes the
user-affecting tightening of the published schema.

Verified: just check green (fmt, clippy, nextest, deny, proto-compat); reviewed by pi sol + pi luna; docs proofread by
Gemini gemini-3.8-flash-high

Deferred

  • AttachmentId's ^[0-9]+$ pattern still admits digit strings above u64, which parse_attachment_id rejects as
    out-of-range. A single overflow class; the published AttachmentObject.id output pattern already uses the same
    expression, so tightening only the request side would split them, and JSON Schema has no clean numeric bound for a
    decimal held in a string. Not worth an issue.
  • The source-enum-equals-runtime-set test does not independently verify the reverse direction. Both source_values()
    and parse_region_source() are derived from the same clap ValueEnum impl, so the residual drift risk is verified
    low; strengthening test independence is optional hardening beyond issue #178's acceptance criteria.
Fixes #178. `source` and `attachment` were bare strings in the published bridge request grammar, so a consumer could validate a line locally and still be answered `malformed_request` by a live bridge — the schema bundle promised more than the runtime honors. - `source` now carries the value set the runtime parses, read off the `--source` `ValueEnum` so the schema and the parser cannot drift. - `attachment` now carries the decimal pattern the roster prints. - The bridge charges a bad attachment to the request's spelling rather than to the request, matching the rule the schema now states. - New invalid-request fixtures (`req-source-is-not-a-region.json`, `req-attachment-is-not-decimal.json`) pin both rejections. Doc cascade: `docs/reference/cli.md` records the two newly-bounded request params; `CHANGELOG.md` notes the user-affecting tightening of the published schema. Verified: just check green (fmt, clippy, nextest, deny, proto-compat); reviewed by pi sol + pi luna; docs proofread by Gemini gemini-3.8-flash-high ## Deferred - `AttachmentId`'s `^[0-9]+$` pattern still admits digit strings above u64, which `parse_attachment_id` rejects as out-of-range. A single overflow class; the published `AttachmentObject.id` output pattern already uses the same expression, so tightening only the request side would split them, and JSON Schema has no clean numeric bound for a decimal held in a string. Not worth an issue. - The source-enum-equals-runtime-set test does not independently verify the reverse direction. Both `source_values()` and `parse_region_source()` are derived from the same clap `ValueEnum` impl, so the residual drift risk is verified low; strengthening test independence is optional hardening beyond issue #178's acceptance criteria.
cli: enumerate the bridge's finite request params
Some checks failed
bench / Criterion full-suite snapshot (pull_request) Has been skipped
fuzz / cargo fuzz nightly long-run (pull_request) Has been skipped
bench / Criterion regression gate (pull_request) Failing after 2m2s
darwin / detect relevant changes (pull_request) Successful in 4s
darwin / darwin docs-only no-op (pull_request) Has been skipped
darwin / build felis (aarch64-darwin) (pull_request) Successful in 50s
pr / nix flake check (pull_request) Successful in 37s
fuzz / cargo fuzz smoke (per target) (pull_request) Successful in 1m28s
pr / wire schema is compatible with the base (pull_request) Successful in 11s
pr / publish felis (x86_64-linux) (pull_request) Has been skipped
windows / detect relevant changes (pull_request) Successful in 3s
windows / windows docs-only no-op (pull_request) Has been skipped
windows / cargo nextest (Windows) (pull_request) Successful in 7m29s
pr / cargo build / clippy / test / deny (pull_request) Successful in 1m36s
pr / frontend smoke (x86_64-linux) (pull_request) Successful in 53s
windows / cargo clippy (Windows cross) (pull_request) Successful in 14s
windows / frontend smoke (Windows) (pull_request) Successful in 1m47s
windows / package felis (x86_64-pc-windows-msvc) (pull_request) Has been skipped
efc53cc5e2
`source` and `attachment` were bare strings in the published request
grammar, so a consumer could validate a line locally and still be
answered `malformed_request` by a live bridge: the bundle promised more
than the runtime honors. Both now carry the value set the runtime
parses — `source` read off the `--source` ValueEnum so the two cannot
drift, `attachment` the decimal pattern the roster prints — and the
bridge charges a bad attachment to the request's spelling rather than
to the request, matching the rule the schema now states.

Refs #178
natsukium deleted branch fix/bridge-schema-enums-178 2026-09-07 22:27:01 +09:00
Sign in to join this conversation.
No description provided.