Skip to content

Extend CausalNodeTypeEnum with STATE/QUALITY/CAPACITY (+26 retyped)#81

Merged
realmarcin merged 2 commits into
mainfrom
causal-node-type-enum-extension
May 26, 2026
Merged

Extend CausalNodeTypeEnum with STATE/QUALITY/CAPACITY (+26 retyped)#81
realmarcin merged 2 commits into
mainfrom
causal-node-type-enum-extension

Conversation

@realmarcin
Copy link
Copy Markdown
Contributor

Summary

Closes the v3 cohort's "Node-typing notes" follow-up. When v3 landed, four labels were mis-typed because the enum couldn't represent their actual semantics. PR #72 partially resolved this (biomass → CHEMICAL); this PR adds the three missing enum values and finishes the cleanup.

Label Before After Nodes
microbial biomass BIOLOGICAL_PROCESS CHEMICAL (PR #72) 16
proton motive force BIOLOGICAL_PROCESS STATE 16
membrane fluidity BIOLOGICAL_PROCESS QUALITY 6
reducing power CHEMICAL CAPACITY 4

Schema (src/traitmech/schema/traitmech.yaml)

CausalNodeTypeEnum gains three permissible values:

  • STATE — a bioenergetic or molecular state of the cell (e.g. proton motive force, redox state of the quinone pool). Distinct from a process: the state is the gradient/steady-value, not its establishment.
  • QUALITY — a quality or measurable attribute of a cellular component (e.g. membrane fluidity, GC content, motility speed). A PATO-style axis attached to a microbial entity.
  • CAPACITY — a metabolic or functional capacity — an electron-donating pool, ATP charge, or other reservoir-of-X notion that is neither a single chemical species nor a process.

Migration (scripts/retype_causal_nodes.py)

RETYPES extended from 1 → 4 entries; DEFERRED list now empty. Re-run produces 26 retypes across 25 files.

v1 cohort: Path B extend-in-place

Three new leaf rows under METPO:1007410 (trait causal node type), keeping subset tag metpo_traitmech_2026_05:

  • METPO:1007421 — causal-graph state node
  • METPO:1007422 — causal-graph quality node (xref PATO:0000001)
  • METPO:1007423 — causal-graph capacity node

verify-proposal reports all 13 CausalNodeTypeEnum values lifted.

v3 cohort

proposals/metpo_traitmech_v3/proposal.md "Node-typing notes" section rewritten to document the post-merge resolution.

Mapping TSV

Three rows in mappings/node_grounding.tsv updated to use the new node_type keys so future seeded nodes ground correctly. All three still ground to their cohort-v3 METPO CURIEs (METPO:1007500/1007503/1007505).

Verified locally

$ just validate-strict
  files with ERROR:   0

$ just verify-proposal metpo_traitmech_v1
  scope-C: all 13 CausalNodeTypeEnum values lifted
  failures: 0

$ just robot-validate-proposal metpo_traitmech_v1
  delta: +6
  status: PASS (no UNSAT, ELK exited 0)

$ just verify-proposal metpo_traitmech_v3
  failures: 0

$ uv run python scripts/retype_causal_nodes.py --apply
  nodes retyped: 26

$ uv run python scripts/retype_causal_nodes.py    # idempotency
  nodes retyped: 0

$ uv run pytest tests/
  56 passed

Test plan

  • Schema validates the new enum values
  • Migration is idempotent
  • v1 + v3 cohorts verify + robot-validate clean
  • All 56 existing tests pass against the extended schema
  • CI runs pytest + validate-strict on the diff

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 26, 2026 02:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the TraitMech schema’s CausalNodeTypeEnum to represent three previously-missing semantics (STATE, QUALITY, CAPACITY) and updates the corpus + grounding mappings so affected causal-graph nodes are correctly typed going forward.

Changes:

  • Add STATE / QUALITY / CAPACITY to CausalNodeTypeEnum (schema extension).
  • Extend scripts/retype_causal_nodes.py to migrate the remaining mis-typed labels and mark the deferred list resolved.
  • Retype affected causal-graph nodes across the corpus and update mappings/node_grounding.tsv + proposal artifacts to match the new node_type keys.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/traitmech/schema/traitmech.yaml Adds STATE, QUALITY, CAPACITY permissible values to CausalNodeTypeEnum.
scripts/retype_causal_nodes.py Extends RETYPES to include the three newly-supported node types and clears DEFERRED.
proposals/metpo_traitmech_v3/proposal.md Updates the “Node-typing notes” section to reflect post-merge resolution.
proposals/metpo_traitmech_v1/metpo_proposal_classes_robot.tsv Adds three new leaf rows for the v1 cohort’s enum lift (STATE/QUALITY/CAPACITY).
mappings/node_grounding.tsv Updates the (label, node_type) keys for the three affected mappings to use the new enum values.
data/traits/environment/facultative_psychrophilic.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/environment/mesophilic.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/environment/neutrophilic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/environment/obligately_aerobic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/environment/ph_optimum.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/environment/psychrophilic.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/environment/psychrotolerant.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/environment/temperature_optimum.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/environment/temperature_preference.yaml Retypes membrane fluidity node to QUALITY and appends curation event.
data/traits/metabolism/aerobic_respiration.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/metabolism/oxidative_phosphorylation.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/metabolism/respiration.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/morphology/gliding.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/carboxydotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/chemolithoautotrophic.yaml Retypes proton motive forceSTATE and reducing powerCAPACITY; appends curation event.
data/traits/physiology/chemolithoheterotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/chemoorganotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/chemotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/hydrogenotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/lithoautotrophic.yaml Retypes reducing power node to CAPACITY and appends curation event.
data/traits/physiology/lithotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/organotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/photolithoautotrophic.yaml Retypes reducing power node to CAPACITY and appends curation event.
data/traits/physiology/photoorganoheterotrophic.yaml Retypes proton motive force node to STATE and appends curation event.
data/traits/physiology/phototrophic.yaml Retypes reducing power node to CAPACITY and appends curation event.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/retype_causal_nodes.py
Comment thread proposals/metpo_traitmech_v3/proposal.md Outdated
Comment thread proposals/metpo_traitmech_v1/metpo_proposal_classes_robot.tsv Outdated
Comment thread mappings/node_grounding.tsv Outdated
Comment thread mappings/node_grounding.tsv Outdated
Comment thread mappings/node_grounding.tsv Outdated
realmarcin added a commit that referenced this pull request May 26, 2026
All six Copilot inline comments were the same finding: the inline
references to "PR_D" are placeholders, not real PR identifiers, so
they'll be meaningless once the PR is merged.

Replaced across all four affected files:
  - scripts/retype_causal_nodes.py        (5 occurrences)
  - mappings/node_grounding.tsv           (3 occurrences in notes)
  - proposals/metpo_traitmech_v1/metpo_proposal_classes_robot.tsv
                                          (3 occurrences in row obs)
  - proposals/metpo_traitmech_v3/proposal.md  (3 occurrences)

Replacement phrasing depends on context:
  - "extended in PR_D"
      → "extended via the STATE/QUALITY/CAPACITY enum extension"
  - "added to the enum in PR_D"
      → "added to the enum in the same batch"
  - "PR_D for the other three"
      → "the STATE/QUALITY/CAPACITY batch for the other three"
  - "STATE in PR_D after CausalNodeTypeEnum"
      → "STATE after CausalNodeTypeEnum"
  - "PR_D, after the enum was"
      → "after the enum was"
  - "(PR_D)" → "(same enum-extension batch)"

The references to PR #72 (biomass retype, already merged) are
kept verbatim — that PR number is stable.

Verified:
  - just verify-proposal metpo_traitmech_v1 → PASS
  - just verify-proposal metpo_traitmech_v3 → PASS
  - just validate-strict                    → 0 ERROR rows
  - grep -r "PR_D" scripts mappings proposals → 0 hits

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
realmarcin and others added 2 commits May 25, 2026 21:59
…ped)

