Conversation
…asSetup PUT /models with hasVersion silently dropped the child FK update: the resource registry described object-FK and junction-array relationships but had no metadata for one-to-many relationships where the FK column lives on the child row (software_version.software_id, configuration.software_version_id, configuration.model_configuration_id). The junction loop in service.ts skipped these arrays, so the parent _set ran but the child FK stayed null and the row was orphaned. Add an optional childFkColumn to RelationshipConfig and mark all FK-on-child cases in the registry: hasVersion across softwares + 7 model subtypes, softwareversions.hasConfiguration, modelconfigurations.hasSetup. The PUT handler now emits clear_<rel> + link_<rel> update_<child_table> mutations alongside the existing junction multi-root mutation (replace semantics: clear FK on rows previously linked to this parent and not in the new list, then set FK on the rows in the new list). The POST handler emits a link_<rel> update so newly created parents pick up the child rows referenced in the request body. Adds 4 integration tests (PUT with hasVersion, PUT with empty hasVersion, PUT softwareversions with hasConfiguration, POST softwares with hasVersion). 186 tests pass.
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
hasVersion(and PUT softwareversions withhasConfiguration, etc.) silently dropped the child FK update. Hasura row was created/updated butsoftware_idstayednull, leaving the version orphaned from its parent model.service.tsskipped them.childFkColumnonRelationshipConfig, tags the 10 affected relationships (hasVersionacross softwares + 7 model subtypes,softwareversions.hasConfiguration,modelconfigurations.hasSetup), and extends create + update handlers to emitclear_<rel>/link_<rel>update_modelcatalog_<child>mutations (replace semantics).Test plan
npm run build— greennpm test— 186/186 pass (was 178/178; +4 new integration tests for FK-on-child PUT/POST flow + empty-array clear-only path)modelcatalog_software_version.software_idequals the parent model id in HasurahasModelCategory) still work unchanged