refactor(core): expose shared application operations - #156
Merged
Conversation
Review of eqrm#156 found that the extraction was faithful, but two new behaviours regressed what the CLI tells an operator: Prepared operations carried a 5-minute TTL while the confirmation prompt blocks on stdin indefinitely, so reading a long diff for six minutes ended in `OPERATION_EXPIRED` with nothing applied — and, for destroy, with the backup already on disk and the target key already typed. The store now accepts "no expiry" and both CLI commands use it; the state fingerprint, not a timer, is what guards against a stale proposal. Diagnostics moved from inline printing to arrays drained after the operation resolved, which discards them exactly when they matter — when it throws. They are now emitted through the existing OperationObserver as they happen, and the commands print them live: - destroy records every completed delete before a later `save()` or guard throw can erase it (the run is irreversible); - `Backup written:` prints when the backup lands, not on success; - adopt warnings survive a `--strict-rulesets` abort partway through a subtree; - the `ct refresh --all` fan-out caution arrives before membership is recomputed, and each group is reported as it goes. Also: - `ct auth status` no longer rewrites every environment-profile error into "Not logged in"; only an unresolvable host does, via a typed MissingHostError. - `ct auth login` reports a stored, verified token as success when only the `/info` version check fails, instead of pure failure with credentials in the keychain. - `PLAN_INCOMPLETE` carries the catalog path and plan warnings so apply can still print them on the abort path. - destroy's local error formatter is gone; `formatError` moved to `src/api/format.ts` so the application layer and `src/ui.ts` share one renderer, keeping the eqrm#50 body truncation and the HTTP status on adopt's member-field warning. - the architecture rule now sees side-effect and dynamic imports, and pins the transitive paths from the application layer to the terminal presenter so the set can only shrink. Handbuch pages re-signed after re-reading them against the changed sources. Claude-Session: https://claude.ai/code/session_01RDZeavzUpPyvQp3EYdEDbR
Resolves the overlap with the Markdown plan report (eqrm#155), which landed on main while this branch was open: - src/commands/plan.ts now drives every projection (text/JSON/Markdown, --output-base, --locale) off the single `runPlan` application operation instead of re-planning inline. - The plan operation carries `buildWarnings` so the Markdown report can include the registry/portability warnings the builder writes to stderr — a report file is not a terminal, so it has to be handed them explicitly. - Handbuch source lists follow `adopt-group.ts` into src/application/operations, and both pages are re-signed. Claude-Session: https://claude.ai/code/session_01RDZeavzUpPyvQp3EYdEDbR
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.
Summary
Scope
This is the reusable Core/Application preparation for symmetric projections. It deliberately contains:
The existing CLI remains one projection of the same operations. A server or another UI adapter can be reviewed separately later.
The branch is based on v3.6.1 / #154. During the rebase, the current group-member-field re-adoption behavior was retained in
runAdoptGroups, including the owner-local live field identity map.Verification