fix: re-key hallways/tunnels on wing-name migration so the graph follows renamed wings - #1939
Open
ggettert wants to merge 1 commit into
Open
fix: re-key hallways/tunnels on wing-name migration so the graph follows renamed wings#1939ggettert wants to merge 1 commit into
ggettert wants to merge 1 commit into
Conversation
This was referenced Jul 6, 2026
Open
…ows renamed wings Fixes MemPalace#1938. migrate_wing_names re-keyed drawer/closet/topics_by_wing metadata but never touched the associative graph, so hallways.json and tunnels.json kept pointing at the pre-normalization wing. - hallways.rekey_hallway_wings: rewrite wing + regenerate ids; merge records that collapse onto the same (wing, entity-pair). - palace_graph.rekey_tunnel_wings: rewrite endpoint wings + regenerate canonical ids; drop self-referential tunnels; merge id collisions. - migrate_wing_names calls both after the metadata re-key. - Extracted _hallway_label so fresh and re-keyed records format identically. Re-key (not recompute) preserves the MemPalace#1578 dynamics fields.
ggettert
force-pushed
the
fix/migrate-rekey-graph-1938
branch
from
July 21, 2026 19:31
d5bd9a1 to
31b02cf
Compare
Contributor
Author
|
Rebased this onto current |
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.
Summary
Fixes #1938.
migrate_wing_namesre-keyed drawer/closet/topics_by_wingmetadata but never touched the associative graph, sohallways.jsonandtunnels.jsonkept pointing at the pre-normalization wing.What changed
hallways.rekey_hallway_wings(rename_map)— rewrites hallwaywing+ regenerates ids; merges records that collapse onto the same(wing, entity-pair).palace_graph.rekey_tunnel_wings(rename_map)— rewrites tunnel endpoint wings + regenerates canonical ids; drops tunnels whose endpoints coincide after the rename; merges id collisions. Covers entity and topic tunnels (shared store).migrate_wing_namescalls both after the metadata re-key, using the same rename map, and reports counts._hallway_labelso freshly-computed and re-keyed/merged records format identically (no behavior change).Why re-key, not recompute
A wing-name migration is a pure rename — drawer membership and entity co-occurrence are unchanged. Re-keying is sufficient and preserves the #1578 dynamics fields (strength/stability/last_activated/access_count); a recompute from drawers would reset them. Collision merges keep the stronger/more-recent dynamics.
Tests
_alpha+betadrawers, build hallways/tunnels, run migration → graph moves toalpha; two-wings-into-one merges to a single hallway with summed count.Known limitations
topics_by_wingre-key without a shared transaction across the four stores. If the graph step fails mid-way, the drawer re-key is intentionally not rolled back (a successful data migration shouldn't be undone because a derived index failed); the failure is surfaced as a warning and the operation is re-runnable — a subsequent migrate re-keys any orphaned graph records. Full cross-store atomicity is out of scope for this fix.Fixes #1938.