Skip to content

docs(openapi): publish ?format on every negotiable operation (#658) - #659

Merged
sv merged 1 commit into
flop-labs:mainfrom
alisemut0711-dev:docs/openapi-format-param-658
Sep 2, 2026
Merged

sv merged 1 commit into
flop-labs:mainfrom
alisemut0711-dev:docs/openapi-format-param-658

Conversation

@alisemut0711-dev

Copy link
Copy Markdown
Contributor

Closes #658.

?format=json is honoured by seven operations and published by two. The other five answer application/json at runtime and document no way to ask for it, so a client generated from the spec reads them as text-only.

Measured on ba868a3 — operations whose 200 declares both text/plain and application/json:

operation honours ?format=json publishes the parameter
GET /r/{room} yes yes
GET /rooms yes yes
POST /r/{room} yes no
GET /r/{room}/say/{nick}/{text} yes no
GET /r/{room}/say-signed/{did}/{sig}/{nonce}/{text} yes no
GET /r/events yes no
GET /kv/{ns} yes no

The two that do publish it carried separate copies of the prose, already drifted: one warns that a typo is ignored, the other omits that sentence.

What this changes

Hoists the parameter into a single _FORMAT_PARAM constant and attaches it to all seven, replacing both copies. No handler changes — the server was already correct; the document was not. extra/manifest.py goes 1532 -> 1526 code lines (six fewer, the duplicate objects collapse); sz.py --check stays green.

Regression

test_every_negotiable_response_publishes_the_switch_that_negotiates_it derives the negotiable set from the responses instead of listing operations, so a new dual-lane operation is covered the day it is added rather than the day someone remembers this test. It also asserts a single spelling of the description, which is what stops the two sides drifting again, and round-trips /r/events live: text/plain by default, application/json on ?format=json.

RED on unpatched src/manifest.py (test only, patch stashed):

AssertionError: negotiable but the switch is undocumented: ['POST /r/{room}',
'GET /r/{room}/say/{nick}/{text}',
'GET /r/{room}/say-signed/{did}/{sig}/{nonce}/{text}', 'GET /r/events',
'GET /kv/{ns}']

GREEN with the patch: 1 passed.

Gates

  • pytest full suite: 635 passed (tests/http/test_docs.py: 69 passed)
  • ruff check .: clean
  • ruff format --check .: clean (77 files)
  • sz.py --check: exit 0

Scope note: /openapi.json, /config and the .well-known/* documents are JSON-only — no text/plain alternative — so they are not negotiable and are untouched.

…bs#658)

Seven operations declare both text/plain and application/json on their 200,
so `?format=json` is the switch that picks between them. Only two published
the parameter: `/r/{room}` and `/rooms`, each carrying its own copy of the
prose. The other five — POST /r/{room}, /r/{room}/say/..., /say-signed/...,
/r/events and /kv/{ns} — honour the switch at runtime and documented nothing,
so a generated client reads them as text-only and never asks for the JSON.

Hoist the parameter into one `_FORMAT_PARAM` constant and attach it to all
seven, replacing the two divergent copies. No handler changes: the server
behaviour was already correct, the document was not.

The regression derives the negotiable set from the responses rather than
listing operations, so a new dual-lane operation is covered the day it is
added, and asserts one shared spelling of the description so the two sides
cannot drift apart again. It also round-trips `/r/events` — a lane that had
no parameter at all — text/plain by default, application/json on ?format=json.

Filed against ba868a3.
@sv
sv merged commit 95935e1 into flop-labs:main Sep 2, 2026
6 checks passed
@sv sv mentioned this pull request Sep 2, 2026
6 tasks done
sv added a commit that referenced this pull request Sep 2, 2026
Folds [Unreleased] into a dated section and moves the version everywhere that
declares it. Six commits since v0.11.2.

Two data-loss and retention fixes are the reason to cut this now rather than
wait: a single message larger than the compaction budget emptied its whole room
(#274), and COMPACT_MAX_LINES bound before the byte budget for any record under
~1 KB, so rooms kept 7.6% of the retention they promise (#393).

PATCH rather than MINOR, and the one judgment call worth naming is #659: it
publishes `?format` on five operations that already honoured it, so the document
changed and the service did not. No route, response field or cap moved, and a
client written against the old schema still works — which is a documentation fix
by this file's own definition of the public API. Bump it to 0.12.0 instead if
you read a newly-documented parameter as added surface.

Version declarations moved together, as tests/test_mcp.py and tests/http/
test_docs.py require: pyproject.toml, mcp/src/technocore_mcp/server.py,
mcp/server.json, mcp/worker/pyproject.toml and mcp/worker/README.md.

Deployer notes are in the CHANGELOG entries; the two that matter are disk
(a busy room's file now grows toward the full 5 MiB it was always documented to
keep) and /humans (the header is correct but nothing caches it until the CDN
rule marks the path eligible).
sv added a commit that referenced this pull request Sep 2, 2026
Folds [Unreleased] into a dated section and moves the version everywhere that
declares it. Six commits since v0.11.2.

Two data-loss and retention fixes are the reason to cut this now rather than
wait: a single message larger than the compaction budget emptied its whole room
(#274), and COMPACT_MAX_LINES bound before the byte budget for any record under
~1 KB, so rooms kept 7.6% of the retention they promise (#393).

PATCH rather than MINOR, and the one judgment call worth naming is #659: it
publishes `?format` on five operations that already honoured it, so the document
changed and the service did not. No route, response field or cap moved, and a
client written against the old schema still works — which is a documentation fix
by this file's own definition of the public API. Bump it to 0.12.0 instead if
you read a newly-documented parameter as added surface.

Version declarations moved together, as tests/test_mcp.py and tests/http/
test_docs.py require: pyproject.toml, mcp/src/technocore_mcp/server.py,
mcp/server.json, mcp/worker/pyproject.toml and mcp/worker/README.md.

Deployer notes are in the CHANGELOG entries; the two that matter are disk
(a busy room's file now grows toward the full 5 MiB it was always documented to
keep) and /humans (the header is correct but nothing caches it until the CDN
rule marks the path eligible).
WIZARDspace added a commit to WIZARDspace/technocore-chat that referenced this pull request Sep 2, 2026
…ce-occupancy-510

Conflict in src/manifest.py: flop-labs#659 added _FORMAT_PARAM to listNotes' parameters
while this branch added _KEYS_PARAM. Both are kept — the operation honours both
switches at runtime, and flop-labs#659's regression derives the negotiable set from the
responses, so a _text_or_json 200 without a published format parameter fails it.
Ordered as elsewhere in the document: path, then domain query params, then format.
zkasuran added a commit to zkasuran/technocore-chat that referenced this pull request Sep 3, 2026
…kept

flop-labs#659 landed the same shared `?format` parameter on main while this branch carried
its own, so the merge left two identical definitions and the second shadowed the
first. Keeps main's and folds in the note on why the schema publishes no `enum`.
`openapi_document` is byte-identical either way (sha256 9a57d6ad1225359f, 59577
bytes), so nothing served changes.
zkasuran added a commit to zkasuran/technocore-chat that referenced this pull request Sep 3, 2026
flop-labs#659 hoisted the shared ?format parameter and attached it to seven of the ten
operations whose handlers negotiate, which is the headline this branch claimed.
That part is upstream now, so these files go back to main's version and the
branch narrows to the three lanes flop-labs#659 did not reach.
zkasuran added a commit to zkasuran/technocore-chat that referenced this pull request Sep 3, 2026
postNote, writeNote and writeNoteSigned answer application/json on ?format=json
with a {ns, key, bytes, ts} receipt, and declared neither the parameter nor the
media type nor the shape. flop-labs#659 attached the shared parameter to the seven read
lanes; these three were the remainder. One new schema, main's _FORMAT_PARAM, and
_text_or_json in place of _plain on the three 200s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

?format=json is honoured on five operations that never publish the parameter

2 participants