Skip to content

refactor: drop compound databaseId:tableId resourceId#176

Merged
abnegate merged 8 commits into
mainfrom
feat/drop-compound-resource-id
Jul 20, 2026
Merged

refactor: drop compound databaseId:tableId resourceId#176
abnegate merged 8 commits into
mainfrom
feat/drop-compound-resource-id

Conversation

@abnegate

@abnegate abnegate commented May 1, 2026

Copy link
Copy Markdown
Member

Summary

  • Preserves the released 1.x Target, Source, Destination, and Transfer::run() contracts while adding runWithResourceSelector() as the explicit database-and-child selector path.
  • Preserves the released positional and named CSV/JSON constructor APIs while adding fromResourceIds() factories for separate database and table IDs.
  • Keeps legacy compound databaseId:tableId selectors working and treats IDs passed through the new APIs as opaque, including IDs containing colons.
  • Applies child scoping to TablesDB, DocumentsDB, and VectorsDB Appwrite sources while preserving external override dispatch and restoring selector state after both successful and failed runs.
  • Preserves the Appwrite destination provisioning, ready-status, and orphan-cleanup lifecycle, and gates status writes on the actual destination metadata schema.
  • Adds regression coverage for released API reflection contracts, downstream subclass compatibility, selector dispatch/state restoration, legacy and explicit selection, adapter factories, colon-containing IDs, and destination status lifecycle behavior.

Test plan

  • composer format
  • composer lint
  • composer check
  • API reflection compatibility tests for exact released method and constructor signatures
  • Focused compatibility/lifecycle suite (36 tests, 181 assertions)
  • Full host Unit suite (62 tests, 379 assertions)
  • Local Docker E2E rerun (environment blocked: Docker internal storage rejected fresh PostgreSQL pg_wal initialization with No space left on device after scoped stack/cache cleanup)
  • GitHub Run Test Suite on exact head 7ed62ca2e2279bf30fa2018655e045c59bb5bc3d

Linked

@greptile-apps

greptile-apps Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR keeps the released migration APIs while adding explicit resource selection. The main changes are:

  • New runWithResourceSelector() paths for transfers, sources, and destinations.
  • Legacy compound database and table selectors remain supported.
  • CSV and JSON adapters get factories for separate database and table IDs.
  • Appwrite sources apply child scoping for database-family resources.
  • Appwrite destinations check metadata support before writing database status.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • Selector state is restored after successful and failed runs.
  • The released run() entrypoints remain available while the new explicit selector path carries parent and child IDs separately.

Important Files Changed

Filename Overview
src/Migration/Transfer.php Adds explicit selector dispatch while preserving the existing transfer entrypoint.
src/Migration/Destination.php Stores selector state during explicit destination runs and restores it afterward.
src/Migration/Source.php Adds explicit selector support and restores root scope state after each run.
src/Migration/Sources/Appwrite.php Handles legacy compound selectors and explicit child scoping for Appwrite database resources.
src/Migration/ResourceSelector.php Adds a small value object for resolving resource and parent scope fields.
src/Migration/Destinations/Appwrite.php Checks destination metadata before writing database lifecycle status.
src/Migration/Sources/CSV.php Adds a factory for separate database and table IDs while keeping legacy parsing.
src/Migration/Sources/JSON.php Adds a factory for separate database and table IDs while keeping legacy parsing.
src/Migration/Destinations/CSV.php Adds a destination factory for separate database and table IDs.
src/Migration/Destinations/JSON.php Adds a destination factory for separate database and table IDs.

Reviews (7): Last reviewed commit: "(refactor): align migration resource sel..." | Re-trigger Greptile

Comment thread src/Migration/Target.php Outdated
Copilot AI review requested due to automatic review settings June 10, 2026 05:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

abnegate and others added 3 commits July 17, 2026 22:11
The CSV/JSON sources and destinations took a single composite
"databaseId:tableId" string and split it on ':' internally. The Appwrite
source did the same trick on `rootResourceId` to scope a transfer to a
specific collection within a database. That mixed two identifiers in
one slot, broke queryability for callers, and forced consumers to
recompose the colon-form at the boundary.

This change replaces the compound with explicit fields:

- CSV/JSON Source/Destination constructors now take `string $databaseId,
  string $tableId` directly. No more `explode(':', $resourceId)`.
- Target/Source/Destination/Transfer::run gain a new optional
  `$rootResourceChildId` parameter that, for database roots, scopes the
  transfer to a specific table/collection inside the root database.
  `$rootResourceId` keeps its existing semantics — it always matches
  `$rootResourceType` (a top-level resource).
- Sources/Appwrite no longer inspects `rootResourceId` for ':' or
  splits it; it reads `$this->rootResourceChildId` when the caller wants
  per-collection filtering.

Tests updated to call the new constructor signatures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The abstract Target::run() omitted $rootResourceType, so its 4th
positional parameter was $rootResourceChildId while both concrete
overrides (Source::run, Destination::run) take $rootResourceType
there. Callers typed against Target passing four positional args
would silently route the child ID into the resource type. All three
signatures now match exactly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@abnegate
abnegate force-pushed the feat/drop-compound-resource-id branch from 183f0e2 to 4abc29b Compare July 17, 2026 10:18
@abnegate
abnegate merged commit b531ea4 into main Jul 20, 2026
4 checks passed
@abnegate
abnegate deleted the feat/drop-compound-resource-id branch July 20, 2026 10:00
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.

2 participants