Request paths
What happens, step by step, for a proposal, an approval, a check and a link.
A proposal
POST /v1/maps/{map}/proposalswith the changes.- The server applies them to the latest version and validates the result against the format: every changed case, and that every reference exists. What they would break answers 422
invalid_map, witherrors[]. - It stores the proposal and its changes as rows; the approved version is untouched.
- The reviewers named on the proposal get an e-mail. E-mails wait in the server’s own outbox and go out through your SMTP server (
CASES_SMTP_URL), retried with a growing wait; on AWS Lambda, the jobs function sends the ones that are due every minute.
An approval
POST /v1/proposals/{id}/approve: the server checks the caller’s role.- It locks the proposal’s row, so approvals of one proposal happen one at a time, and checks the role again inside that transaction.
- A proposal merges when it has the approvals the map asks for (
required_approvals.count, 1 by default) from owners or approvers, and the approval of every required reviewer named on it. The author may approve their own proposal. - Then one database transaction creates the new version (immutable), snapshots its cases and marks the proposal merged. A proposal made on an older version merges on its own when no case it touches changed since its base; otherwise the answer is 409
version_conflict, and it must be rebased. Two approvals racing for the same version number cannot create two versions: the number is unique per map, and the one that loses gets 409version_conflict. - A background job writes the new files to the connected repository as one commit (
Cases: version 5 — Gift cards). - An event
map.version.createdis published for other products (Agent picks up new scope, Git updates links).
A check
POST /v1/maps/{map}/checkswith the code side, or withcaseIdsalone (from commit trailers: the map is checked by itself, and an id it does not have is reported asunmapped).- The server loads the approved version and compares (the same code as
cases check, from@sypnia/cases/spec). - It returns the findings and keeps the last result per map and version.
A link
GET /v1/maps/{map}/cases/{case}/links.- The server calls Data, Telemetry, Git and Agent in parallel, as the caller, so you never see through Cases what you cannot see in the product. In Sypnia Cloud, Data is read through a service call to its control plane, with the id of the person the server verified, and the control plane checks that person’s role; Telemetry with the read token linked to the map. A server you run yourself presents the caller’s own token.
- Each call has a 2-second budget (
CASES_LINK_BUDGET_MS); a product that does not answer in time is markednot_availableand the rest is shown.
A map uploaded to Data
npx @sypnia/cases map --upload --project <data ref>sends the map document to Sypnia Data’s control plane (PUT /v1/projects/{ref}/use-cases), which keeps it for the console’s «Use cases».- When the Data project is linked to a Cases map, the control plane sends the same document on to
POST /v1/maps/{map}/uploads, as a service call on behalf of the person who uploaded it. - The Cases server turns it into a draft proposal of what the code owns (The map from code) and answers with the proposal; the control plane passes that answer back to the CLI. If Cases does not answer, the Data side is still saved.