Skip to content

Standardize filter syntax to MongoDB-style and complete documentation#53

Merged
hotlong merged 6 commits into
mainfrom
copilot/update-filter-documentation
Jan 21, 2026
Merged

Standardize filter syntax to MongoDB-style and complete documentation#53
hotlong merged 6 commits into
mainfrom
copilot/update-filter-documentation

Conversation

Copilot AI commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Filter Documentation & Code Standardization - COMPLETED ✅

Issues Identified

  • Two different filter systems exist: array-based (old) vs MongoDB-style (new)
  • Documentation is incomplete and missing examples
  • All examples use the old array-based system
  • Operator naming is inconsistent
  • Report filters use a hybrid format
  • Build error fixed

Documentation Updates Completed ✅

  • Update QueryFilter documentation with comprehensive examples
  • Update NormalizedFilter documentation with usage guide
  • Update FilterCondition documentation with real-world examples
  • Update FilterOperator documentation to align with new system and migration guide
  • Update FilterNode documentation with deprecation notice

Code Updates Completed ✅

  • Update DashboardWidget schema to use FilterCondition
  • Update Report schema to use FilterCondition (removed old filter + filterItems)
  • Update all dashboard tests to use modern filter syntax
  • Update client-test.ts example to use MongoDB-style filters with correct 'filters' property
  • Update CRM dashboard filters (14 filters converted)
  • Update CRM report filters (6 reports converted)
  • Fix build error: changed 'where' to 'filters' in QueryOptions
  • All tests passing, build successful

Summary of Changes

  • 5 documentation files updated with comprehensive examples and migration guides
  • 3 schema files updated to use FilterCondition
  • 3 example files updated to modern syntax
  • Build fixed - all packages compile successfully

Migration Notes

  • Old array-based syntax: [['field', '=', 'value']] → New: { field: 'value' }
  • Old inequality: [['stage', '!=', 'won'], ['stage', '!=', 'lost']] → New: { stage: { $nin: ['won', 'lost'] } }
  • Old Report structure with filter + filterItems → New: single filter object with FilterCondition
  • Client SDK uses filters property (not where) for MongoDB-style filters
Original prompt

更新filter相关的文档,规范相关的代码相关的例子


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercel Bot commented Jan 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
spec Error Error Jan 21, 2026 5:55am

Request Review

… guide

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI and others added 2 commits January 21, 2026 05:18
…ters

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Update filter documentation and code examples Standardize filter syntax to MongoDB-style and complete documentation Jan 21, 2026
Copilot AI requested a review from hotlong January 21, 2026 05:22
@hotlong

hotlong commented Jan 21, 2026

Copy link
Copy Markdown
Collaborator

@copilot fix build

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>

Copilot AI commented Jan 21, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix build

Fixed in 9dc055e. The issue was using where instead of filters in the QueryOptions interface for the client SDK. Build now passes successfully.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jan 21, 2026
@hotlong
hotlong marked this pull request as ready for review January 21, 2026 06:32
Copilot AI review requested due to automatic review settings January 21, 2026 06:32
@hotlong
hotlong merged commit f7afab7 into main Jan 21, 2026
11 of 12 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request standardizes filter syntax across the ObjectStack spec from array-based filters to MongoDB-style FilterCondition objects. The change affects dashboard widgets, reports, and client SDK examples, providing a more intuitive and type-safe querying interface.

Changes:

  • Replaced old filter + filterItems structure in Reports with a single filter: FilterConditionSchema
  • Updated Dashboard widgets to use FilterConditionSchema instead of z.any()
  • Migrated all examples (dashboards, reports, client tests) from array-based syntax [['field', '=', 'value']] to MongoDB-style { field: value } or { field: { $op: value } }

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/spec/src/ui/report.zod.ts Replaced filter/filterItems with single FilterConditionSchema
packages/spec/src/ui/dashboard.zod.ts Changed filter from z.any() to FilterConditionSchema
packages/spec/src/ui/dashboard.test.ts Updated all 14 test filters to MongoDB-style syntax
packages/spec/json-schema/Report.json Generated JSON schema for new FilterCondition structure
packages/spec/json-schema/DashboardWidget.json Generated JSON schema with FilterCondition allOf pattern
packages/spec/json-schema/Dashboard.json Generated JSON schema with FilterCondition allOf pattern
examples/todo/src/client-test.ts Updated client example to use MongoDB-style filters with 'filters' property
examples/crm/src/ui/reports.ts Converted 6 report filters from old filterItems to FilterCondition
examples/crm/src/ui/dashboards.ts Converted 14 dashboard widget filters to MongoDB-style syntax
content/docs/references/ui/analytics/Report.mdx Updated documentation to reflect filter schema change

| **groupingsAcross** | `object[]` | optional | Column groupings (Matrix only) |
| **filter** | `string` | optional | Filter logic (e.g. "1 AND (2 OR 3)") |
| **filterItems** | `object[]` | optional | Filter criteria lines |
| **filter** | `any` | optional | Filter criteria |

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter type documentation should reference FilterCondition instead of any for clarity. This should be consistent with the schema change that uses FilterConditionSchema. Consider updating to: **filter** | FilterCondition | optional | Filter criteria

Suggested change
| **filter** | `any` | optional | Filter criteria |
| **filter** | `FilterCondition` | optional | Filter criteria |

Copilot uses AI. Check for mistakes.
xuyushun441-sys added a commit that referenced this pull request Jun 3, 2026
…on-GET (ADR §5.2) (#1568)

Removes the framework's hardcoded install-policy dead-end. The marketplace proxy
is a BROWSE mechanism: it forwards GET/HEAD reads and carries no credentialled
cloud auth. It must not pretend to own install *policy*.

Previously a non-GET marketplace request returned a 405
`marketplace_method_not_allowed` "install via cloud" — a dead-end the in-env
Install button hit (framework#1548). Now non-GET requests PASS THROUGH (`next()`)
so a host-supplied install route — mounted after this plugin via the
createObjectOSStack `extraPlugins` seam — can claim them; if none does, the app
returns its normal 404 instead of a misleading policy 405.

This is the "remove framework's hardcoded marketplace policy" half of ADR §5.2,
now that the cloud side has landed + deployed: ObjectStack Cloud owns install
(the `/cloud-connection/install` route + `sys_package.install_package` action +
the tiered cloud-connection gate — cloud PR #53). The framework keeps only the
neutral browse mechanism.

Test: 3 cases — non-GET passes through (not 405); install-local still passes
through; no-control-plane still 503s. Full src/cloud suite (40) stays green.

Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:ui size/m tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants