Troubleshooting
Troubleshoot object provenance graph — Sustainable Catalyst Platform Core
Diagnose object provenance graph failures by tracing source identities, processing activities, versioned dependencies, directed lineage relationships, and snapshot integrity across research workflows. This developer guide provides reproducible graph validation, read-only SQL diagnostics, API troubleshooting, and controlled recovery procedures to establish traceable, auditable research outputs.
Application: Sustainable Catalyst Platform Core
Component: Research Lineage & Provenance Graph
Contract: sc.research.lineage-graph.v1 (capability introduced in v2.73.0)
Audience: Backend developers, platform integrators, data engineers, scientific reviewers, and security testers
Estimated reading time: 23–27 minutes
Verification status: Source reviewed; standalone synthetic validation passed; deployed acceptance pending.
Article summary: Diagnose broken object provenance graphs by checking project ownership, node and edge membership, source bindings, versioned transformations, trace direction, content fingerprints, and public API boundaries. Use the accompanying read-only SQL, synthetic Python validator, and fault-injection matrix to isolate failures without asserting causal truth or mutating production research records.
1. Scope and operating model
The provenance graph answers which declared input objects and processing activities produced or support an output? It does not answer whether the conclusion is true. Platform Core stores declared provenance metadata, while Lab, Workbench, and external services execute numerical or computational work. Treat a missing provenance edge as a missing declaration, not proof that a scientific dependency never existed.
The implementation provides ResearchLineageGraphRecord, typed nodes, edges, activities, transformations, source bindings, traces, and snapshots. Every child record carries graph_id and project_entity_id; a graph references an existing v2.72 unified research project profile. The service explicitly declines to execute analyses, generate findings, infer missing edges, promote truth, or infer causality.
2. Symptoms and severity
| Observed symptom | Likely class | Immediate handling |
|---|---|---|
422 on node/edge/trace creation |
Unsupported type, missing endpoint, invalid project, or no path | Preserve request ID and inspect schema; do not mass retry |
503 on lineage endpoint |
Feature flag disabled | Check approved deployment configuration |
| Graph bundle resolves but output has no source path | Incomplete declared lineage | Block evidence promotion and review missing edge/source binding |
| Trace changes unexpectedly after edits | Graph changed; trace is a stored path, not automatically authoritative | Compare trace to current edges and snapshot revision |
| Snapshot digest or previous-hash mismatch | Tampering, serializer mismatch, or interrupted transaction | Freeze writes and preserve original bytes |
| Public bundle includes internal metadata | Visibility boundary or projection weakness | Stop public delivery; report to security owner |
| Two services disagree about object origin | Identifier/version/authority mismatch or stale bridge | Reconcile authority-specific IDs; never auto-merge |
3. Implementation map and exact routes
| Operation | Source-defined endpoint / object |
|---|---|
| Read internal readiness | GET /v1/research/lineage/readiness |
| Create graph | POST /v1/research/lineage/projects/{project_id}/graphs |
| Register node or edge | POST /v1/research/lineage/graphs/{graph_id}/nodes, .../edges |
| Record processing | .../activities, .../transformations, .../source-bindings |
| Create declared path | POST .../traces |
| Read internal bundle | GET /v1/research/lineage/graphs/{graph_id}/bundle |
| Create immutable snapshot record | POST .../snapshots |
| Read public bundle | GET /api/v1/research/lineage/graphs/{graph_id}/bundle with public API scope data:read |
The /v1/ routes rely on internal require_read or require_write dependencies; the /api/v1/ route requires public API credentials. Do not copy production credentials into troubleshooting reports. Paths are contracts from source, not confirmation that any particular deployment exposes them.
4. Object, version, and source identity
Separate the graph-local node UUID from canonical_ref, product_ref, version_ref, and a content hash. node_key is unique only inside its graph; it is not an internationally unique research-object identifier. source_ref and source_version identify the external authority record. An identical hash may occur in two different objects; different hashes may reflect serialization changes rather than different scientific meaning.
graph_id = "graph-uuid" # Platform Core graph identity
node_id = "node-uuid" # identity within graph
canonical_ref = "sc:model:..." # cross-product referent, when governed
product_ref = "lab:run:..." # origin system reference
version_ref = "model-v2" # object version; not the object ID
source_ref = "library:dataset:..." # source authority
source_version = "2026-11" # immutable source version
content_hash = "<64 hex digits>" # content bytes/representation, not truth
5. Check readiness and isolate failure class
Use an approved, isolated staging deployment. Set the base URL to the actual internal host; obtain the required authorization header from the approved secrets mechanism. This example issues only reads.
export CORE_BASE="https://staging-core.example.invalid"
export GRAPH_ID="<synthetic-or-approved-graph-uuid>"
# Set CORE_AUTH_HEADER securely; never put its value into a ticket.
curl --fail-with-body -sS \
-H "$CORE_AUTH_HEADER" \
"$CORE_BASE/v1/research/lineage/readiness"
curl --fail-with-body -sS \
-H "$CORE_AUTH_HEADER" \
"$CORE_BASE/v1/research/lineage/graphs/$GRAPH_ID/bundle" \
-o staging-private-bundle.json
Expect a contract, declared node/predicate types, capability boundaries, and migration 0077 applied. A 401/403 requires role or credential evaluation; a 422 indicates a contract or graph reference problem; 503 reflects the feature flag. Do not convert 401 or 404 into an automatic “object absent” conclusion without checking the relevant API audience.
Cause
Most failures arise from one or more of the following source-grounded mechanisms:
- Graph/project mismatch: parent project profile absent or child records have the wrong graph/project identity.
- Incomplete material lineage: a result or finding lacks an explicit path to a source-bound input; the service will not infer one.
- Wrong predicate direction: an edge is syntactically valid but points from an input to an output when consumers expect output → dependency.
- Source version drift: source binding references an unversioned external object or a superseded source snapshot.
- Trace staleness: a stored BFS path does not change when later edges are inserted; an alternate path may be equally valid as a graph route but evidentially weaker.
- Snapshot fingerprint drift: stored state changed or hashes were recomputed with an incompatible JSON serialization algorithm.
- Public projection leak: project-level public visibility is satisfied but nested node/activity/provenance metadata was not independently redacted.
- Repeated write: create endpoints add rows and commit; do not assume retries are idempotent without a tested request key and documented conflict behavior.
7. Structural invariants and authoritative boundaries
For each graph g, require node.graph_id = edge.graph_id = g.id and both endpoints to resolve within g. Every attached object should carry the same project_entity_id. In the reference service, add_edge checks graph membership and disallows self-edges, but it does not verify that an edge’s scientific assertion is true or that the dependency graph is acyclic.
# Recommended invariants, not a copy of the Core write-path implementation.
assert all(n["graph_id"] == graph["id"] for n in nodes)
assert all(e["graph_id"] == graph["id"] for e in edges)
node_ids = {n["id"] for n in nodes}
assert all(e["source_node_id"] in node_ids and
e["target_node_id"] in node_ids for e in edges)
Graph-local UUIDs and keys enforce record identity, but canonical equivalence between services must be reviewed under the authority that owns each object. Do not repurpose an existing node simply because its title, DOI, or hash resembles another record.
8. Read-only relational diagnostics
These PostgreSQL queries use table names visible in the Platform Core SQLAlchemy models. Run on disposable databases or an authorized read replica. In psql, bind a synthetic/authorized graph UUID via \set graph_id ...; do not interpolate untrusted strings into SQL.
-- psql: \set graph_id 'graph-uuid-from-authorized-staging'
BEGIN READ ONLY;
SELECT g.id, g.graph_key, g.project_entity_id,
count(DISTINCT n.id) AS node_count,
count(DISTINCT e.id) AS edge_count
FROM research_lineage_graphs g
LEFT JOIN research_lineage_nodes n ON n.graph_id=g.id
LEFT JOIN research_lineage_edges e ON e.graph_id=g.id
WHERE g.id=:'graph_id'
GROUP BY g.id, g.graph_key, g.project_entity_id;
-- Missing endpoint or cross-graph references.
SELECT e.id, e.edge_key, e.source_node_id, e.target_node_id
FROM research_lineage_edges e
LEFT JOIN research_lineage_nodes s ON s.id=e.source_node_id
LEFT JOIN research_lineage_nodes t ON t.id=e.target_node_id
WHERE e.graph_id=:'graph_id' AND
(s.id IS NULL OR t.id IS NULL OR s.graph_id<>e.graph_id
OR t.graph_id<>e.graph_id);
ROLLBACK;
Expected result for the second query: zero rows. If rows appear, preserve a sanitized identifier-only result and investigate missing foreign-key enforcement, migration state, or data corruption. Referential integrity alone does not prove correct edge meaning.
9. Diagnose unbound sources and broken versions
A source-like node should resolve to an authoritative source binding with meaningful source_ref and source_version. The schema permits optional version and hash fields, so requiring them is an additional research-quality gate rather than an existing guaranteed write constraint. Reconcile with the source owner before editing.
BEGIN READ ONLY;
SELECT n.id, n.node_key, n.node_type, n.version_ref,
b.source_ref, b.source_version, b.content_hash
FROM research_lineage_nodes n
LEFT JOIN research_lineage_source_bindings b
ON b.node_id=n.id AND b.graph_id=n.graph_id
WHERE n.graph_id=:'graph_id'
AND n.node_type IN ('source','literature','dataset','external_artifact')
AND (b.id IS NULL OR NULLIF(b.source_ref,'') IS NULL
OR NULLIF(b.source_version,'') IS NULL);
ROLLBACK;
If the source was revised, register the new version as a distinct versioned reference and update derived analyses through an approved change workflow. Never silently rewrite the old source identity, and do not infer equivalence from a DOI alone.
10. Inspect processing activities and transformations
An activity records input_node_ids, output_node_ids, method_ref, parameter_refs, and environment. A transformation records explicit source/output nodes, operation, method/code reference, parameters, environment and integrity metadata. These are declarations, not evidence that external execution succeeded. Compare them with an independent run receipt or reproducible notebook artifact.
| Element | Developer question | Recommended evidence |
|---|---|---|
| Input versions | Were input objects immutable at time of execution? | Source IDs, exact version, content hash |
| Method and code | Which implementation produced the result? | Git commit, container digest, method version |
| Parameters | Could another operator reproduce the run? | Named parameter set and units |
| Environment | Could a dependency change affect results? | Runtime and locked dependencies |
| Output | Was the observed output generated by this activity? | Run receipt, output digest, signed or reviewed report |
11. Reproduce graph traversal deterministically
The implementation uses breadth-first traversal over declared edges. orientation=outbound follows source_node_id → target_node_id; inbound reverses this, and both treats the graph as undirected for traversal. A path returned under both must not be described as a causal chain without separate semantic validation.
from collections import deque
def declared_path(edges, start, end):
outgoing = {}
for e in edges:
outgoing.setdefault(e['source_node_id'], []).append(
(e['target_node_id'], e['id']))
queue = deque([(start, [start], [])])
seen = {start}
while queue:
current, path, edge_ids = queue.popleft()
if current == end:
return path, edge_ids
for nxt, eid in outgoing.get(current, []):
if nxt not in seen:
seen.add(nxt)
queue.append((nxt, path + [nxt], edge_ids + [eid]))
raise ValueError('No declared outbound path')
This example is independent and read-only. Compare every returned edge ID to its stored endpoints and predicate; do not accept a trace solely because its hash matches. Different insertion orders may yield different shortest paths with equal lengths.
12. Detect false-authority cycles
Many relationship types can form legitimate cycles (e.g., discussion or citation graphs). Restrict cycle alarms to directed material-dependency predicates and assess their actual semantics. A cycle among derived_from, transformed_from, produced_by, or used_input may indicate false mutual dependence and requires review. The companion checker flags such cycles but cannot determine causal or epistemic truth.
DERIVATION = {'derived_from', 'transformed_from',
'produced_by', 'used_input'}
# A -> B denotes A depends on B for this audit convention.
# A topological pass/DFS is appropriate only after edge orientation
# and predicate meaning have been independently verified.
13. Verify snapshot fingerprints and history
The reference implementation computes SHA-256 over serialized graph state using json.dumps(value, sort_keys=True, separators=(",", ":"), default=str). It stores a snapshot revision, content_hash, and previous_snapshot_hash. This serialization is not a claim of RFC 8785 JSON Canonicalization Scheme compliance; reproduce the Core serializer exactly when validating Core-generated hashes.
import hashlib, json
def core_lineage_hash(state):
canonical_for_core = json.dumps(
state, sort_keys=True, separators=(',', ':'), default=str)
return hashlib.sha256(canonical_for_core.encode()).hexdigest()
assert core_lineage_hash(snapshot['state']) == snapshot['content_hash']
# Validate previous_snapshot_hash against the preceding revision too.
A cryptographic match only establishes agreement with the hashed representation. It does not confirm that the stored source was legitimate or that the scientific analysis was correct. Preserve old revision hashes and verify snapshots before attempting a controlled restore.
14. Confirm provenance completeness without inventing truth
For a bounded sample of outputs, a useful diagnostic is the traceability coverage ratio:
T = number of reviewed outputs with an explicit path to a source-bound input / number of outputs in the reviewed population.
Report the population, selection method, observation window, exclusions, and classification of unresolved cases. If there are no outputs, report the ratio as undefined—not 100%. T measures coverage of declared lineage under the chosen definition; it does not measure evidentiary strength, independence, validity, or reproducibility.
15. Audit public projection and authorization
The public bundle route requires a public API credential with data:read scope and checks that the owning unified research project is public. The source-reviewed bundle(..., public_only=True) returns all graph child collections without a node-by-node public-rights projection. Therefore, project visibility alone is not sufficient evidence that nested metadata contains no restricted information. This is a code-review finding and must be confirmed against the actual deployed service and its policy configuration.
- Test that a private project is not publicly accessible and anonymous requests are rejected.
- Within an otherwise public project, create synthetic private node metadata, a restricted source binding, and a confidential method note; ensure the public response cannot reveal them.
- Test public graph, trace, snapshot, search/index, and downstream cache endpoints—not only a single UI view.
- Use field-level allowlists or separate public projection DTOs; do not trust a boolean
visibilityflag as field sanitization. - Check dependent Research Hub/Library rights independently: their authority and publishing rules differ from Platform Core.
16. Evaluate concurrent writes and retry semantics
The graph creation and child-record functions call db.commit() after inserts. Graph keys, node keys, and other typed keys have uniqueness constraints scoped to the graph or project. Retrying the same POST after a timeout may return a uniqueness conflict rather than a successful replay. Do not infer that a 500 or connection loss means the operation did not commit.
# Safe recovery pattern, pseudocode for an operator workflow:
# 1. STOP automatic retry on ambiguous write responses.
# 2. GET the authorized graph bundle.
# 3. Check for expected graph/key and requested source version.
# 4. Compare stored immutable identifiers and evidence references.
# 5. Only use a write retry when the operation's idempotency is known.
# 6. Otherwise file a reviewed reconciliation request.
17. Recognize stale graph, trace, and cache states
A trace captures one declared path at a point in time; it does not automatically attest to a later graph state. Compare the stored trace_hash, path edge IDs, and snapshot revision with the current bundle. If the graph has changed, regenerate a trace under an explicitly reviewed procedure and store a new snapshot; do not overwrite an older signed or published evidence packet. Cache invalidation should be tied to graph revision and rights changes, not merely wall-clock expiry.
18. Diagnose disconnected computational lineage
A provenance node labeled analysis_run is not enough to reconstruct software execution. Platform Core also provides /v1/research/computation-lineage with execution inputs, parameters, assumptions, software environments, steps, outputs, research bindings, verification records, revisions, and snapshots. Reconcile the external execution ID and versioned outputs between the lineage graph and computation-lineage registry. Core records these declarations but does not execute Python/R/Julia, train models, or validate scientific truth.
Resolution
Resolve failures in this order. Each action must have an owner, approved environment, observed predicate, and rollback boundary:
- Quarantine unsafe publication: disable affected public projection or downstream publication bridge if private provenance might be exposed.
- Freeze the evidence state: record the failing graph ID, source commit, version, request ID, sanitized response, and current snapshot hash.
- Reconcile authoritative identifiers: verify project, graph, node, source version, method, and product reference independently.
- Repair only through domain owners: add missing source bindings, corrected edges, or reviewed versions via supported internal APIs on staging; never directly patch production tables.
- Regenerate dependent attestations: create a new trace and snapshot; retain prior historical revisions and conflict evidence.
- Retest privacy before reopening: public and private audiences must be tested separately, including nested metadata and cached graph exports.
- Promote only after acceptance: require peer/code review and independent scientific review for substantive lineage claims.
Verification
Run the independent diagnostic suite over synthetic or previously sanitized evidence only. It reads files without opening network connections or mutating a database. The suite checks contract and project identity, edge referential integrity, selected dependency cycles, source bindings, processing metadata, trace direction/hash, snapshot chain, and additional public-projection policy checks.
cd object_provenance_graph_upgrade
python3 -m unittest -v test_provenance_checker.py
python3 provenance_checker.py fixtures/valid.json
python3 provenance_checker.py fixtures/invalid.json --public
# Expected: valid exits 0; invalid exits 1 with findings.
# Use --public only for a synthetic public-projection policy review.
For deployed verification, use the separate staging matrix. At minimum, demonstrate a complete finding → analysis run → dataset → source path; verify round-trip persistence, read authorization, rejected cross-graph links, unsupported predicates, stale trace handling, snapshot replay, failure injection and rights changes. Capture actual run timestamps, Git commit, DB migration, configuration fingerprint, and reviewer identity. Never label unexecuted checks as passed.
21. Fault-injection and negative-test matrix
| Test | Injection (synthetic staging) | Expected result |
|---|---|---|
| GRAPH-01 | Try a node that belongs to a different graph | Reject; no new edge; audit the attempt |
| GRAPH-02 | Use an unsupported predicate such as proves_truth |
Reject with contract error |
| GRAPH-03 | Create no declared path between existing nodes | Trace rejected; no fabricated path |
| GRAPH-04 | Introduce a derivation cycle | Independent validation flags cycle; review business semantics |
| GRAPH-05 | Change source_version without deriving a new result | Detect provenance/version inconsistency |
| GRAPH-06 | Alter snapshot state without replacing digest | Digest verification fails |
| GRAPH-07 | Replace prior snapshot hash with unrelated digest | Chain verification fails |
| GRAPH-08 | Make a restricted nested node part of public project | Public read must not disclose restricted metadata |
| GRAPH-09 | Submit duplicate node_key following ambiguous timeout | Resolve prior write; no uncontrolled duplicate |
| GRAPH-10 | Remove processing environment and method references | Reproducibility metadata gate fails |
22. Incident evidence packet
A high-quality sanitized ticket should identify incident_id, graph_id, project_ref (opaque), affected object types, redacted request IDs, endpoint and status code, expected/observed behavior, source revisions, version/hashes, first-seen time, repeatability, security impact and rollback disposition. Do not attach raw source documents, private notes, API tokens, personal data, unpublished research, unrestricted graph dumps, or production database exports.
{
"incident_id": "synthetic-PROV-001",
"component": "research-lineage-provenance-graph",
"contract": "sc.research.lineage-graph.v1",
"source_commit": "59b8444365525a58fd4f6a7e29a20d712769e1a2",
"environment": "isolated-staging",
"failure": "TRACE_EDGE_MISSING",
"graph_reference": "opaque-synthetic-graph",
"evidence_classification": "synthetic",
"expected": "declared input path resolves",
"observed": "a path edge is absent",
"reproducible": true,
"production_modified": false
}
23. Scientific limitations and interpretation
A path may be topologically present while using unreliable data, a nonreproducible algorithm, invalid causal assumptions, or circular scientific reasoning. Treat structural validation, rights clearance, technical reproducibility, statistical/causal validity, and publication approval as distinct review dimensions. Explicitly report unresolved contradictions and alternative provenance chains. Do not convert a shortest path, a hash match, a high traceability ratio, or graph connectivity into an evidentiary confidence score.
24. Deployment acceptance and release gates
- Platform/Core commit, feature flag, applied migration
0077, schema versions, and data stores recorded. - Authorization and public projection verified using both allowed and denied identities; no nested restricted fields leak.
- At least one full path verified to source/version/method and independently reproducible execution artifacts.
- Dependency cycles, missing nodes, unsupported predicates, and stale traces handled with explicit documented behavior.
- All snapshot hashes and previous pointers verified against persisted bytes and correct serializer.
- Concurrent writers, duplicate POSTs, partial commit, error handling, and rollback tested with isolated staging DB.
- Acceptance receipt includes actual results, dates, provenance, reviewer, and unresolved issues.
- Production publication remains blocked until safety, security, recovery, and independent review gates are explicitly approved.
25. Technical references
- Platform Core: research_lineage.py (pinned source) — graph registration, trace traversal, hashing, bundle and snapshot.
- Platform Core: research_lineage router — exact internal/public routes and authorization dependencies.
- Platform Core: lineage test contracts — positive and negative API cases.
- Platform Core: SQLAlchemy lineage models — table names and unique constraints.
- Platform Core: computation lineage release contract — externally executed computation.
- Platform Core: reproducible graph investigation package — portable evidence bundle boundaries.
- W3C PROV-O — entities, activities, agents, usage and derivation.
- W3C PROV Primer — provenance modeling examples.
- RFC 8785, JSON Canonicalization Scheme — interoperable canonicalization; different from this Core implementation.
- OWASP Logging Cheat Sheet — safe incident event collection and privacy controls.
