Skip to content

Add causal-graph structural-integrity audit + fix 2 orphan nodes#115

Merged
realmarcin merged 1 commit into
mainfrom
claude/causal-graph-integrity
Jun 16, 2026
Merged

Add causal-graph structural-integrity audit + fix 2 orphan nodes#115
realmarcin merged 1 commit into
mainfrom
claude/causal-graph-integrity

Conversation

@realmarcin

Copy link
Copy Markdown
Contributor

What

A diagnostic sweep of the corpus showed it's structurally clean (0 dangling edges, 0 edges missing evidence) except 2 orphan nodes — nodes declared in a causal graph that no edge references. Nothing currently catches this: LinkML/validate-strict check field types, not graph connectivity.

This adds a causal-graph structural-integrity audit and fixes the 2 it finds.

New audit (scripts/audit_causal_graphs.py, just audit-graphs)

Flags two defects the schema can't, exits non-zero on any:

  • DANGLING_EDGE — edge subject/object is not a declared node_id (typo / deleted node)
  • ORPHAN_NODE — declared node referenced by no edge (modelling gap)

Wired into just qc (and thus CI). Unit-tested (tests/test_audit_causal_graphs.py: clean / orphan / dangling).

The 2 orphan fixes

  • urease_activity.yaml — the trait node itself was disconnected. Added urease_function -[manifests as / METPO:2007400]-> urease_activity_trait so the molecular function links to the observable phenotype.
  • capsule.yamlcapsular_polysaccharide was orphaned. Added capsule_assembly -[produces / biolink:produces]-> capsular_polysaccharide.

Both new edges carry literature evidence; FIX_ORPHAN_NODE curation events appended.

Verification

  • just audit-graphs0 findings.
  • just validate-strict → 477 files, 0 errors. just qc → passes. 90 tests pass (+3 new).
  • Pages regenerated.

🤖 Generated with Claude Code

LinkML/validate-strict check field types but not graph connectivity. New
scripts/audit_causal_graphs.py flags two structural defects the schema can't:
  DANGLING_EDGE  edge subject/object not a declared node_id
  ORPHAN_NODE    declared node referenced by no edge
Wired into `just qc` (and thus CI) alongside the other audits; exits non-zero
on any defect. Unit-tested (tests/test_audit_causal_graphs.py: clean / orphan /
dangling cases).

Fixes the 2 orphan nodes the audit surfaced:
- physiology/urease_activity.yaml: the trait node (urease_activity_trait) was
  disconnected; added urease_function -[manifests as / METPO:2007400]->
  urease_activity_trait so the molecular function links to the observable trait.
- morphology/capsule.yaml: capsular_polysaccharide was orphaned; added
  capsule_assembly -[produces / biolink:produces]-> capsular_polysaccharide.
Both edges carry literature evidence; FIX_ORPHAN_NODE curation events appended.

audit-graphs now reports 0 findings. validate-strict 0 errors; full qc passes;
90 tests pass. Pages regenerated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@realmarcin realmarcin merged commit f5d590f into main Jun 16, 2026
2 checks passed
@realmarcin realmarcin deleted the claude/causal-graph-integrity branch June 16, 2026 07:39
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