fix: Robust path resolution for choices in leaf nodes#7
Merged
samdammers merged 1 commit intomainfrom Feb 15, 2026
Merged
Conversation
6a2236a to
e35f05d
Compare
Fixes critical regressions where choices residing in nested containers or leaf nodes were resolving their target paths incorrectly. The root cause was twofold: 1. `BaseRuntimeObject.GetPath()` was losing type identity when called on a `Container` via struct embedding. This caused parent containers to fail `INamedContent` checks, leading to index-based paths instead of named paths. 2. Relative path calculation for choices was brittle when traversing up from leaf nodes. Changes: - Override `GetPath()` on `*Container` to pass the correct `*Container` instance to parents, ensuring named content is resolved by name. - Improve robustness of path resolution logic for choice points in leaf nodes. - Add regression test `TestNestedChoicePathResolution` to verify behavior with nested story structures. - Add architecture decision `0004-container-getpath-override.md` documenting the Go-specific embedding pitfall. - Update `03-java-vs-go.md` with notes on method promotion vs virtual dispatch differences.
576b2c4 to
294c99a
Compare
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.
Fixes critical regressions where choices residing in nested containers or leaf nodes were resolving their target paths incorrectly.
The root cause was twofold:
BaseRuntimeObject.GetPath()was losing type identity when called on aContainervia struct embedding. This caused parent containers to failINamedContentchecks, leading to index-based paths instead of named paths.Changes:
GetPath()on*Containerto pass the correct*Containerinstance to parents, ensuring named content is resolved by name.TestNestedChoicePathResolutionto verify behavior with nested story structures.0004-container-getpath-override.mddocumenting the Go-specific embedding pitfall.03-java-vs-go.mdwith notes on method promotion vs virtual dispatch differences.