test(drift): redundant field_value_or_absent lint#889
Merged
Conversation
… fields Follow-up to #876 review. When a storyboard asserts `field_value_or_absent` on a path the response schema already marks required, the tolerance is dead code — the spec rules out the absent branch. The new `isPathRequired` schema walker + describe block catches this at the same gate as the existing reachability lint, so authors get redirected to plain `field_value` when tolerance is meaningless. Conservative on unions (required only if every branch requires it), aggressive on intersections (required if either side requires it) — matches the symmetry of `isPathReachable`. Covers 10 unit-test cases on the helper + a storyboard-wide gate that's empty today (no storyboards use the matcher yet) but engages as adoption grows. Pure test-file change, no library code touched — no changeset. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…essage Review nits from code-reviewer pass on PR #889: - Intersection handling is correct semantics (a value must satisfy both sides), not a 'symmetry' hack. Rewrite the doc comment. - Quote `field_value` in the lint failure title so CI log grep finds both sides of the matcher pair. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (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.
Summary
Follow-up to #876's review pass: warn when a storyboard asserts `field_value_or_absent` against a path the response schema already marks required. The tolerance is meaningless there — the spec guarantees the field is present, so the "absent" branch is dead code, and authors should use plain `field_value`.
Test-only change. No library code touched, no changeset.
Mechanism
Why test-only is the right surface
The review proposed a runner-time warning channel, but the runner has no cross-step warning surface today and nothing currently consumes one. Piggybacking on `storyboard-drift.test.js` is the right fit: it's already where storyboard paths meet Zod schemas, it already has an allowlist pattern (`UPSTREAM_SCHEMA_DRIFT`), and a CI test with an allowlist is a warning-shaped gate (fails the build, stays human-decidable). Adding a net-new runner warning channel + plumbing just for this check is speculative — revisit if other lint rules surface.
Test plan
Related
🤖 Generated with Claude Code