Skip to content

refactor(query): add logical schema and planner - #2915

Merged
Ahoo-Wang merged 1 commit into
agent/query-service-architecture-upgradefrom
agent/query-service-p1c-schema-planner
Aug 9, 2026
Merged

refactor(query): add logical schema and planner#2915
Ahoo-Wang merged 1 commit into
agent/query-service-architecture-upgradefrom
agent/query-service-p1c-schema-planner

Conversation

@Ahoo-Wang

Copy link
Copy Markdown
Owner

Summary

  • add immutable logical query schemas keyed by the complete QueryTarget, with canonical field aliases, nested search scopes, declared field types/operators/capabilities, and order-independent schema contract ids
  • add pure record and analytics planners that produce fully validated backend-neutral plans or explicit legacy fallback decisions while preserving mandatory-condition provenance
  • add canonical SHA-256 plan fingerprints covering schema, target, operation, filters, projection/sort/page semantics, capabilities, semantic tier, and analytics semantics
  • lock MongoDB-baseline null/collection behavior, strict stable page sorting, typed/dynamic projection policy, Native backend binding, Decimal128 analytics policy, and exact analytics cursor keys with golden tests
  • update the architecture design with the implemented P1-C boundaries and unsupported capability set

Why

The query architecture upgrade needs a deterministic planning boundary between normalized legacy inputs and future backend compilation. Without a logical schema and validated plan, MongoDB/Elasticsearch compilers would still infer field meaning, capabilities, mandatory security filters, pagination stability, and analytics semantics independently.

This PR establishes that boundary without wiring it into production execution.

Compatibility / impact

  • stacked on refactor(query): add admission and normalizer #2910
  • no changes to supported public query APIs, wire DTOs, Spring beans, backend drivers, or OpenAPI schemas
  • all new runtime types remain under me.ahoo.wow.query.internal
  • compatible fallback is limited to user-side capability gaps and always carries a target/schema-bound mandatory proof
  • mandatory schema/capability/Native failures remain fail-closed
  • physical fields, mappings, analyzers, BSON, and Elasticsearch driver types do not enter the logical schema or plan

Verification

  • ./gradlew :wow-query:check --rerun-tasks
  • ./gradlew :wow-query:test --tests me.ahoo.wow.query.PublicQueryContractCompatibilityTest
  • ./gradlew :wow-openapi:test --tests me.ahoo.wow.openapi.snapshot.OpenApiCompatibilitySnapshotTest
  • git diff --cached --check
  • final staged diff reviewed independently for schema/type boundaries, record/operator semantics, analytics/errors, and test evidence; no actionable P0/P1/P2 findings remain

@github-actions github-actions Bot added the area: documentation Changes to project documentation label Aug 7, 2026
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 589 complexity

Metric Results
Complexity 589

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.27635% with 305 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.07%. Comparing base (ffc4c44) to head (3252a1e).

Files with missing lines Patch % Lines
...ahoo/wow/query/internal/schema/QueryFieldSchema.kt 60.25% 40 Missing and 22 partials ⚠️
...w/query/internal/planning/QueryConditionPlanner.kt 66.89% 30 Missing and 18 partials ⚠️
...w/query/internal/planning/AnalyticsQueryPlanner.kt 78.87% 32 Missing and 13 partials ⚠️
...oo/wow/query/internal/plan/QueryPlanFingerprint.kt 75.88% 26 Missing and 15 partials ⚠️
.../wow/query/internal/planning/RecordQueryPlanner.kt 84.65% 20 Missing and 11 partials ⚠️
...o/wow/query/internal/schema/QueryDocumentSchema.kt 76.74% 13 Missing and 17 partials ⚠️
...otlin/me/ahoo/wow/query/internal/plan/QueryPlan.kt 91.37% 14 Missing and 3 partials ⚠️
...hoo/wow/query/internal/planning/PlanningSupport.kt 52.00% 8 Missing and 4 partials ⚠️
...hoo/wow/query/internal/analytics/AnalyticsModel.kt 82.60% 4 Missing and 4 partials ⚠️
...e/ahoo/wow/query/internal/planning/QueryPlanner.kt 85.36% 5 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@                                Coverage Diff                                 @@
##             agent/query-service-p1b-admission-normalizer    #2915      +/-   ##
==================================================================================
- Coverage                                           91.68%   91.07%   -0.61%     
- Complexity                                           7092     7348     +256     
==================================================================================
  Files                                                 997     1007      +10     
  Lines                                               27428    28808    +1380     
  Branches                                             2890     3169     +279     
==================================================================================
+ Hits                                                25146    26237    +1091     
- Misses                                               1290     1466     +176     
- Partials                                              992     1105     +113     
Flag Coverage Δ
contract 47.24% <ø> (+0.05%) ⬆️
integration 75.09% <ø> (+0.01%) ⬆️
local 86.97% <78.27%> (-0.44%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from agent/query-service-p1b-admission-normalizer to agent/query-service-architecture-upgrade August 9, 2026 07:29
@Ahoo-Wang
Ahoo-Wang merged commit 3252a1e into agent/query-service-architecture-upgrade Aug 9, 2026
11 checks passed
@Ahoo-Wang
Ahoo-Wang deleted the agent/query-service-p1c-schema-planner branch August 9, 2026 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: documentation Changes to project documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant