Skip to content

refactor: drop compound databaseId:tableId resourceId#176

Open
abnegate wants to merge 7 commits into
mainfrom
feat/drop-compound-resource-id
Open

refactor: drop compound databaseId:tableId resourceId#176
abnegate wants to merge 7 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 replaces compound database/table selectors with explicit root and child selector handling. The main changes are:

  • Explicit selector forwarding through the transfer, destination, and source run pipeline.
  • Appwrite source scoping for TablesDB, DocumentsDB, and VectorsDB children.
  • CSV and JSON factories for separate database and table IDs.
  • Appwrite destination status writes gated by destination metadata support.
  • Tests for selector propagation, adapter constructors, scoped transfers, and database status handling.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
src/Migration/Transfer.php Adds explicit selector state and forwards separate root and child IDs into the destination run path.
src/Migration/Destination.php Adds selector-aware dispatch from destinations to sources while restoring selector state after each run.
src/Migration/Source.php Restores root selector fields after exports and adds a base explicit-selector entrypoint.
src/Migration/Sources/Appwrite.php Adds Appwrite-specific child selector handling and updates database-family scoping logic.
src/Migration/Destinations/Appwrite.php Checks destination metadata before writing database lifecycle status fields.
src/Migration/Sources/CSV.php Adds a factory for separate CSV database and table IDs while keeping legacy parsing.
src/Migration/Sources/JSON.php Adds a factory for separate JSON database and table IDs while keeping legacy parsing.
src/Migration/Destinations/CSV.php Adds a destination factory for separate CSV database and table IDs.
src/Migration/Destinations/JSON.php Adds a destination factory for separate JSON database and table IDs.

Reviews (6): Last reviewed commit: "fix: preserve exact adapter constructor ..." | 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
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