Skip to content

refactor(core): expose shared application operations - #156

Merged
2000game merged 16 commits into
eqrm:mainfrom
bwl21:refactor/application-operations
Aug 26, 2026
Merged

refactor(core): expose shared application operations#156
2000game merged 16 commits into
eqrm:mainfrom
bwl21:refactor/application-operations

Conversation

@bwl21

@bwl21 bwl21 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • introduce a shared application boundary for plan, prepared apply/destroy, coverage, refresh, state, adoption, and authentication operations
  • keep Commander commands as thin CLI projections over those operations
  • return structured values, warnings, project context, and prepared-operation identities for non-CLI adapters
  • serialize state mutations through a shared lock and preserve protected-environment confirmation semantics
  • add architecture tests that prevent application code from depending on Commander or server/UI adapters

Scope

This is the reusable Core/Application preparation for symmetric projections. It deliberately contains:

  • no HTTP server
  • no browser routes
  • no Vue application
  • no GUI assets or dependencies

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

  • 1046 tests passed, 5 skipped
  • 105 focused application, architecture, adopt, member-field, and destroy tests passed
  • typecheck
  • lint
  • build
  • tracked-file Prettier check
  • handbook staleness check

bwl21 and others added 16 commits August 26, 2026 14:40
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
@2000game
2000game merged commit 759abec into eqrm:main Aug 26, 2026
3 checks passed
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