{{ message }}
[FIX] correct dry-run counts via planned-remap chaining - #20
Merged
Conversation
Dry-run under-counted every phase downstream of a fresh create: a phase that would create a parent recorded no target id, so dependent phases saw an empty remap and no-op'd (tool_instance/endpoint/pipeline/api_deployment showed 0 on a fresh target). Dry-run also counted would-creates as `skipped`, so totals didn't match the real run it's meant to predict. Fix centrally with a "reads run, writes stub" contract: - RemapTable.record_planned() mints a deterministic synthetic target id so dependent phases resolve the FK and plan-count without writing; is_planned() flags them; snapshot(hide_planned=) masks them in the report. - Every create-capable phase's dry-run branch now counts in the bucket a real run would (created/adopted) and records a planned remap. - custom_tool runs its source-side validations (frictionless check, source registry lookup) in dry-run so the plan reflects real create-vs-skip. - Phases doing live target lookups (tool_instance, workflow_endpoint, files) guard on is_planned to avoid querying a synthetic parent id. - Report shows a DRY RUN banner; synthetic ids never reach the wire. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ja9H1rnSXmPUgQtHm8TNS
Contributor
Address review: _create_fresh recorded the planned remap and _clone_one re-recorded the same value, while the adopt path only recorded in _clone_one. Drop the generic record in _clone_one; each sub-path (adopt / fresh / fresh-dry-run) now records once, since only it knows whether the target id is real or a planned synthetic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ja9H1rnSXmPUgQtHm8TNS
kirtimanmishrazipstack
approved these changes
Jun 18, 2026
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.

What
unstract clone --dry-runso phase counts faithfully predict a real run. Adds a planned-remap mechanism so dependent phases plan-count without writing.Why
tool_instance,workflow_endpoint,pipeline,api_deploymentreported 0 against a fresh target even though a real run creates them. It only looked right when the target already had the parents (the adopt path records a remap).skipped, so totals never matched the real run a dry-run exists to predict.How
RemapTable.record_planned()mints a deterministic (uuid5) synthetic target id so dependent phases resolve the FK and plan-count;is_planned()flags them;snapshot(hide_planned=)masks them in the report.created/adopted) and records a planned remap (group,adapter,connector,tag,custom_tool,files,workflow,tool_instance,workflow_endpoint,pipeline,api_deployment).custom_toolruns its source-side validations (frictionless-adapter check, source-registry lookup → plannedprompt_studio_registryremap) in dry-run so the plan reflects real create-vs-skip.tool_instance,workflow_endpoint,files) guard onis_planned— a synthetic parent id has no row on target, so they short-circuit instead of querying it (otherwiseworkflow_endpointwould count every endpoint asfailed).DRY RUNbanner; synthetic ids never reach the wire.Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
if dry_runbranch, except two safe reorders that leave the real-run sequence identical —workflow_endpointresolves the connector before the dry-run gate (real run: resolve → patch, same as before), andcustom_tool._create_freshmoves the dry-run gate after the source-side validations (real run: validate → import, same as before). New report/remap fields default off and only affect dry-run. Full suite (incl. all non-dry happy-path tests) is green.Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
uuidonly).Notes on Testing
uv run pytest→ 192 passed.RemapTableplanned mechanics (determinism,is_planned,hide_plannedmasking) and planned-parent guards fortool_instance/workflow_endpoint(the end-to-end chain that previously regressed to 0).Screenshots
Checklist
I have read and understood the Contribution Guidelines.
🤖 Generated with Claude Code
https://claude.ai/code/session_011ja9H1rnSXmPUgQtHm8TNS