Conversation
…-schemas # Conflicts: # CHANGELOG.md
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
…-schemas # Conflicts: # CHANGELOG.md
# Conflicts: # Plugins/SurrealDBDriverPlugin/SurrealValue+Display.swift
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found while implementing #3167 (PR #3189).
What was wrong
The Favorites tab looked each starred table up in one list:
SchemaService.tables(for:), the flat table list of the loaded scope, handed down bySidebarView. A favorite that list did not hold was dropped by acompactMap.fetchTables()resolves to the driver's current schema. A favorite in any other schema of the same database never listed.What changed
FavoriteTableResolver(pure) decides each favorite from every table list loaded for the browsed database:FavoriteTableCatalogReaderbuilds that catalog fromSchemaService(the flat list and per-schema lists) andDatabaseTreeMetadataService(tree table lists and the all-schema listing). It ignoresSchemaServicewhile its loaded database differs from the browsed one, so a database switch in flight cannot vouch for or hide anything.DatabaseTreeMetadataService.loadTableson schema-grouped engines,SchemaService.loadSchemaObjectson hierarchical ones, the same lists the tree expands into. Nothing reloads on staleness, so the per-COMMIT refetchSchemaServiceremoved stays removed.openTableTab(name, schema:, database:)as Open Quickly does, so the browsed schema never moves. A favorite that no current list vouches for has its schema's list loaded first; if its kind still cannot be learned, the tab opens read-only.default). The key is now built in one place,ERDiagramViewModel.schemaKey(databaseName:schema:).TableInfo.schemaplus the browsed database. Row ids and the persisted selection come from the entry.SidebarSearch.matchesObject, as Recents do: plain text matches names,sales.lists one schema,sales.ordnarrows inside it.favoriteTableContextMenu(_:); the outline owns the menu throughFavoritesMenuSpec.docs/features/favorites.mdx, Table favorites.Tests and verification
FavoriteTableResolverTests(new, 20): cross-schema verified row with caption, hierarchical per-schema list, unlisted schema kept unverified, current list hides, current list beats a stale listing that still holds the table, stale list keeps and lends its type, other database excluded, same name in two schemas, sort order, system schema absent from the listing versus a current per-schema list, flat engine, plain and qualified search, schemas needing load, only verified writable kinds open editable.FavoriteTableCatalogReaderTests(new, 10) over a seededSchemaService: a hierarchical favorite with an empty flat list and a loaded per-schema list is listed; missing is hidden; unloaded schema requested, loaded one not; nothing requested while disconnected; database switch in flight refused; schema-grouped flat list covers only the browsed schema; flat engine decides the whole database; open carries the verified kind; unlearnable and stale kinds open read-only. Four of these fail with the catalog reduced to today's flat-list lookup (hierarchicalFavoriteIsListed,unloadedSchemaIsRequested,databaseSwitchInFlightIsRefused,bySchemaFlatListCoversTheBrowsedSchema).FavoritesEmptyStateTests,FavoritesMenuSpecTests,FavoritesOutlineSelectionTests,ERDiagramSchemaKeyTestsupdated and extended.StringCatalogIntegrityTests,EllipsisConventionTests,SidebarScopeControlTestspass with the three new strings added to the catalog.No UI test. A smoke test on the SQLite sample cannot fail before this fix (SQLite's flat list already holds every table), cross-schema needs a server, and starring a table writes through
FavoriteTablesStorage, which defaults toUserDefaults.standardand so escapes the UI-test sandbox into the machine's real defaults. The screenshot on the page shows favorite databases only, so it still matches.Screenshots
None. The change shows only on engines that group tables by schema, and staging favorites for a shot means starring tables in the app, which
FavoriteTablesStoragewrites to the real defaults domain even under the UI-test sandbox, so it would land in this machine's own favorites and sync. The SQLite sample lists the same rows before and after. The docs page's only screenshot shows favorite databases, so it still matches.Review
Codex review (
review-mumrl1bw-iszv7j), fixed:isViewfalse and no kind, so a view could open as an editable table. Opening now loads the schema's list first and falls back to read-only..SALESthat the diagram cannot read back, so it drew the browsed schema. The item is left out wherever the key cannot name the schema, and the key has one builder.Codex adversarial review (
review-mumto9by-nozam5):TableInfo.schema, and every per-schema fetch goes throughPluginDriverAdapter.mapPluginTable, which fillsschema: table.schema ?? schemaFallbackwith the schema it fetched. A nil-schema entry on those engines is not produced; if one existed it would show unverified and open by name, where today it is dropped.Second Codex review (
review-mumuf9jo-lweojy):isTearingDownon a weak coordinator after the await.SchemaService.loadSchemaObjectsfor hierarchical engines is deliberate. It fills the per-schema lists the tree expands into, so the work is shared rather than repeated; it runs once per schema no source has listed and never again on staleness; SchemaService has no tables-only per-schema load to share.Not fixed
list_favorite_tableslists every entry.openTableTab(database:)already opens across databases without a switch, so a grouped all-databases view is possible later; it needs table lists loaded for those databases.SchemaServiceand in the tree lists with no signal that it is stale, so Favorites treats it as current, exactly as the Tables list and the tree display it. A durable freshness signal belongs in those services and would fix all three readers at once.CI fixes
The failed Package Tests job was
SyncRecordMapperTests.unknownWireValueFailsClosed: the sync mapper's duplicate decoder turned an unknown Safe Mode value into Off. It now usesSafeModeLevel(wireValue:isReadOnly:), requiring confirmation while retaining legacy read-only restrictions. Added regressions for unknown read-only values and renames that preserve an unknown wire value.Integrated
main, preserving both sets of changelog entries. Fixed the confirmed SurrealDB compile error introduced by the integration:textcalled a length-taking JSON helper that had become a property. Restored that helper, retaining valid display truncation and complete export text.Validation for these fixes:
swift test --package-path Packages/TableProCore: passed (1,197 Swift Testing tests plus XCTest).TableProApp/rust-dameng,Contents/MacOS,Contents/Helpers, and/Applications/Xcode-beta.app.GitHub Actions rerun after pushing these fixes.