Skip to content

feat: add transactional plan and apply engine#5

Merged
OgeonX-Ai merged 5 commits into
mainfrom
gsd/phase-3-transactional-plan-apply
Jun 12, 2026
Merged

feat: add transactional plan and apply engine#5
OgeonX-Ai merged 5 commits into
mainfrom
gsd/phase-3-transactional-plan-apply

Conversation

@OgeonX-Ai

Copy link
Copy Markdown
Contributor

Summary

  • add deterministic preview-first plans with integrity validation and idempotent skips
  • add correlated atomic journals, bounded retry, persisted resume, and rollback guidance
  • route setup, upgrade, and repair through one shared engine
  • fail closed for unsafe repository state and add four public CAS repos to the full golden-path profile
  • complete Phase 3 GSD verification and requirement traceability

Validation

  • .\Invoke-Quality.ps1: 46/46 Pester tests passed; PSScriptAnalyzer, contracts, governance passed
  • Phase 3 focused tests: 14/14 passed
  • git diff --check

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb538bd7f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
}

$sortedOperations = @($operations.ToArray() | Sort-Object { $_.id })

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install prerequisites before npm-backed tools

On a clean workstation where Node/npm are absent, sorting every operation by ID places tool:claude and tool:codex before tool:node and tool:npm. Apply therefore invokes npm install -g ... before npm exists, fails on the first npm-backed tool, and never reaches the Node installation. Preserve dependency-aware/manifest ordering or explicitly model tool dependencies.

Useful? React with 👍 / 👎.

Comment on lines +1035 to +1038
$installer = @($resource.definition.installers | Where-Object kind -ne "manual" | Select-Object -First 1)
$satisfied = $actual.Count -gt 0 -and $actual[0].status -eq "installed"
$command = if ($installer.Count -gt 0) { "$($installer[0].kind) install $($installer[0].id)" } else { "manual" }
$source = if ($installer.Count -gt 0) { "$($installer[0].kind):$($installer[0].id)" } else { "manual" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Do not schedule manual-only tools as executable updates

When a required tool has no non-manual installer, this creates an update operation with source manual; the core/full profiles include npm with no installers and wsl with only a manual installer. If either is missing during inventory, apply reaches the executor's unsupported-adapter error and the setup can never complete, even if installing Node earlier made npm available after planning. Manual tools need a non-failing guidance/skip operation or must be re-inventoried before execution.

Useful? React with 👍 / 👎.

Comment on lines +1052 to +1053
$satisfied = $actual.Count -gt 0 -and $actual[0].status -eq "synchronized"
$present = $actual.Count -gt 0 -and $actual[0].status -in @("present", "behind", "synchronized")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fetch before marking repositories synchronized

For an existing clean checkout whose cached origin/<branch> still equals HEAD but whose actual remote has advanced, inventory reports synchronized because Get-CasRepositorySafetyStatus only compares against the local remote-tracking ref. This line then emits a skip, so upgrade never runs the executor's fetch and permanently misses upstream changes until something else fetches them.

Useful? React with 👍 / 👎.

Comment on lines +1233 to +1235
if ($Operation.action -eq "create") {
& git clone $Operation.source $Operation.target
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Create repository parent directories before cloning

During setup -Apply against a fresh root, the apply engine creates only the config, state, and log directories; it never creates <root>/<reposRoot>. The first repository create operation therefore asks Git to clone into a target whose parent directory does not exist, causing fresh-workstation setup to fail before any repository is installed.

Useful? React with 👍 / 👎.

Comment on lines +1033 to +1034
switch ($resource.category) {
"tools" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include required client configuration in the plan

The resolved desired state contains tools, repos, services, clients, skills, and workspaces, but this switch handles only tools and repos and silently drops every other category. Because setup.ps1 and upgrade.ps1 now exclusively use this operation engine, -Apply no longer calls New-CasClientConfigs, so it can report success without generating the required MCP client or runtime configuration.

Useful? React with 👍 / 👎.

@OgeonX-Ai OgeonX-Ai enabled auto-merge June 12, 2026 17:48
@OgeonX-Ai OgeonX-Ai merged commit 6417871 into main Jun 12, 2026
1 check passed
@OgeonX-Ai OgeonX-Ai deleted the gsd/phase-3-transactional-plan-apply branch June 12, 2026 17:49
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