fix: a filter survives only where the field it selects on does - #106
Merged
Conversation
Emitting the three pilot documents refused two shapes the fictional fixtures never produce. A filter is derived from the listed object before binding runs, and binding deletes what the SDK cannot carry. Where a field went, the match still compared against a model field that no longer existed and the tree would not build. Filters are now reconciled against the item nodes that survived. An id filter takes the type of the field it selects on, and an integer key is as common as a string one. The by-id parameter was declared as ValueString regardless, which does not compile against a types.Int64 field. It is built through the shared call plan now, which converts. Counts in the readme are re-measured across all three trees rather than carried forward. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Two defects in #105, both found by re-emitting Jamf Pro, ThousandEyes and
GitHub rather than by any test. The fictional fixtures produce neither shape.
A filter outlived the field it selects on
Filters are derived from the listed object in
derive.go, which runs beforesdkbindprunes. Binding deletes what the SDK cannot carry, and the item modelis built from what survives — so a filter over a deleted field compared against
a model field that no longer existed:
Emission now reconciles the two, keeping only the filters whose field survived.
Derivation still declares the intent; emission is the only place that knows
what binding left.
An integer id was declared as a string
The id short-circuit hard-coded
data.ID.ValueString(), which was correct onlywhile the argument was the always-string
filter_value. A filter takes the typeof the field it selects on, and Jamf Pro keys
api_integrationby an integer:The parameter is built through
buildCallPlannow — the same path the resourceread and the lookup datasource already use, which converts the attribute to the
parameter's type and declares any import that needs.
readPlanWithoutParamsandthe hand-written
IDParamDeclare deleted; there is nothing left that assumedthe id was a string.
Re-measured
All three trees regenerate and pass postcheck —
go mod tidy,go build,go vet:README.mdcarried 161 / 272 / 69 / 210. Actions moving to 229 is thelone-write change in #104; the rest predates this work and was simply stale, so
the line is re-measured rather than adjusted.
Verification
Added a regression test that deletes one field binding and proves the filter
goes with it — out of the schema, the model and the match — while the filters
whose fields survived are untouched.
make checkpasses at 91.3%.The load-bearing check remains generating the three documents, which is what
caught both of these. Neither would have been found by the fixtures.
🤖 Generated with Claude Code