Skip to content

fix(plugin-surrealdb): BETWEEN, REGEX and IS EMPTY filters become equality checks - #3218

Open
datlechin wants to merge 4 commits into
mainfrom
fix/surrealdb-filters-and-edges
Open

datlechin wants to merge 4 commits into
mainfrom
fix/surrealdb-filters-and-edges

Conversation

@datlechin

@datlechin datlechin commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • SurrealDB between, matches regex, is empty and raw filters ran as column = value equality checks, and is not empty showed only the empty rows. SurrealQueryBuilder.condition handled 16 operators and its default: arm wrote an equality for every other one, and the driver took the flattened tuple filter API, so BETWEEN arrived as "10,20" with no second bound and the raw row arrived as a column named __RAW__.
  • Editing in or out on a SurrealDB row together with another field saved the other field and dropped the in/out edit without a word, clearing it from the change queue and undo. SurrealStatementGenerator removed in, out and id from every UPDATE, and the driver relied on the PluginKit default generateRowWrites, which counts a row as written whenever any statement comes out.

Tests

All in TableProTests/Plugins/SurrealDBDriverTests.swift. Each one below fails without the fix (measured by putting the old code back and running the suites):

  • SurrealQueryBuilderTests: isEmpty, isNotEmpty, regex, rawRow, rawConditionThatReads, rawConditionThatWrites, rawConditionWithKeywordRecordId, refusedRawConditionThrowsOnTheServer, betweenFromAppEncoding, betweenWithCommaInBound, betweenWithPrependScalarBeforeTheSeparator, betweenFromJoinedValue, betweenFromJoinedValueWithPrependScalar, betweenWithOneBound, everyFilterBarOperatorIsMapped, unknownOperatorRefused, refusedFilterThrowsOnTheServer.
  • SurrealStatementGeneratorTests: edgeEndpointEditIsRefused(column:) for in and out, and immutableId.

eachWriteNamesItsRow and emptyUpdate pin the per-row write mapping and the host's ownership probe. All eleven SurrealDB suites pass: 84 of 84.

Docs

The docs rewrite branch covers the user-facing text. This PR also updates the Filters and Limitations sections of docs/databases/surrealdb.mdx to match the new behavior.

CI fixes

The Package Tests job failed in SyncRecordMapperTests.unknownWireValueFailsClosed: an unknown Safe Mode value decoded as Off instead of Confirm Writes. The sync mapper now uses the model's SafeModeLevel(wireValue:isReadOnly:) decoder. Unknown values require confirmation, legacy read-only restrictions remain, and renaming a connection preserves its unknown wire value. Added regression tests for read-only restrictions and renames.

Integrated main and fixed another inherited build error: SurrealValue.text(_:) called jsonText(length), but main had replaced that helper with a property. Restored the length-aware helper, keeping JSONTruncation for grid display and full JSON for exports. Existing long-structure export and grid-display tests cover both paths.

Resolved the SurrealDB statement-generator and test conflicts with main. The merge preserves this PR's refusal of edits to id, in, and out, together with main's refusal of writes carrying values shortened for display. Both sets of regression tests remain covered.

Follow-up validation on the final merged branch:

  • swift test --package-path Packages/TableProCore: PASS, all Swift Testing and XCTest runs passed.
  • All SurrealDB suites in an isolated SwiftPM harness: PASS. The harness compiles the actual plugin source files, the existing SurrealDBDriverTests.swift suites, and the host's TableFilter model where needed. It adapts imports for the separate test module; it does not run the app's Xcode test host.
  • SwiftLint on changed Swift files: zero violations.
  • Project generation and git diff --check: PASS.
  • verify.sh plugins (AllPlugins): PASS on the merged fix(plugin-surrealdb): BETWEEN, REGEX and IS EMPTY filters become equality checks #3218 branch, including the common SurrealDB helper fix.
  • The lint helper's separate documentation check reports four existing stale paths in CLAUDE.md and the verification guide, which this follow-up leaves unchanged.
  • Reviewed the final diff directly.
  • GitHub CI reruns pending after push.

@mintlify

mintlify Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
TablePro 🟢 Ready View Preview Sep 30, 2026, 7:24 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

This branch was successfully deployed

1 active (outdated) deployment
staging - docs — 3e42e739 Deployed Sep 30, 2026 by mintlify[bot]
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