Skip to content

Name activity fields activity_name / product_name (engine + pyvolca)#142

Merged
ccomb merged 4 commits into
mainfrom
pyvolca
Jun 21, 2026
Merged

Name activity fields activity_name / product_name (engine + pyvolca)#142
ccomb merged 4 commits into
mainfrom
pyvolca

Conversation

@ccomb

@ccomb ccomb commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Why

An activity can yield several products, so its name is the activity's (shared across its products) while the product is what tells them apart. The old name / product fields invited mixing the two — the same key meant different things to different readers (an analyst usually cares about the product; the field often carried the process name).

What

Standardize on process_id + activity_name + product_name across the wire and the Python client.

  • A process is the single-output (activity, product) unit you address with process_id; it has no name of its own — compose a label from activity_name + product_name.
  • An activity is the grouping: one activity_name, possibly several products (all_products).
  • The API verbs stay activity-named and return processes: search_activities(product=X) → processes → score_activities → compare.

Changes:

  • Engine wire: ActivitySummary, ConsumerResult, SupplyChainEntry, ActivityForAPI (referenceProduct*product*), and ExchangeWithUnit.targetActivityName. get_path_to and the columnar score_activities identity keys converged to camelCase; the hand-rolled MCP get_contributing_activities object now matches the REST DTO's keys.
  • pyvolca 0.6.0: dataclass fields activity_name / product_name, ActivityDetail.product_*, target_activity_name; updated README + regenerated API reference; migration note in the CHANGELOG.
  • AGENTS.md glossary defines activity vs process.

Breaking wire + client change; pre-1.0, no compatibility shim. Local tests green — engine cabal test (1345 examples), pyvolca pytest (160 passed).

ccomb added 2 commits June 21, 2026 19:27
An activity can yield several products, so its *name* is shared across them
while the *product* tells them apart. The old `name`/`product` (plus
`referenceProduct`, the snake-case get_path_to / columnar keys, and an
exchange's `targetActivity`) invited mixing the two. Standardize the wire on
`process_id` + `activity_name` + `product_name`: a process is the
single-output `(activity, product)` unit addressed by `process_id` and has no
name of its own.

- DTOs: ActivitySummary, ConsumerResult, SupplyChainEntry, ActivityForAPI
  (referenceProduct* -> product*), ExchangeWithUnit.targetActivityName
- get_path_to and the columnar score_activities identity keys converged to
  camelCase
- get_contributing_activities: the hand-rolled MCP object now matches the REST
  DTO's keys
- AGENTS.md glossary defines activity (grouping) vs process (unit)

Breaking wire change; pre-1.0, no compatibility shim.
…_name

Mirror the engine wire rename. Activity / ConsumerResult / SupplyChainEntry /
PathStep / ActivityDetail now expose `activity_name` + `product_name`
(ActivityDetail's `reference_product*` -> `product_*`), and a technosphere
exchange's `target_activity` -> `target_activity_name`. A process is an
`(activity, product)` pair with no name of its own.

Bumps to 0.6.0 (breaking change, 0.x minor) with a migration note.
ccomb added 2 commits June 21, 2026 21:36
The field rename pushed camelCase identity keys into two MCP outputs: get_contributing_activities (processId/activityName/productName/contributionPercent) and the score_activities columnar columns (activityName/processId). But the MCP surface is snake_case everywhere else (flow_name, contribution_percent, total_score, web_url, functional_unit), so a single get_contributing_activities response mixed snake and camel and disagreed with the sibling get_contributing_flows.

camelCase is the REST wire convention (consumed by pyvolca and the web UI); the canonical field name is snake_case. Bring these two outputs back to snake_case — the columnar columns keep the clarity gain (name -> activity_name) without the casing flip. get_path_to stays camelCase: it is a REST endpoint.
The two get_supply_chain query-param tests kept a "name" root key after the field rename; the wire now emits "activityName". The tests only assert query params (they swallow the parse), so this was harmless but no longer matched the real shape.
@ccomb ccomb merged commit ac470a9 into main Jun 21, 2026
10 checks passed
@ccomb ccomb deleted the pyvolca branch June 21, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant