Edit product system
lca_edit_assemblyPatch a saved composed (bill-of-materials) system (s<N>). Ops: replace_provider (swap a member everywhere it is used), set_target_amount (rescale the functional unit), set_title (rename), add_member / remove_member, set_member_amount (rescale an existing member), add_stage / remove_stage (grow or shrink the stage DAG, e.g. an amortization layer; it must stay acyclic with one sink). mode (default edit): edit patches in place, keeping the same s<N>; fork derives a new s<M>. A drift-tracked mirror is forked automatically on edit, with a warning. Each member is linked cradle-to-gate independently when assessed, so swaps and additions bring their own background; only unit compatibility is checked, so a swap can change a dataset's geography, technology and reference year. Members are p<N> refs; UUIDs are not accepted. Linked and single-process systems are edited with lca_edit_linked. The returned ref can be assessed with lca_run_assessment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Ordered list of edits to apply in one call. | |
| ref | Yes | Saved product-system ref `s<N>` to patch. | |
| mode | No | `edit` (default) → edit the system IN PLACE, appending a new content version and keeping the same `s<N>` (self-contained systems; a drift-tracked mirror auto-forks to a new `s<M>` with a warning, since it can't be mutated in place). `fork` → always derive a NEW `s<M>`, leaving the baseline `s<N>` untouched. | edit |
| workspace | Yes | Name of the workspace to work in, as `lca_get(kind='workspaces')` lists it (backticks optional). Named on every call: several conversations can share one connection, and each names its own workspace. The connection's default is often an empty sandbox rather than the user's work. | |
| base_version_seq | No | REQUIRED here: the system's current content `version_seq`, as `lca_get s<N>` reports it — the version you computed this edit against. Rejected (409) if the system has moved on since, and nothing is changed. Re-read the system between edits: a successful in-place edit advances the version. (Kept optional in the schema so an omission gets the backend's instructive 422 rather than a bare validation error.) |