Repository navigation
Warn on dead mcp.* keys (#151); gate every publisher on integration tests; :latest = latest release - #154
Merged
Conversation
mcp.port was documented as "the MCP server port", default 8081. It was parsed,
logged at debug level, and never read again: MCP is served by the unified
server on the HTTP port. An operator who set it believed MCP was listening on
8081. A launch tutorial did exactly that and pointed every MCP command at 8081;
running flAPI with that config, nothing listens there - "connection refused".
Checking the rest of the same reference table turned up two more with no
reader at all, not even a parse:
- mcp.host - MCP binds wherever the HTTP server binds;
- mcp.allow-list-changed-notifications - documented as "enable listChanged",
default true, but flAPI has no server-to-client notification transport and
advertises listChanged: false unconditionally. Not just unused: impossible.
Fixing mcp.port alone would have left its siblings, so all three are handled
the same way. Setting any of them now logs a warning naming the key, why it is
ignored and what to use instead. None is an error - the configuration still
loads and flAPI behaves exactly as before. The warning is emitted at parse
time, so --validate-config shows it, which is where operators linting a
config in CI will see it.
Red first: test_mcp_port_ignored.py (via --validate-config) failed for all
three keys on main, and passes now, along with a case pinning that no warning
appears when none is set.
Removed rather than left to rot:
- MCPConfig::port, whose only reader was the debug log line;
- MCPServerConfig, a whole struct nothing uses (stdio_transport, mcp_port);
- CONTENT_TYPE_SSE, defined and never used - flAPI answers MCP with JSON.
Documentation: CONFIG_REFERENCE.md (table, two examples, defaults table),
MCP_REFERENCE.md (which contradicted itself - its table documented `port`
while line 1597 said "there is no separate port"), the mcp-protocol spec,
CLAUDE.md, and both example configs, which set all three keys and would
otherwise print three warnings on every example startup.
A top-level `server: {port, host}` block has the same problem but is a
different key family; filed as #153 rather than widened into this change.
Closes #151
create-release needed the builds and all eight smoke jobs, but not integration-tests. So the GitHub release - and the PyPI publish, which needs create-release - could go out before the tag's own integration suite finished, or despite it failing. On v26.09.26 it was still running when both were already live. It passed, and the same commit had passed on main, but the release itself was unguarded by its own test run. integration-tests is now in create-release's needs, so it gates both. Checked that it has no `if:` restricting it to pull requests: a skipped dependency would skip create-release and quietly stop every release. It adds little wall-clock - it runs alongside windows-build, the slowest job, and normally finishes first. Also drops the kit's local-stamping workaround for v26.09.23: v26.09.26 is the first release carrying the stamped server.json, verified at 26.9.26.
A Codex crew review of this PR (correctness, design, usability - all three REQUEST_CHANGES) found that the doc sweep for #151 had missed the runnable examples, which is where the damage is done. Verified each against the code and a running server before changing it: - README: the Docker command published port 8081 "for the MCP server", the MCP section offered `--enable-mcp` - a flag that does not exist, so the documented `docker run` exits 1 with "Unknown argument: --enable-mcp" - and seven curl examples pointed at localhost:8081. MCP is on by default and shares the HTTP port, so the command needs neither. The Dockerfile link pointed at a /docker directory that does not exist. - docs/guides/mcp-tools.md called http://localhost:8081/mcp. Wrong port, and /mcp is not a route: only /mcp/jsonrpc and /mcp/health are registered. - docs/MCP_CONFIG_INTEGRATION.md posted a bare {name, arguments} body to /mcp/tools/call on 8081 - neither the route nor the envelope exists. It now wraps each call in a tools/call JSON-RPC envelope at /mcp/jsonrpc; checked that the script parses as bash and emits valid JSON-RPC, and that the tools' real inputSchemas accept those arguments. - Three initialize-response examples advertised listChanged: true, which the server never sends. Running that workflow against a real server exposed a product defect the routes had been hiding: flapi_create_endpoint keeps the endpoint in memory with no template source, so update_template tries to write the template directory itself and reload finds no YAML. That is not a doc fix; filed as #155, and the doc says so at the top of the script rather than presenting a known-broken workflow as working. Why the first sweep missed the README lines: to find bad routes it excluded every line containing /mcp/jsonrpc - which also hid lines with the right route and the wrong port.
The Codex review of this PR flagged that on a v* tag, docker-build needed only
linux-build, so the image was published before the tag's integration tests -
the third publisher the release gate had missed. Checking it turned up
something larger: docker-build had no condition at all, so EVERY run pushed
ghcr.io/datazoode/flapi:latest, pull requests included. Confirmed in a
pull_request run's log ("pushing manifest for ghcr.io/datazoode/flapi:latest",
2026-09-26 09:46:23). `docker run ghcr.io/datazoode/flapi` therefore pulled
whatever PR had most recently run CI - unmerged, unreviewed code.
What is pushed now:
pull_request nothing - the image is still built, to prove it builds; the
registry login and the push are skipped
push to main :main and :sha-<commit>
v* tag :latest, :<tag> and :sha-<commit>
and publishing waits for integration-tests and the four Linux smoke jobs, the
same gate the GitHub release and PyPI now have. Checked every job docker-build
needs has no `if:`, so none can be skipped on a tag and cascade-skip the push.
Until the next release, :latest still points at the last PR-built image; the
next tag replaces it.
Both from the second Codex review of this PR; both reviewers raised each. create-release did not need docker-build. On a v* tag an image build or push could fail while the GitHub release and the PyPI publish (which needs create-release) still went out - a release with no :latest or :<tag> image. It now needs docker-build. No cycle: docker-build needs only the builds, the tests and the smoke jobs. The MCP_CONFIG_INTEGRATION.md script used `set -e` as its only failure check, but a failed tool call arrives as a JSON-RPC error inside a successful HTTP response, so curl exits 0 and the script carried on to print "Endpoint created and configured" - after the step-2 failure the same doc warns about (#155). Each call now checks for `error` or `result.isError` and exits on either. Run against a real server: step 1 succeeds, step 2 reports "MCP call failed: ... Could not open template file for writing" on stderr, the script exits 1, and the success line is never printed.
…pt fails closed
From the third Codex review of this PR.
On a v* tag, docker-build pushed :latest before create-release ran. If the
wheel build, `gh release create` or the PyPI publish then failed, :latest
pointed at a version with no GitHub release and no package. Now docker-build
pushes only the immutable :sha-<commit> image (plus :main on main), and a new
docker-promote job - needing docker-build and pypi-publish-flapi-io - adds
:latest and :<tag> to that same image with `buildx imagetools create`. No
rebuild: what gets tagged :latest is byte-for-byte the image the tests ran
against.
Verified as far as is possible without cutting a tag:
- actionlint: the whole workflow is clean;
- no dependency cycle across all 17 jobs, and docker-build no longer
references :latest at all;
- the exact promote command, run with --dry-run against the real registry
using the :sha-<full commit> image main already pushed, resolves the
source and yields the multi-arch index (linux/amd64 + linux/arm64 plus
provenance). Only the push itself is untried, and that is the login step.
The doc script's jq check failed open: any non-zero jq exit - jq missing, an
empty reply, an HTML error page - was read as "no error" and the script went
on. It now requires jq up front and treats a reply that is not a JSON object
as a failure. Checked with canned responses: empty, HTML, JSON-RPC error and
isError all stop the script with exit 1; a genuine result continues; a PATH
without jq exits 1 with "this script needs jq".
…test
From the fourth Codex review of this PR.
- Promotion used :sha-<commit>, which a main run and a tag run for the SAME
commit both write - and the tag build stamps the release version into the
binary. If main pushed between the tag's docker-build and docker-promote,
the release would have been published with main's build. docker-build now
exports the digest it pushed and docker-promote tags exactly that digest.
- Two release runs could promote out of order: an older release finishing
late (a slow approval, a re-run) moved :latest backwards. Promotions are now
serialised (concurrency group, never cancelled), and :latest is only moved
when this tag is the newest non-draft, non-prerelease release; the version
tag is always pushed.
- The doc script accepted a reply like {"jsonrpc":"2.0","id":1} - a JSON
object with neither error nor result. It now requires a positive shape: an
object, no error, a result object, and isError not true.
Verified, as close to real as is possible without cutting a tag:
- actionlint: clean;
- the promote step's exact run: script, extracted from the workflow and run
with --dry-run against the real registry and the real release list, using
the digest of an image main already pushed: as v26.09.26 it requests
:v26.09.26 and :latest; as v26.09.23 it requests only :v26.09.23 and warns
that it is not the newest; with no digest it exits 1;
- the doc script against canned replies: empty, HTML, an object with no
result, result:null, a JSON-RPC error and isError:true all stop it; a real
result and isError:false continue.
…ueue
From the fifth Codex review of this PR. The job-level concurrency group added
in round 4 keeps only ONE pending job, and GitHub cancels it when another
arrives: three releases in quick succession would silently drop the middle
one's promotion, leaving a GitHub release and a PyPI package with no Docker
version tag.
The suggested fix, `queue: max`, is documented only for workflow-level
concurrency, not jobs.<id>.concurrency - checked against GitHub's workflow
syntax reference - and actionlint rejects it on a job. Relying on it would risk
invalidating the whole workflow file, so the group is removed instead, and
promotion no longer needs serialising:
1. each run tags ITS release :<tag> from the exact digest it built and
tested. The tag is unique per release, so no other run can race it;
2. :latest is set to the NEWEST release's image - whichever run gets there
last - and the release list is re-read after writing, so a run that
listed releases just before a newer one appeared corrects the stale
:latest it wrote. If the newest release's own image is not pushed yet,
the run leaves :latest to that release's promotion.
Every promotion now runs; the order they finish in no longer matters.
Verified by extracting the step's exact run: script from the workflow and
running it with --dry-run against the real registry and release list:
v26.09.26 (whose version tag the old pipeline never pushed) takes the
"not published yet" path and exits 0; with the newest release resolved to an
image that exists, it writes :latest, confirms the list is unchanged, and
exits 0. actionlint is clean.
From the sixth Codex review of this PR: three paths let the job report
success while :latest was not on the newest release.
- Any `imagetools inspect` failure read as "not published yet", so a
transient registry error - even on the image this run had pushed
moments before - exited 0 with :latest stale. A run no longer inspects its
own image (if it were really missing, the create fails the job), and
inspections of other releases retry before concluding anything.
- Exhausting the three convergence attempts exited 0. It is now an error.
- When the newest release's image is genuinely missing because that
release's own promotion failed, older runs skipped silently. They now
raise a workflow warning that says to re-run that promotion.
Every path verified by running the step's exact run: script, extracted from
the workflow, against stubbed docker and gh that record each call:
this release is newest exit 0, :latest written once
another release newest, exists exit 0, :latest written once
newest release image missing exit 0, not written, ::warning::
a newer release keeps appearing exit 1, ::error:: after 3 attempts
own tag push fails exit 1
release list unavailable exit 1
actionlint is clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both decisions from the last round, in one PR to keep it to one CI run.
1. Three
mcp.*keys were documented but did nothing — now they say so (closes #151)mcp.portwas documented as "the MCP server port" (default8081). It was parsed, logged at debuglevel and never read. MCP is served on the HTTP port. I ran flAPI with
mcp.port: 8081: nothinglistens on 8081. That is exactly how the launch tutorial broke.
Its two neighbours in the same reference table had no reader at all:
mcp.host: MCP binds wherever the HTTP server binds.mcp.allow-list-changed-notifications: documented as "enable listChanged", defaulttrue. ButflAPI has no server-to-client notification transport and advertises
listChanged: falseunconditionally, so this was impossible, not just unused.
All three are handled the same way. Setting one logs a warning naming the key, why it's ignored
and what to use instead. It's not an error, and nothing about how flAPI runs changes.
It fires at parse time, so
--validate-configshows it too:Removed:
MCPConfig::port(its only reader was the debug log), the whole unusedMCPServerConfigstruct, and the unusedCONTENT_TYPE_SSEconstant.Docs cleaned everywhere the keys appeared:
CONFIG_REFERENCE.md,MCP_REFERENCE.md(whichcontradicted itself: its table documented
portwhile line 1597 said "there is no separateport"), the MCP protocol spec, CLAUDE.md, and both example configs. The examples set all three
keys and would otherwise print three warnings on every startup.
2. A release now waits for its own integration tests
create-release, and the PyPI publish that depends on it, needed the builds and smoke jobs but notintegration-tests. Onv26.09.26both were live while the tag's integration suite was stillrunning. They now wait for it. I checked that
integration-testshas no PR-onlyif:: a skippeddependency would skip
create-releaseand quietly stop every release.Also
the stamped
server.json.server: {port, host}block has the same documented-but-unread problem. It's adifferent key family, so it's filed as A top-level server: block is documented and used in an example, but never read #153 rather than widened into this PR.
3. Codex review — round 1 findings, all fixed
A Codex crew review (correctness, design, usability) requested changes. Each finding was verified
against the code and a running server before fixing:
docker-buildhad no condition, so every run, pull requests included, pushed:latest(confirmed in a PR run's log). Now PRs push nothing,
mainpushes:main/:sha-*, and only av*tag pushes:latest+:<tag>, gated on integration and Linux smoke tests.docker runused a flag thatdoesn't exist (
--enable-mcpexits 1), plus 8081 in eight places. The MCP guide called anon-existent
/mcproute, andMCP_CONFIG_INTEGRATION.mdposted to a non-existent/mcp/tools/call. All now usePOST /mcp/jsonrpcon the HTTP port.listChanged: truein three response examples: nowfalse, as the server sends.flapi_create_endpointkeeps the endpoint in memory with no template, so the documentedcreate → update → reload flow can't work. Filed as MCP config tools: an endpoint created via flapi_create_endpoint can't be given a template, persisted or served #155; the doc says so rather than
presenting it as working.
A second Codex review covers these fix commits.
Test plan
test_mcp_port_ignored.py(via--validate-config) failed for all three keyson
main. Green now, plus a case pinning no warning when none is set.security-warning suites
create-releaseneedsintegration-tests;pypi-publishneedscreate-release;integration-testsruns on tags🤖 Generated with Claude Code