Repository navigation
Include existing schema's rendered definition in duplicate-type rejection - #2142
Merged
Merged
Conversation
…tion create_schema's duplicate-type check fetched the existing schema node only to check its presence, then discarded it. The rejection message named the collision but never the existing type's actual fields, so a consuming agent had no fact to report and filled the gap by describing the fields from its own (rejected) call instead. Reuse the already-fetched schema node and render it through the existing EntityTypeDescriptor::render_line() — the same renderer the schema block already uses — so the rejection carries the type's real definition, states plainly that the call was not applied, and points the caller at create_node for instances. Closes #2134 Co-Authored-By: Claude <[email protected]>
4 tasks
Multi-condition assert! chain wasn't rustfmt-clean.
Contributor
Author
|
Independent re-verification complete (self-approval blocked by GitHub for own PRs — recording here instead):
Adversarial review sub-agent independently verified: no error-handling regression vs the original Merging. |
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
create_schema's duplicate-type rejection named the collision but never the existing type's actual fields. An agent consuming that error had no fact to report, so it filled the gap by describing the fields from its own (rejected) call and presenting them to the user as confirmed — a case of a missing fact producing confident fiction (ADR-064 rule 4).Fix
matches!check already fetches (previously discarded) inhandle_create_schema(packages/core/src/schema/mod.rs).EntityTypeDescriptor::render_line()(packages/core/src/ops/entity_types_block.rs) — no new formatting code.Test plan
test_create_schema_duplicate_rejection_carries_existing_definitioninpackages/core/src/schema/schema_test.rs: seeds aticketschema with one field set, then attempts to recreate it with an entirely different (invented) field set, and asserts the rejection message contains the existing type's real fields (title,owner,triage,shipped) and does not contain the invented ones (assignee,sprint,ready for dev); also asserts the message states the type was not modified and the call's fields were not applied.cargo test -p nodespace-core— all suites pass (1155 lib tests + all integration test binaries), including the 57 schema-module tests.cargo clippy -p nodespace-core --all-targets— clean.Closes #2134