Repository navigation
Architecture HTTP API and Contracts
Written against d5aad1f44 on 19 Nov 2026.
In short
-
tz_ps_httpowns the API routes: 78 operations under/api, each a thin route overProject,NetworkandRunner.tz_ps_appadds the frontend and thetz-ps-conductorcommand on top. -
contracts/openapi/core-api.yamlis written by hand. A test compares it with the description the app generates from its routes, and the TypeScript SDK is generated from it by Orval. - Every error is an RFC 9457 problem document with a fixed
typeslug. A write that saves a version of a network takesIf-Matchwith theversion_idthe client read. - The UI learns component types, solve options and what the server can do from the API (
/frameworks/...,/capabilities). A few places in the frontends still assume PyPSA. -
contracts/grammarholds one expression grammar, from which a Python parser and a TypeScript parser are generated. - There is no authentication. The server binds to loopback by default.
| Package | Path | Role |
|---|---|---|
tz_ps_http |
backend/libs/tz_ps_http/src/tz_ps_http/ |
The FastAPI app: routes, wire schemas, problem documents |
tz_ps_app |
backend/libs/tz_ps_app/src/tz_ps_app/ |
The tz-ps-conductor command and the built frontend, served beside the API |
| contracts | contracts/ |
openapi/core-api.yaml, grammar/, fixtures/
|
@tz-ps-conductor/sdk |
frontend-sdk/ |
Generated client and hooks, and the expression language for the browser |
Inside tz_ps_http:
| File | Holds |
|---|---|
routes.py |
Every route, the FastAPI dependencies, the ETag and If-Match helpers |
schemas.py |
The wire models, build_problem_responses, OptInDescription
|
app.py |
build_app, the lifespan, Problem, _PROBLEM_BY_ERROR
|
multipart.py |
A streaming multipart reader, for the import file and the batch form |
correlation.py |
CorrelationIdMiddleware |
errors.py |
Errors only the transport raises, under HttpError
|
config.py |
HttpServerConfig, read from the http_server config key |
results.py, measures.py, comparisons.py, derived_value_results.py, workflow_forms.py
|
Builders for the larger response bodies |
build_app(allowed_origins=()) in app.py assembles the app:
- It creates the FastAPI app with its OpenAPI and docs routes under the prefix:
/api/openapi.json,/api/docs,/api/redoc. The prefix isAPI_PREFIXinroutes.py. - It adds
GZipMiddleware(level 1),CorrelationIdMiddleware, andCORSMiddlewareonly whenallowed_originsis not empty. - It includes the one
routerfromroutes.py. - It registers one exception handler for each entry of
_PROBLEM_BY_ERROR, then handlers forBatchRefusedError, FastAPI'sRequestValidationError, Starlette'sHTTPException, and any otherException. - It patches the generated OpenAPI description so that it files the
Errorschema and the schemas of the streamed bodies, and drops the 422 that FastAPI adds to operations that cannot answer one.
The lifespan, _build_dependencies, starts telemetry, takes the storage root lock, opens the warehouse and the import store, writes the demo project into an empty root, and builds the runner in a worker thread. Shutdown stops them in reverse. The composition root and configuration describes the composition root and start-up in full.
A route reaches its collaborators through FastAPI dependencies that wrap the composition root: ProjectsDep (a ProjectFactory), RunnerDep, NetworkImportsDep, NetworkExportsDep, WorkflowRunStoreDep. The headers and common query parameters are dependencies too: IfMatch, VersionQuery, and ProjectSegment, which maps the token of the unassigned project to the empty name.
CorrelationIdMiddleware gives each request a UUID and sets it in the log context. The same id is the instance of a problem document (urn:uuid:<id>), is in each log record the request makes, and is the default description of a version the request saves. The server always makes the id itself.
tz_ps_http adds no access log and no request span. It logs one line for each mapped error, and a traceback for one it did not map.
All paths are under /api. The contract defines 78 operations on 67 paths: 45 GET, 21 POST, 5 PUT, 3 PATCH and 4 DELETE. Paths below a network are shortened to …/, which stands for /projects/{project}/networks/{name}/.
| Family | Operations | Representative paths |
|---|---|---|
| Projects | 5 |
POST and GET /projects; GET, PATCH, DELETE /projects/{project}
|
| Networks | 7 |
POST and GET /projects/{project}/networks; GET /networks (every project); GET, PATCH, DELETE on the network; POST …:copy
|
| Time axis | 4 |
PUT …/timesteps, POST …/timesteps:slice, GET and PUT …/snapshot-weightings
|
| Constraints | 2 |
PUT …/constraints, POST …/constraints:check
|
| Derived values (custom statistics) | 4 |
PUT …/derived-values, POST …/derived-values:check, POST …/expressions:preview, GET …/results/derived-values
|
| Input series | 7 |
GET and PATCH …/series, GET …/series:index, POST …/series:csv, GET, PUT, DELETE …/series/{type}/{attribute}/{component_name}
|
| Versions | 4 |
GET …/versions, GET …/versions/{version_id}, GET …/versions:compare, POST …/versions/{version_id}:restore
|
| Results of a network | 5 |
GET …/results, GET …/results/series, its :index and :csv, and one output series by path |
| Components | 5 |
GET and POST …/components/{type}, DELETE …/components/{type}/{component_name}, POST …/components:batch, GET …/components:referrers
|
| Runs | 11 |
GET …/methods, POST …/runs, GET /runs, GET /runs/{id}, POST /runs/{id}/cancel, GET /runs/{id}/log, GET /runs/{id}/results, POST /runs/{id}/measures:query, GET /runs/{id}/derived-values, POST /runs/{id}/derived-values:calculate, POST /runs:compare
|
| Imports | 3 |
POST /projects/{project}/networks:import, GET /imports/{id}, POST /imports/{id}:cancel
|
| Exports | 4 |
POST …:export, GET /exports/{id}, POST /exports/{id}:cancel, GET /exports/{id}/file
|
| Workflow runs | 6 |
GET /projects/{project}/workflow-runs, GET /projects/{project}/workflows, GET /workflow-runs/{id} and its /steps, /graph, /nodes
|
| Framework description | 9 |
GET /frameworks, /frameworks/{framework}, and below it component-types, component-types/{type}, component-types/{type}/standard-types, solve-options, methods, constraint-vocabulary, measures
|
| Server | 2 |
GET /capabilities, GET /version
|
The diagram shows how the families hang off the two roots, the project tree and the flat resources.
flowchart TD
api["/api"]
api --> projects["projects (5)"]
api --> allnets["networks of every project (1)"]
api --> runs["runs (9)"]
api --> imports["imports by id (2)"]
api --> exports["exports by id (3)"]
api --> wfr["workflow-runs by id (4)"]
api --> frameworks["frameworks (9)"]
api --> server["capabilities and version (2)"]
projects --> networks["networks of one project (2), and import (1)"]
projects --> pwf["workflow-runs and workflows (2)"]
networks --> net["one network (3), copy (1), export (1)"]
net --> components["components (5)"]
net --> series["input series (7)"]
net --> versions["versions (4)"]
net --> axis["timesteps (2) and snapshot-weightings (2)"]
net --> expr["constraints (2), derived-values (2), expression preview (1)"]
net --> results["results (6)"]
net --> submit["methods (1) and submit a run (1)"]
frameworks --> ctypes["component-types and standard-types"]
frameworks --> solveopts["solve-options and methods"]
frameworks --> vocab["constraint-vocabulary and measures"]
Conventions to keep when you add a route:
-
A verb is
:verbon a collection or an item::copy,:import,:batch,:check,:restore.POST /runs/{id}/cancelis the one published exception. -
A component name is the rest of its path (
{component_name:name_path}), so it may hold/and:. Nothing can hang below a component, which is whycomponents:referrersis a verb on the network. -
There is no
GET,PUTorPATCHof one component. A component is read in its type's page and edited throughcomponents:batch. -
Work that takes time answers 202 with a
Location: a run, an import, an export. The client polls that resource. - Workflow runs are read-only over HTTP, and start from the Python API. See Architecture-Execution.
-
A route function is named by its
operation_id, which the contract publishes and the SDK turns into a hook name.
Every error response is an RFC 9457 problem document, served as application/problem+json:
{
"type": "/problems/precondition-failed",
"title": "Network changed since the version the If-Match names",
"status": 412,
"detail": "the If-Match names version 'a1', and the network is now at 'b2'",
"instance": "urn:uuid:5f0c…"
}A client matches on type. title and detail are prose and may be reworded.
Problem in app.py builds each one, and _PROBLEM_BY_ERROR is where an exception type earns a status and a slug. It holds 66 exception types. The lookup walks the exception's MRO, so register specific types and never ValueError: ConductorError, ModelsError and pydantic's ValidationError all descend from it.
| Source | Slug | Status |
|---|---|---|
A type in _PROBLEM_BY_ERROR
|
its own, such as network-not-found, version-conflict, invalid-solve-params
|
404, 409, 410, 412, 413, 415, 422, 500, 501, 503 |
| FastAPI's request validation | validation-failed |
422 |
| Starlette's own 404 and 405 |
not-found, method-not-allowed
|
404, 405 |
Any other HTTPException
|
request-failed |
as raised |
| An error nothing maps |
internal-error, with fixed wording |
500 |
Three things to know:
-
A failure of one field goes in the
errorsextension member, oneLocatedError(location,message) each. An expression error is aPositionedError, which addspositionandendin code points. -
A detail never carries the server's layout. Several entries give their own
detailbuilder to keep a filesystem path, or a remedy written for a Python caller, off the wire. -
A batch reports the cause's own problem.
BatchRefusedErrorwraps the error of one operation, and its handler rewrites each location tooperations[i].<field>.
A route documents its errors with schemas.build_problem_responses(404, 409, …). Do not inline Error.model_json_schema(): its #/$defs/… references resolve nowhere in an OpenAPI document.
A network moves from one version to the next (see Architecture-Storage). The API exposes the id of the version as the validator:
- A response that answers a version sets
ETag: "<version_id>"and also carriesversion_idin its body, because the generated SDK cannot read response headers. - A write may send
If-Match: "<version_id>".parse_if_matchtakes exactly one strong entity tag and refuses a weak tag, a list or*with 422. - The guard belongs to the warehouse. The route passes the id down as
expected_version_idand wraps the write in_validate_if_match. When the warehouse raisesVersionConflictError, that wrapper answers 412precondition-failed. - A route compares the id itself, with
_refuse_a_stale_if_match, only before a refusal that depends on the network's content, or when it writes no version, asPOST …/runsdoes.
If-Match is optional. Without it, a write applies to whatever version the route read, and a write that loses a race answers 409 version-conflict instead of 412.
Where the guard does not reach:
- A
DELETEof a project or a network takes noIf-Match. -
A component batch that changes nothing commits nothing.
_save_editsanswers the version it read with 200, whateverIf-Matchsays. -
POST …/runschecks the header when it reads the network, then submits a run of that version. The check and the submission are not one warehouse write, but the run names the version it loaded, so it never solves another.
The diagram shows one edit that succeeds or loses to another writer.
sequenceDiagram
participant UI as Frontend (SDK hook)
participant API as tz_ps_http route
participant P as Project and Network
participant W as NetworkWarehouse
UI->>API: GET the generators page
API-->>UI: 200 ComponentPage with version_id v7
UI->>API: POST the components batch with If-Match v7
API->>P: get_network_without_series_values
P->>W: get_document
W-->>P: document at v7
API->>P: apply the operations in memory and validate
API->>P: save with expected_version_id v7
P->>W: update with a ComponentsChange, parent v7, expected v7
alt the current version is still v7
W-->>P: VersionInfo v8
API-->>UI: 200 ComponentBatchWrite with version_id v8
else another writer saved v8 first
W-->>P: VersionConflictError
API-->>UI: 412 precondition-failed
UI->>API: read again, then retry with If-Match v8
end
POST …/runs also takes an Idempotency-Key header. A retry of the same request answers the first run, and the same key on a different request answers 409 idempotency-conflict.
The framework reads, /capabilities and the component page use ETag for caching instead: they take If-None-Match and answer 304 through _respond_unless_unchanged, with Cache-Control: no-cache.
-
get_frameworkand the standard types answer the framework'sFramework.revision.list_frameworkshashes the revisions of every framework it lists, andsolve-optionsalso digestsSolveOptions.revision, because its body depends on the machine./capabilitieshashes its body. - A query parameter that changes the body is digested too (
_build_described_etag), with a marker for its absent and its present form. - A read of the input series at a named version, on a warehouse whose version ids are unique, answers
Cache-Control: private, max-age=31536000, immutable.
A listing that pages takes limit (PageLimit, 1 to 200) and offset (PageOffset), and answers total, limit and offset beside items. The exceptions:
| Listing | Differs how |
|---|---|
list_components |
ComponentPageLimit: with no limit the page holds every match |
list_networks (one project), list_network_versions
|
Answer items alone |
get_run_log |
A cursor: after and limit (up to 10,000), answering next_after and complete
|
A part of a body that few readers need is opt-in, through a boolean query parameter named for it. Without the parameter the property is absent from the body, never null.
| Parameter | On | Effect |
|---|---|---|
descriptions=true |
The component type reads, solve-options, methods
|
Includes each description. The field is OptInDescription in schemas.py
|
outputs=true |
list_components |
Adds the output values of the components on the page |
series=false |
get_network_results |
Leaves out each output series of more than one value, and reads none |
The series routes never make a Python object of a number:
-
PATCH …/seriesandPUTof one series read the request as bytes on a worker thread and hand them to DuckDB. Their request schemas are written by hand inopenapi_extra. -
GET …/seriesstreams JSON text that DuckDB writes. -
POST …/components:batchalso takesmultipart/form-data, with abatchpart and a streamedseriespart, saved as one version. It is a second, hidden route on the same path (_FormBodyRoute), registered before the JSON route and matched on the content type.
The frontend learns what the server can do here, never from the shape of another response. The types are in backend/src/tz_ps_conductor/capabilities.py, and dependencies.build_capabilities() reads the warehouse the server opened, not the config, because the server may have fallen back from what the config names.
| Capability | Says | Reasons |
|---|---|---|
network_history |
The storage keeps every version |
configured, git-not-installed
|
run_measures |
The storage keeps the measures of a run |
configured, storage-keeps-no-measures
|
network_files |
Network files can be imported or exported. Carries formats, each with can_import and can_export
|
configured |
Each is {is_available, reason, detail}. reason is a slug of CapabilityReason that the frontend matches on, so a new reason is a change to the contract. detail is a sentence a page may show.
GET /api/version answers the server's version, its release channel and a newer release when there is one.
The UI is built from the framework description, not from a list of component types of its own. Some places still assume PyPSA, which Adding-a-Framework lists.
| Read | Answers |
|---|---|
/frameworks, /frameworks/{framework}
|
Name, version, revision, whether it takes constraints |
…/component-types |
Each type's url_token, field count and display (glyph, rank, visibility) |
…/component-types/{type} |
The type's fields in declared order: type, unit, default, reference, curve support |
…/component-types/{type}/standard-types |
The catalogue the framework ships for the type |
…/solve-options |
The options a run may set, narrowed to what this machine can solve with |
…/methods |
The methods a run may name |
…/constraint-vocabulary, …/measures
|
What an expression may name, and the measures a run computes |
GET …/networks/{name}/methods adds whether each method can run on the network's current version, with the slug a refused run would get.
A URL names a component type by its url_token (links) and a body by its declared name (Link). A route builds ComponentTypeSpellings from the framework of the network it holds. Adding-a-Framework describes where these descriptions come from.
POST /api/projects/{project}/networks/{name}/components:batch is edit_components.
- FastAPI parses the body into
schemas.ComponentBatch: a list ofcreate,updateanddeleteoperations. -
Project.get_network_without_series_valuesreads the stored document. Each series in it is a stand-in that holds its length and no value, so the route loads no series and its save writes only what changed. -
_ComponentEditsapplies each operation to that network in memory. An update is a merge patch: a null clears an attribute, and a newnamerenames. A refusal becomes aBatchRefusedErroratoperations[i]. - The references are checked once, against the state the batch leaves.
-
network.save(..., expected_version_id=if_match)builds aComponentsChangeand callsProject.update_components, which callsNetworkWarehouse.update. - The response is a
ComponentBatchWrite:version_id, the written components,warnings(unresolved-advisory-reference,negative-capacity) andremoved.
-
POST …/runsiscreate_run. Its optional body,RunCreate, names amethodand thesolve_params. -
Network.solvevalidates the network, the method, the solve parameters against the method's solve options, and the method's preconditions. Each failure is a problem document, and nothing is submitted. -
Runner.solverecords the run in the run store and hands a job to the executor. The route answers 202,Location: /api/runs/{id}and aRunwhosestatusisqueued. - The client polls
GET /api/runs/{id}untilstatusissucceeded,failedorcancelled.GET /api/runs/{id}/log?after=follows the solver log. -
GET /api/runs/{id}/resultsreads the version the run wrote. It answers 409run-unfinishedbefore the end, and 409results-expiredwhen that version is gone.GET …/results?version=reads the same results by version.
Architecture-Execution follows the job from the executor to the version it writes.
tz_ps_app adds the frontend to the API, and uses FastAPI and uvicorn directly to do it. When the packaged static/ folder holds a build, its build_app serves /assets from it, serves a file at the top of the build (the favicon and icons) as itself, and answers index.html to every other GET outside /api, so the browser's router owns those paths. With no build, GET / answers a line that says to run make bundle.
The frontend gets into the package through make bundle at the root, which builds frontend/ and copies frontend/dist into backend/libs/tz_ps_app/src/tz_ps_app/static. That folder is ignored by git, so the package's pyproject.toml names it as a hatchling artifact. See Architecture-Build-CI-and-Release.
| Command | Does |
|---|---|
tz-ps-conductor serve [--root] [--port] [--no-open] [--stop-on-stdin-close] |
Serves the app and its API on one port |
tz-ps-conductor seed [--root] |
Writes the demo project |
tz-ps-conductor backfill-measures [--root] |
Gives old runs the measures they lack |
tz-ps-conductor migrate-root |
Moves the default storage root of the former name to ~/tz-ps-conductor
|
tz-ps-http |
Serves the API alone. make serve and the image's api mode run this |
The desktop app starts serve as a child process and reads its standard streams. desktop/src/supervisor.ts holds the other side, so change both together. See Architecture-Frontends-and-Desktop.
| Signal | Meaning |
|---|---|
stdout line {"event": "listening", "url": …}
|
The socket is bound. The URL is the socket's own address, so --port 0 works |
stdout line {"event": "startup-failed", "reason": …, "detail": …}
|
Start-up failed. reason is the exception's type name |
--stop-on-stdin-close |
The server shuts down cleanly when standard input closes. Windows has no SIGTERM to send |
| Exit code 2 | The config or the flags are refused |
| Exit code 3 | uvicorn could not start (for example a taken port), or the storage root could not be opened |
| Exit code 4 | Another process holds the storage root |
| Exit code 5 | The old default root could not be moved |
contracts/openapi/core-api.yaml is written by hand. Nothing exports it from the app. Two checks hold it in place.
Conformance. backend/tests/features/api_contract_conformance.feature loads the YAML and the description that build_app().openapi() generates, and compares them:
- each path and method, and its
operationId, in both directions - the status codes of each operation, in both directions
- the required fields of success bodies and request bodies, and where a body admits extra members
- path and query parameters: presence, type, and whether required
- the pattern, length, format and values of each request field
- that every
$refresolves inside its own document
It runs with the acceptance scenarios in .github/workflows/backend-tests.yml. Some contract tests also validate live response bodies against the YAML with jsonschema. See Testing-Philosophy.
Drift. make -C frontend-sdk drift generates the SDK again over the committed tree and fails on any difference. .github/workflows/frontend-sdk.yml runs it on a change under contracts/ as well as under frontend-sdk/, and so does the root make check.
The diagram shows what is generated from what, and which check guards each link.
flowchart LR
routes["tz_ps_http<br/>routes.py and schemas.py"]
contract["contracts/openapi/core-api.yaml<br/>(hand-written)"]
sdk["frontend-sdk/src/generated<br/>(Orval, committed)"]
fe["frontend"]
g4["contracts/grammar<br/>Expression.g4 and two tables"]
cases["contracts/grammar/cases.json"]
pyparser["tz_ps_expressions/_generated<br/>(ANTLR, Java)"]
tsparser["frontend-sdk/src/expressions/generated<br/>(antlr-ng)"]
routes -. "check - conformance feature" .- contract
contract -- "make api" --> sdk
contract -. "check - make drift" .- sdk
sdk -- "make refresh" --> fe
sdk -. "check - make lock-check" .- fe
g4 -- "make -C backend grammar" --> pyparser
g4 -- "make -C frontend-sdk grammar" --> tsparser
g4 -. "check - make grammar-check" .- pyparser
g4 -. "check - make drift" .- tsparser
cases -- "shared test cases" --> pyparser
cases -- "shared test cases" --> tsparser
Custom constraints and derived values (custom statistics) are written in one small language, for example 0.3 * sum(Load.p_set) <= sum(Generator.p). The backend checks and evaluates an expression, and the browser checks and completes it as the modeller types, so both parse the same grammar.
File in contracts/grammar/
|
Holds |
|---|---|
Expression.g4 |
The ANTLR grammar: arithmetic, calls with over=, selections with filters, conditions |
functions.json |
Each function: its arguments and where it may be used |
messages.json |
The wording of each syntax error |
cases.json |
Texts with their expected verdicts, which both test suites read |
| Side | Generated into | Tool | Check |
|---|---|---|---|
| Python | backend/libs/tz_ps_expressions/src/tz_ps_expressions/_generated/ |
ANTLR 4.13.2, which needs Java (make -C backend grammar) |
make -C backend grammar-check, the grammar-drift job of backend.yml
|
| TypeScript | frontend-sdk/src/expressions/generated/ |
antlr-ng, which needs no Java (make -C frontend-sdk grammar) |
make -C frontend-sdk drift |
Each generator copies the two tables beside its parser. The checks that a grammar cannot state are written by hand on each side (tz_ps_expressions/_checks.py and frontend-sdk/src/expressions/check.ts), and cases.json is what holds the two to the same answers.
contracts/fixtures/wide-series.json is shared the same way: the backend's and the frontend's series CSV tests read it.
@tz-ps-conductor/sdk is the package the frontend imports. It ships TypeScript source with no build step, and the app compiles it.
| Part | Path | Written by |
|---|---|---|
| Client, TanStack Query hooks, MSW handlers, faker factories |
src/generated/<tag>/ and src/generated/model/
|
Orval, from the contract. Never edit by hand |
| Expression parser | src/expressions/generated/ |
antlr-ng, from the grammar. Never edit by hand |
customFetch, ApiError, apiUrl, the batch form builder |
src/client.ts |
Hand |
| Syntax check, semantic check, highlighting, completion | src/expressions/*.ts |
Hand. No React and no styling |
frontend-sdk/orval.config.ts splits the output by contract tag, so a route tagged runs lands in src/generated/runs/runs.ts. customFetch prefixes each URL with VITE_API_BASE_URL or /api, and throws ApiError(status, body) with the problem document as body. An export's file is the exception: the browser downloads it from a link built with apiUrl.
The app depends on the package as file:../frontend-sdk and holds a copy of its own, which only make refresh updates. frontend-sdk/CLAUDE.md explains the traps (file: not link:, peer ranges, the pinned Orval).
- Write or change the route in
routes.pyand its models inschemas.py. Give it anoperation_id, a tag, andresponses=schemas.build_problem_responses(...). Map a new error type in_PROBLEM_BY_ERROR. - Make the same change by hand in
contracts/openapi/core-api.yaml: the path, parameters, bodies, status codes andoperationId. - Run
make -C backend test-bdd. The conformance feature fails until the two agree. - Run
make -C frontend-sdk api. It runs Orval, thenmake refresh, which updates the SDK copy infrontend/and clears Vite's pre-bundle. - Restart any running dev server, then use the new hook in the app.
- Commit the route, the contract,
frontend-sdk/src/generatedand the app's lockfile together. - Run
make checkat the root, which includesdriftandlock-check.
For a change to the expression language, edit contracts/grammar/, add cases to cases.json, then run make -C backend grammar and make -C frontend-sdk grammar. If the change alters a step of a durable workflow, Architecture-Execution says when to bump APPLICATION_VERSION.
| Area | As built |
|---|---|
| Authentication | None. There is no auth dependency or middleware, and the contract declares no security scheme |
| Bind address |
http_server.host defaults to 127.0.0.1, port 8080. The image's configs in deploy/ set 0.0.0.0
|
| CORS | Off unless http_server.allowed_origins is set. The app and the API share an origin, and in development each Vite server proxies /api
|
| Host and origin checks | None: no trusted-host middleware and no CSRF token |
| Upload limits | An import file: http_server.max_import_bytes, 1 GiB by default, answering 413 file-too-large. The batch form part: 16 MiB. A streamed series body and an ordinary JSON body have no limit in tz_ps_http
|
| File formats | A format is imported over HTTP only when its reader is self-contained (can_import_over_http). A Calliope model.yaml makes Calliope read every file it names, so an upload never reaches the YAML reader |
| Error detail | An unmapped error answers fixed wording. Filesystem paths are kept out of details |
| API docs |
/api/docs, /api/redoc and /api/openapi.json are always served |
| Outbound calls |
GET /api/version looks up newer releases unless updates.check_releases is off |
| One process per root | The storage root lock refuses a second server (exit code 4). This protects the data's integrity, not access to it |
-
No authentication, and the image binds
0.0.0.0(deploy/config.git.json,deploy/config.postgresql.json). A hosted deployment depends on a proxy the repository does not provide. -
If-Matchis optional, and the same lost race answers 409 without it and 412 with it (_validate_if_matchinroutes.py). -
The contract is maintained by hand beside the routes. The conformance feature does not compare descriptions, optional response fields or
info: the YAML's title and version (0.1.0) differ from whatbuild_appreports. -
routes.pyis one module of about 4,500 lines with 78 operations, the dependencies and many body builders. -
backend/README.mdcalls the contract "the whole API", but the app also serves the docs routes. -
No request span and no access log come from
tz_ps_http, and a successful response does not return the request id (correlation.py). -
No health route. The release smoke test reads
/and/api/projects. -
Paging is uneven:
list_networksandlist_network_versionsansweritemsalone. -
Streamed series bodies have no size limit (
update_network_series,write_network_series_item). Memory is bounded for each value, so the disk is the limit. -
One grammar, two toolchains. The semantic checks are written twice, and only
contracts/grammar/cases.jsonholds them together. -
MAX_IMPORT_BYTESin the frontend repeats the server's default, so a raised limit reaches only an API client.
Using the app
Architecture
- Overview
- Python API
- Domain model
- Backend core
- Composition root and config
- Expression language internals
- Storage
- Execution
- Imports and exports
- Workflow engine
- HTTP API and contracts
- Frontend and desktop
- Build, CI and release
Contributing