Skip to content

fix(validate): warn when where-clause operators omit the leading $ (#546) - #551

Open
theroimasters1-dev wants to merge 1 commit into
sandtable-ai:mainfrom
theroimasters1-dev:fix-bare-operator-warnings-546
Open

theroimasters1-dev wants to merge 1 commit into
sandtable-ai:mainfrom
theroimasters1-dev:fix-bare-operator-warnings-546

Conversation

@theroimasters1-dev

Copy link
Copy Markdown

Closes #546

What changed for users

validate now warns (⚠) when a where-clause object has no $ key and all of its keys are known operator names written without the leading $, e.g.:

never:
  when:
    rate:
      gt: 2000

Before this change, sandtable treated { gt: 2000 } as an exact object equality check rather than an operator condition, so the rule silently never fired. validate now prints:

⚠ invariants.rule.never.when.rate: { gt } has no $, so it's compared by equality and never read as an operator. Did you mean $gt?
  • Works across all where-clause locations (invariants, policies, scenarios, milestones, and $contains elements).
  • Emits a warning without changing the exit code (with or without --strict), keeping existing workflows non-breaking.
  • Normal nested objects containing regular field keys (e.g. address: { zip: "94105" } or { gt: 1, zip: 2 }) produce no warning.

How you verified it

  • npx vitest run test/operators.test.ts (all 70 tests passing, covering single & multi-bare operators, recursion, $contains elements, and CLI YAML output)

  • npm run typecheck (passed with 0 errors)

  • npm run build (clean compilation)

  • node scripts/changelog.mjs check (CHANGELOG.md ok)

  • node scripts/sync-version.mjs --check (npm 1.4.0 <-> PyPI 1.4.0)

  • npm run smoke (all 52 freight and 25 clinic tasks passed with 100% pass^1 rate)

  • npm run check passes

  • An entry under ## [Unreleased] in CHANGELOG.md, or the no-changelog label when no user can notice the change

  • The docs, the plugin skills and the README follow any command, flag or spec change (AGENTS.md, "Keep docs, plugin and README in sync")

@theroimasters1-dev
theroimasters1-dev requested a review from a team as a code owner November 9, 2026 20:05

This branch has not been deployed

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

Labels

None yet

Projects

None yet

1 participant