Closes the v3 cohort's "Node-typing notes" follow-up. When v3
landed, four labels were mis-typed because the enum couldn't
represent their actual semantics:

  proton motive force  → BIOLOGICAL_PROCESS  (semantically a STATE)
  membrane fluidity    → BIOLOGICAL_PROCESS  (semantically a QUALITY)
  microbial biomass    → BIOLOGICAL_PROCESS  (closest fit: CHEMICAL)
  reducing power       → CHEMICAL            (semantically a CAPACITY)

PR #72 retyped biomass → CHEMICAL (the closest existing fit at
that time). This PR adds the three missing enum values
(STATE / QUALITY / CAPACITY) and retypes the remaining three
labels covering 26 nodes:

  proton motive force  BIOLOGICAL_PROCESS → STATE     16 nodes
  membrane fluidity    BIOLOGICAL_PROCESS → QUALITY    6 nodes
  reducing power       CHEMICAL           → CAPACITY   4 nodes

Schema (src/traitmech/schema/traitmech.yaml):
  CausalNodeTypeEnum gains STATE, QUALITY, CAPACITY permissible
  values with prose descriptions distinguishing each from the
  closest existing value (STATE vs BIOLOGICAL_PROCESS, QUALITY
  vs MOLECULAR_FUNCTION, CAPACITY vs CHEMICAL).

