Skip to content

chore: improve query maintenance path#10783

Open
quyentonndbs wants to merge 1 commit into
TanStack:mainfrom
quyentonndbs:maint/20260525040840
Open

chore: improve query maintenance path#10783
quyentonndbs wants to merge 1 commit into
TanStack:mainfrom
quyentonndbs:maint/20260525040840

Conversation

@quyentonndbs
Copy link
Copy Markdown

@quyentonndbs quyentonndbs commented May 25, 2026

Summary:

  • Add edge-case unit tests for the utility helpers in query-core's utils.ts (e.g. replaceEqualDeep / hashKey / partialMatchKey) covering inputs that are currently under-tested — symbol-keyed objects, Date/RegExp/Map/Set instances, circular-safe shallow checks, undefined-vs-missing key semantics. Pure additive tests in the existing vitest file; no behavior change.
  • Keep the change narrow so it is straightforward to review.

Notes:

  • I kept this scoped to the relevant implementation and tests.

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for internal utility functions, including edge cases such as symbol-keyed properties, circular references, and various data type comparisons to improve code reliability.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 955cfe98-2874-4c0a-b41f-ebe1cfbe2450

📥 Commits

Reviewing files that changed from the base of the PR and between bde5a7f and 3d4ced3.

📒 Files selected for processing (1)
  • packages/query-core/src/__tests__/utils.test.tsx

📝 Walkthrough

Walkthrough

This PR expands test coverage for four utility functions in query-core by adding new test cases covering symbol properties, reference type equality, circular reference handling, depth limits, and special type hashing behavior across shallowEqualObjects, partialMatchKey, replaceEqualDeep, and hashKey.

Changes

Utility Function Test Coverage

Layer / File(s) Summary
shallowEqualObjects test coverage
packages/query-core/src/__tests__/utils.test.tsx
Tests added for symbol-keyed property handling (ignored in comparison), non-equality for Date and RegExp reference types despite identical content, and safe behavior with circular reference structures.
partialMatchKey test coverage
packages/query-core/src/__tests__/utils.test.tsx
Tests added verifying directional matching behavior for undefined values and missing keys, and confirming Date, RegExp, Map, and Set match because they have no enumerable properties.
replaceEqualDeep test coverage
packages/query-core/src/__tests__/utils.test.tsx
Tests added validating instance selection for Date, RegExp, Map, and Set even when deeply equal, depth limit bail-out at 501, and symbol-keyed property handling.
hashKey test coverage
packages/query-core/src/__tests__/utils.test.tsx
Tests added ensuring symbol-keyed properties do not affect hash output, Date instances hash as ISO strings, and RegExp, Map, and Set hash as empty objects.

🎯 2 (Simple) | ⏱️ ~12 minutes

🐰 With tests so fine, now utility code will shine,
Each edge case caught, no more undefined surprises,
Symbols ignored, deep checks now honored,
Hashes and matches and reference compares—
Our query utilities stand with care! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'chore: improve query maintenance path' is vague and does not specifically describe the main change of adding edge-case unit tests for utility helpers. Consider a more specific title like 'test: add edge-case coverage for utility helpers' to clearly communicate the primary change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-structured, detailed, and addresses the template sections with clear explanations of the changes and scope, though the checklist boxes remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant