feat(supply-chain): keep the customer's arrangement (#1052) #1056

Merged
sharang merged 1 commits from feat/supply-chain-layout into main 2026-11-19 09:23:28 +00:00
Owner

Closes #1052 (epic #1050). Stacked on #1055. The base is feat/supply-chain-graph; it will be retargeted to main once #1055 merges.

What it adds

The customer's arrangement of the Lieferkette, kept per workspace:

Call What it does
GET /api/v1/supply-chain/layout Returns data: { positions: [{key, x, y}], updated_at }. The list is empty before the first save, and every box then takes its computed place.
PUT /api/v1/supply-chain/layout {positions} Replaces the whole arrangement; the last save wins. Each key is trimmed and kept once, with its last position.
DELETE /api/v1/supply-chain/layout Resets to the computed columns.
  • Storage: one document, supply_chain_layout, in the tenant database, so the workspace export and erasure cover it.

  • Positions are a list, not a map by key: a supplier name can contain a dot (Beispiel GmbH & Co. KG), and a document key can't.

  • Refused with 422:

    • more than 5,000 boxes;
    • an empty key, or one longer than 400 characters;
    • a position beyond ±100,000 px.

    A refused save changes nothing.

  • Roles: PUT and DELETE are writes, so the role gate refuses read-only roles. Every role that may read can read the arrangement.

  • Stale keys: the page ignores a saved key whose node no longer exists, and a new node takes its computed place.

  • Tests: a put helper is added to the test server.

Tests

  • Unit: a key is kept once with its last position; a name with a dot is kept; the refusals; an empty list.
  • Integration:
    • empty before the first save;
    • a save, then a read;
    • a refused save changes nothing;
    • a reset empties it.
  • Checks: the OpenAPI and route gates pass, and clippy is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9

Closes #1052 (epic #1050). **Stacked on #1055.** The base is `feat/supply-chain-graph`; it will be retargeted to `main` once #1055 merges. ## What it adds The customer's arrangement of the Lieferkette, kept per workspace: | Call | What it does | |---|---| | `GET /api/v1/supply-chain/layout` | Returns `data: { positions: [{key, x, y}], updated_at }`. The list is empty before the first save, and every box then takes its computed place. | | `PUT /api/v1/supply-chain/layout` `{positions}` | Replaces the whole arrangement; the last save wins. Each key is trimmed and kept once, with its last position. | | `DELETE /api/v1/supply-chain/layout` | Resets to the computed columns. | - **Storage:** one document, `supply_chain_layout`, in the tenant database, so the workspace export and erasure cover it. - **Positions are a list, not a map by key:** a supplier name can contain a dot (`Beispiel GmbH & Co. KG`), and a document key can't. - **Refused with `422`:** - more than 5,000 boxes; - an empty key, or one longer than 400 characters; - a position beyond ±100,000 px. A refused save changes nothing. - **Roles:** `PUT` and `DELETE` are writes, so the role gate refuses read-only roles. Every role that may read can read the arrangement. - **Stale keys:** the page ignores a saved key whose node no longer exists, and a new node takes its computed place. - **Tests:** a `put` helper is added to the test server. ## Tests - **Unit:** a key is kept once with its last position; a name with a dot is kept; the refusals; an empty list. - **Integration:** - empty before the first save; - a save, then a read; - a refused save changes nothing; - a reset empties it. - **Checks:** the OpenAPI and route gates pass, and clippy is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang changed target branch from feat/supply-chain-graph to main 2026-11-19 08:59:46 +00:00
sharang added 1 commit 2026-11-19 08:59:55 +00:00
feat(supply-chain): keep the customer's arrangement (#1052)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 5m18s
CI / Check (pull_request) Successful in 23m0s
3b1952f5ec
The Lieferkette page (#1050) keeps where the customer put each box, per
workspace:

- `GET /api/v1/supply-chain/layout`: the placed boxes by node key (empty
  before the first save);
- `PUT`: replaces the whole arrangement (the last save wins), each key
  trimmed and kept once with its last position; 422 for more than 5000
  boxes, an empty or overlong key, or a box beyond 100000 px;
- `DELETE`: resets to the computed columns.

One document in the tenant database (`supply_chain_layout`), so export and
erasure cover it; positions are a list, not a map by key, as a supplier name
may hold a dot. Saving and resetting are writes, so read-only roles are
refused by the role gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q9inRcu428A2iNjDHPEAT9
sharang force-pushed feat/supply-chain-layout from 15d07c96f6 to 3b1952f5ec 2026-11-19 08:59:55 +00:00 Compare
sharang merged commit bc73a61f96 into main 2026-11-19 09:23:28 +00:00
sharang deleted branch feat/supply-chain-layout 2026-11-19 09:23:28 +00:00
Sign in to join this conversation.