Migration (scripts/retype_causal_nodes.py):
  RETYPES dict extended from 1 to 4 entries; DEFERRED list now
  empty. Re-run produces 26 retypes across 25 files.

Mapping TSV (mappings/node_grounding.tsv):
  Three rows updated to use the new node_type keys so future
  seeded nodes ground correctly:
    proton motive force  BIOLOGICAL_PROCESS → STATE
    reducing power       CHEMICAL           → CAPACITY
    membrane fluidity    BIOLOGICAL_PROCESS → QUALITY
  All three still ground to their METPO:1007500/1007503/1007505
  cohort-v3 CURIEs.

v1 cohort (proposals/metpo_traitmech_v1/, Path B extend-in-place):
  Three new leaf rows under METPO:1007410 (trait causal node
  type):
    METPO:1007421  causal-graph state node
    METPO:1007422  causal-graph quality node    (xref PATO:0000001)
    METPO:1007423  causal-graph capacity node
  Subset tag unchanged (metpo_traitmech_2026_05).
  verify-proposal: all 13 CausalNodeTypeEnum values lifted, 0 failures.
  robot-validate-proposal: ELK +6, no UNSAT.

v3 cohort (proposals/metpo_traitmech_v3/proposal.md):
  "Node-typing notes" section rewritten to document the
  post-merge resolution (all four labels now correctly typed,
  pointing at PR #72 and PR_D).

Verified locally:
  - just validate-strict           → 0 ERROR rows / 357 files
  - just verify-proposal v1        → PASS (13 leaves lifted)
  - just verify-proposal v3        → PASS
  - just robot-validate-proposal v1 → PASS, ELK +6
  - retype-causal-nodes --apply (second pass) → 0 retypes (idempotent)
  - uv run pytest tests/           → 56 passed

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
All six Copilot inline comments were the same finding: the inline
references to "PR_D" are placeholders, not real PR identifiers, so
they'll be meaningless once the PR is merged.

Replaced across all four affected files:
  - scripts/retype_causal_nodes.py        (5 occurrences)
  - mappings/node_grounding.tsv           (3 occurrences in notes)
  - proposals/metpo_traitmech_v1/metpo_proposal_classes_robot.tsv
                                          (3 occurrences in row obs)
  - proposals/metpo_traitmech_v3/proposal.md  (3 occurrences)

Replacement phrasing depends on context:
  - "extended in PR_D"
      → "extended via the STATE/QUALITY/CAPACITY enum extension"
  - "added to the enum in PR_D"
      → "added to the enum in the same batch"
  - "PR_D for the other three"
      → "the STATE/QUALITY/CAPACITY batch for the other three"
  - "STATE in PR_D after CausalNodeTypeEnum"
      → "STATE after CausalNodeTypeEnum"
  - "PR_D, after the enum was"
      → "after the enum was"
  - "(PR_D)" → "(same enum-extension batch)"

The references to PR #72 (biomass retype, already merged) are
kept verbatim — that PR number is stable.

Verified:
  - just verify-proposal metpo_traitmech_v1 → PASS
  - just verify-proposal metpo_traitmech_v3 → PASS
  - just validate-strict                    → 0 ERROR rows
  - grep -r "PR_D" scripts mappings proposals → 0 hits

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@realmarcin realmarcin force-pushed the causal-node-type-enum-extension branch from 2ee00ac to 959e1a7 Compare May 26, 2026 04:59
@realmarcin realmarcin merged commit 94811a0 into main May 26, 2026
3 checks passed
@realmarcin realmarcin deleted the causal-node-type-enum-extension branch May 26, 2026 05:00
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.

2 participants