refactor(schema): deduplicate isClaimed — export as schema.IsClaimed (plan 2607191918) - #756
Conversation
…ructure Exports schema.IsClaimed from internal/schema/validate.go and removes the byte-for-byte copy in requiredstructure/rule.go, which already imported internal/schema. Closes plan 2607191918. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZhZLDQbbu9MyHzgL1Sfjs
Removes the unnecessary wrapper (IsClaimed → isClaimed) by renaming the private isClaimed to IsClaimed throughout the schema package (validate.go, matchtree.go, validate_content.go) and deleting the forwarding stub. Adds TestIsClaimed covering the present/absent branches per the project's Red/Green TDD convention. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZhZLDQbbu9MyHzgL1Sfjs
Removes the comment's refactor history and internal caller list, both of which violate CLAUDE.md's "don't reference callers" rule. Regenerates the PLAN.md catalog which was out of date. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZhZLDQbbu9MyHzgL1Sfjs
…deletion Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SZhZLDQbbu9MyHzgL1Sfjs
Follows the project conventions established by setutil.TestContains_Nil,
TestContains_Empty, and TestScopeRunIndicesAcceptsStructSet: nil and
empty-map inputs must return false, and a compile-time assertion pins
the claimed parameter to map[int]struct{} so a silent drift to bool
would fail to compile.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SZhZLDQbbu9MyHzgL1Sfjs
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🟢 Merge Queue — picked up This PR is in the queue and will be batched with other Next: No action needed — you'll get another comment when CI starts on the batch. View merge queue run. |
|
🔵 Merge Queue — CI running Merged into batch branch Next: No action needed — you'll be notified when CI completes. |
|
✅ Merge Queue — merged This PR landed on Next: Done — nothing more to do here. |
Summary
IsClaimedfrominternal/schema/validate.goas the single implementation of the claimed-range set check.isClaimedcopy frominternal/rules/requiredstructure/rule.go(which already importedinternal/schema), replacing the three call sites withschema.IsClaimed.isClaimed→IsClaimedthroughout the schema package (validate.go,matchtree.go,validate_content.go), eliminating the now-redundant forwarding wrapper.TestIsClaimedininternal/schema/validate_coverage_test.gocovering the present-index and absent-index branches per the project's Red/Green TDD convention.requiredstructure/rule.go.Closes plan 2607191918.
Test plan
go build ./...passesgo test ./internal/schema/... ./internal/rules/requiredstructure/...passesgo test ./...passes (no regressions)mdsmith check .passes (0 failures)TestIsClaimedcovers present-idx (true) and absent-idx (false) branchesGenerated by Claude Code