Transaction-seam retrofit: route all mnesia:transaction sites through transaction/1#43
Merged
Merged
Conversation
The seam shipped in PR davidwt-com#41 (81b2962); the heading still read "IN DESIGN". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
Brainstormed spec for the first tracked Transaction-layering seam follow-up: route every hand-rolled mnesia:transaction site (40 across the six graphdb workers + bootstrap) through graphdb_mgr:transaction/1. Behaviour-preserving; documents the conversion taxonomy, four behaviour-preservation traps, the full per-site inventory, and the two-part testing standard (existing 537 are the oracle; new/reshaped paths get new tests). Atomic add_relationship and batch mutate/1 remain separate slices. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n TASKS.md Inserts the out-of-scope Atomic add_relationship item between the retrofit and batch-mutate follow-ups under the Transaction-layering seam section, and links the retrofit design doc on the retrofit bullet. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Task-by-task plan (7 tasks, one per worker module + final verification) to route all 40 mnesia:transaction sites through graphdb_mgr:transaction/1. Per-site before/after code, the four behaviour-preservation traps flagged at their sites, and the only 2 new tests (instance abort-relocation arms: characterization_not_found / reciprocal_not_found). Behaviour-preserving: existing 537 are the oracle, zero expectation edits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
First tracked follow-up of the transaction-layering seam (PR #41): retrofit every hand-rolled
mnesia:transactioncall site in the graphdb app onto the seam convention, makinggraphdb_mgr:transaction/1the single place that pattern-matches{atomic,_}/{aborted,_}.Full sweep — 40 sites across the six workers + the bootstrap loader:
graphdb_mgr(4) ·graphdb_bootstrap(2) ·graphdb_attr(9) ·graphdb_class(8) ·graphdb_language(7) ·graphdb_rules(3) ·graphdb_instance(7).How
Each site's transaction fun is a tier-1 primitive (bare mnesia ops; rollback-worthy failures via
mnesia:abort(ExactReason)); the wrapper callstransaction/1and projects{ok,Value}to the site's existing public shape, reproducing its existing failure contract. Becausetransaction/1's{aborted,Reason} -> {error,Reason}mapping is byte-identical to the inline mapping, fun-internal aborts/throws are preserved automatically.Four behaviour-preservation traps handled explicitly:
{error,R},throw({error,R}), and{reply,{error,R},State}all preserved at their sites.{atomic,{error,_}=E} -> E(graphdb_class) kept as a returned, committed value — NOT converted to an abort (preserves no-rollback semantics).not_found(graphdb_class:do_find_template_by_name,graphdb_instance:resolve_from_connected) preserved.graphdb_instance:validate_arc_endpoints) uses byte-identical Reason terms for every arm.Scope
Behaviour-preserving refactor only. Out of scope (tracked separately in TASKS.md):
add_relationship— needsgraphdb_classtier-1 in-txn read primitives (its reads aregen_server:calltoday).mutate([Mutation])— the tier-3 entry point.Testing
grep -rn "mnesia:transaction" apps/graphdb/src/returns onlytransaction/1's own definition.graphdb_instanceCT cases covering the previously-untestedcharacterization_not_found/reciprocal_not_foundarms). Existing tests unchanged — the only test-file change is additions.Design:
docs/designs/transaction-seam-retrofit-design.mdPlan:
docs/superpowers/plans/2026-06-20-transaction-seam-retrofit.md🤖 Generated with Claude Code