Slice E: relationship mutation (remove_relationship / update_relationship)#51
Merged
Conversation
Connection-only remove_relationship / update_relationship (AVP-only), edge-level remove vs directed-row update, ambiguity contract; records the add_parent/add_child/remove_parent/remove_child compositional follow-up. 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> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
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> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
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> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
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> Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
…ves edit
Final-review minors: update_relationship_both now checks the symmetric
partner before editing (same {dangling_half_edge, Id} arm as remove, keeping
the documented contract accurate); single-direction CT now asserts the
protected Template AVP survives an ordinary edit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EWukKCbrN8GybaScJGU2kF
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.
Slice E — Relationship mutation (
remove_relationship/update_relationship)Completes the connection-arc write-path: the exact mirror of
add_relationship,plus per-direction AVP editing. Connection-arcs only — these never touch the
parents/classescaches, so there is no cache work.What's added
remove_relationship/3,4update_relationship/4,5(S, C, T)update_relationship_both/4,5{Fwd, Rev}listsmutate/1Key design points
(S, C, T)triple names one directed row — name
(T, R, S)to edit the reverse. Removalalways takes both rows (a half-edge is invalid); a missing symmetric partner
aborts
{dangling_half_edge, Id}before any delete.matching more than one logical edge →
{ambiguous_relationship, Templates}(templates carried so a
/3caller can re-issue as/4); zero matches →relationship_not_found.?ARC_TEMPLATEis protected from edit in both directions (changing scope isa structural rewire, not metadata).
validate_avp_updates/1+apply_avp_updates/2unchanged.One tier-1 update primitive;
*_bothis pure composition above it.never open their own transaction; tier-2 own one
transaction/1; tier-3(
mutate/1) composes tier-1 directly.Scope / deferred (recorded in
TASKS.md)Structural rewiring (
characterization/target_nref/reciprocal— expressibleas
mutate([remove, add])) and a rel-id-keyed form (the only disambiguator for agenuine duplicate edge) are deferred. Compositional-arc mutation
(
add_parent/add_child/remove_parent/remove_child, which do maintain theparentscache) is recorded as a separate follow-up.Tests
Full suite green: 501 CT + 135 EUnit = 636, 0 failures, 0 compile warnings.
New: 2 EUnit (
has_template_update/1) + 10 instance CT (remove ×5, update single×4,
_both×1) + 3 mgr CT (mutateremove / update / mixed-rollback). Coverageincludes duplicate-edge ambiguity,
/4disambiguation, dangling-half-edgerollback, direction independence, Template-AVP protection and survival, and
whole-batch atomic rollback.
verify_caches/0clean after every case.Design:
docs/designs/slice-e-relationship-mutation-design.mdPlan:
docs/superpowers/plans/2026-06-28-slice-e-relationship-mutation.md🤖 Generated with Claude Code