Repository navigation
Reject a server: block, which flAPI never read (#153) - #161
Merged
Merged
Conversation
flAPI has no `server:` block. `server: {port, host}` appeared in the
config-system spec and in examples/flapi-bigquery-procedure.yaml, and nothing
ever read it: an operator who set `server.port: 9000` got a server on 8080,
bound to 0.0.0.0, with no message. The sibling s3/gcs/azure examples had been
fixed earlier; this one was missed.
Unlike the dead mcp.* keys of #151, which only warn, this is an error. A bind
port is the setting where "silently ignored" does the most damage - traffic
goes to the wrong place - and no value of `server:` has ever done anything, so
rejecting it cannot break a working configuration. The choice of an error over
a warning was the maintainer's; the alternative, honouring it as an alias, was
rejected because it would add a third way to set the port and contradict the
reference, which already said the block is not parsed.
Presence, not shape: `server: {port: 9000}`, `server: true` and an empty
`server:` are wrong for the same reason, so one message serves all of them. It
names every real way to set the server: the top-level http-port and http-host
keys, --port/-p and --host, FLAPI_PORT and FLAPI_HOST. The issue text listed
only the port keys; http-host is what `host` maps to. `server-name` is a
different, real key and is unaffected.
It is raised in parseMainConfig, so `flapi --validate-config` reports it - the
path operators run in CI - and startup takes the clean "flAPI cannot start until
the configuration is valid" exit (#126), not an abort.
Red first, on the unfixed binary: 9 of 13 failed - all six shapes, the message,
the both-keys-set case and the example guard - while the 4 fences passed (no
error without a block, `server-name` unaffected, the glob finds the examples,
the BigQuery example validates). After the fix the guard failed on flAPI's own
shipped example, which is the guard doing its job; the example now uses
http-port and http-host. A C++ unit test was checked red as well, by disabling
the check and watching it fail.
Deliberately not in this change, each filed on its own:
#156 --validate-config rejects examples/flapi.yaml (an MCP prompt file is
validated as an endpoint), so those two examples cannot be in the
validation guard yet;
#157 top-level environment-whitelist in the s3/gcs/azure examples, where
nothing reads it - security-relevant, and the empty-whitelist meaning
contradicts itself between two implementations;
#158 the dead https: block in CONFIG_REFERENCE 2.9;
#159 the `flapii project init` scaffold's dead keys;
#160 warning on any unrecognised top-level key.
Closes #153
…break
From a Codex review of this PR (correctness and usability, both requested
changes).
The check ran after project-name, project-description and http-port were read.
A config with a `server:` block and one other mistake - a missing required key,
a malformed http-port - therefore reported only the other mistake, and the
operator fixed that and met this one on the next run. It now runs first, before
any other key is read. Red first: three new cases (no project-description, no
project-name, a non-numeric http-port, each alongside `server:`) failed on the
previous commit and pass now.
The changelog and the code comment both said rejecting the block "cannot" break
a working configuration. True of the server's behaviour - nothing under
`server:` ever had an effect - but a deployment whose config still carries the
block will no longer START, which is the whole point and the thing to warn
about. Both now say so.
Considered and not changed here:
- `flapi pack` bundling a config it never validates - a real gap, but every
config error behaves that way, not just this one; filed as #162.
- YAML merge keys (`<<: *defaults`) hiding a `server:` key - yaml-cpp does
not expand merge keys, so the same is true of http-port and every other
key; noted on #162 and belongs with #160.
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
flAPI has no
server:block, butserver: {port, host}appeared in the config-system spec and inexamples/flapi-bigquery-procedure.yaml. Nothing ever read it: an operator who setserver.port: 9000got a server on 8080, bound to0.0.0.0, with no message.A config containing a
server:block now fails to start, with an error that names what to use. Closes #153.Decisions (yours, from the plan)
mcp.*keys in mcp.port is documented and parsed but never read — MCP always shares the HTTP port #151, this misdirects traffic. No value underserver:has ever done anything, so removing it changes nothing about how flAPI behaves; but a deployment whose config still carries it will no longer start. (The plan had recommended warn-only for consistency with mcp.port is documented and parsed but never read — MCP always shares the HTTP port #151; the error is the stricter choice you made.)Details
server: {port: 9000},server: trueand an emptyserver:all fail, with one message.hostmaps tohttp-host, which the message includes.server-nameis a different, real key and is unaffected. A test pins that.parseMainConfig, soflapi --validate-configreports it (the command operators run in CI) and startup takes the clean exit from A config error aborts with a core dump (SIGABRT) instead of exiting cleanly #126, not an abort.http-port/http-host, matching the s3/gcs/azure examples that were fixed earlier and this one missed) and the config-system spec.CONFIG_REFERENCE.mdgets a note next to the port keys.Codex review
Both reviewers requested changes; addressed:
project-nameandhttp-portwere read, so a config withserver:and one other mistake reported only the other one. Now first; three new cases were red before.flapi packbundling a config it never validates is real but true of every config error, so it's flapi pack bundles a config without validating it, so a bad config only fails at startup #162. YAML merge keys hiding a key is a yaml-cpp limitation affecting every key (noted on flapi pack bundles a config without validating it, so a bad config only fails at startup #162).Breaking-change note
Anyone with a
server:block in their config will now fail to start. The changelog leads with the fix (http-port/http-host) and states that nothing working can be affected.Test plan
server-nameunaffected; the glob finds the examples; the BigQuery example validates).Found along the way, filed separately (not in this PR)
--validate-configfails onexamples/flapi.yaml: an MCP prompt file is validated as an endpoint. So those two examples can't be in the validation guard yet.environment-whitelistin the S3/GCS/Azure examples, where nothing reads it. Security-relevant, and the empty-whitelist meaning contradicts itself between two implementations.https:block in CONFIG_REFERENCE §2.9 (real key:enforce-https).flapii project initscaffold generates keys flAPI never reads.🤖 Generated with Claude Code