refactor(apply): centralize plan result display and simplify grouped formatting#882
refactor(apply): centralize plan result display and simplify grouped formatting#882toiroakr wants to merge 3 commits intofeature/changeset-groupingfrom
Conversation
|
commit: |
Move all dry-run display logic out of individual plan functions into apply.ts printPlanResults. Plan functions now return data only, with no side effects. This removes the functionRegistryChanges parameter from planAuth, planPipeline, planExecutor, and planWorkflow, since function registry grouping is now handled at the display layer.
| // Print grouped sections | ||
| printGroupedDisplaySection("Executors", executorEntries); | ||
| printGroupedDisplaySection("Workflows", workflowEntries); | ||
| printGroupedDisplaySection("TailorDB resources", tailorDBEntries); | ||
| printGroupedDisplaySection("Pipeline resolvers", resolverEntries); | ||
| printGroupedDisplaySection("Auth", authEntries); |
There was a problem hiding this comment.
🟡 TailorDB services and Pipeline services no longer printed in dry-run output
The old code printed TailorDB service changes via serviceChangeSet.print() in planTailorDB and Pipeline service changes via serviceChangeSet.print() in planPipeline. Both calls were removed as part of the centralization, but the new printPlanResults function only prints grouped sections for "TailorDB resources" (types + gqlPermissions), "Pipeline resolvers", "Executors", "Workflows", and "Auth" — it never prints TailorDB service or Pipeline service changes. However, these change sets are still counted in the summary via summarizeChangeSets at apply.ts:393-394 and apply.ts:406. This means users will see a summary like "Plan: 3 to create..." where some counted changes (service creates/updates/deletes) are invisible in the output above the summary line.
Prompt for agents
In printPlanResults (apply.ts), the grouped display sections printed at lines 236-240 are missing TailorDB services and Pipeline services. The old code printed these via serviceChangeSet.print() inside planTailorDB (tailordb/index.ts, removed at old line 1009) and planPipeline (resolver.ts, removed at old line 141).
To fix, either:
1. Add printGroupedDisplaySection calls for TailorDB services and Pipeline services in printPlanResults, e.g. using formatChangeSetEntries(results.tailorDB.changeSet.service, ["service"]) and formatChangeSetEntries(results.pipeline.changeSet.service, ["service"]) and printing them under appropriate section headers, OR
2. Fold the service entries into the existing grouped sections (e.g. prepend TailorDB service entries to the TailorDB resources section, and Pipeline service entries to the Pipeline resolvers section).
The key requirement is that these change sets are already counted in the summary at summarizeChangeSets (lines 392-410), so they must also be visible in the printed output for consistency.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
formatChangeEntriesWithFunctionRegistrygeneric helper intogrouped-display.ts, eliminating duplicated format patterns across executor, resolver, auth hook, and workflow modulesplanExecutor,planPipeline,planAuth,planWorkflow,planTailorDB) intoapply.tsprintPlanResults— plan functions now return data only with no print side effectsfunctionRegistryChangesparameter fromplanAuth,planPipeline,planExecutor, andplanWorkflowsince function registry grouping is now handled at the display layerformatFunctionRegistryDisplayNamefor human-readable remaining function registry entries