Skip to content

feat!: cloudfall-engine runs on treaty - #4

Merged
romamo merged 2 commits into
mainfrom
treaty-engine
Sep 30, 2026
Merged

romamo merged 2 commits into
mainfrom
treaty-engine

Conversation

@romamo

@romamo romamo commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Moves cloudfall-engine's four commands (inventory render, artifact build, playbook list, playbook run) from argparse to treaty 1.0.0rc4, the first Cloudfall CLI to switch. The cloudfall CLI is untouched.

  • Every command answers one JSON envelope on stdout, errors included (they used to go to stderr in their own shape)

  • cloudfall-engine manifest describes every command, flag, and exit code

  • Engine failures exit with their own codes, the old snake_case code kept in error.context.code:

    Exit Code
    79 PROJECT_INVALID
    80 CONFIG_INVALID
    81 ARTIFACT_BUILD_FAILED
    82 PLAYBOOK_FAILED
  • A missing playbook, inventory, or role directory, a malformed git ref, and a malformed component id exit 2 before anything runs

  • Ansible's play log streams live to stderr; stdout holds only the envelope

  • artifact build and playbook run report their effect (created, updated, would_update, noop)

  • Relative paths (--output tmp/…, --output-dir) still land in the project, now by joining onto the resolved directory instead of chdir

Breaking

Known gaps

treaty audit passes 54 of 58 rules. git and ansible-playbook still run through subprocess rather than ctx.run, because ctx.run can't stream a child's output live (romamo/treaty#61) and its LC_ALL=C stops Ansible from starting (romamo/treaty#62). Other treaty findings from the port are filed as romamo/treaty#64 to #70.

Test plan

  • uv run pytest: 442 passed
  • uv run ruff check .: clean
  • uv run mypy: only the 8 existing sdk/tests/test_lifecycle.py errors from main
  • CI's render step and the Ansible --syntax-check loop, unchanged
  • Live playbook run against localhost in dry-run and live mode, and a failing run against unreachable hosts (exit 82)
  • SIGTERM mid-run: CANCELLED envelope, exit 143, and the Ansible process and its remote task stop

🤖 Generated with Claude Code

romamo and others added 2 commits September 30, 2026 10:20
The engine's four commands move from argparse to treaty 1.0.0rc4, the
first Cloudfall CLI to do so. Every command answers one JSON envelope on
stdout, errors included, and `cloudfall-engine manifest` describes each
command, flag, and exit code. Engine failures exit with their own codes:
79 PROJECT_INVALID, 80 CONFIG_INVALID, 81 ARTIFACT_BUILD_FAILED, 82
PLAYBOOK_FAILED, with the old snake_case code in error.context.code.

A missing playbook, inventory, or role directory, a malformed git ref,
and a malformed component id exit 2 before anything runs. Relative paths
still land in the project, now joined onto the resolved directory rather
than through chdir. Ansible's play log streams to stderr, so stdout holds
only the envelope; it still runs through subprocess, because ctx.run can
neither stream nor run Ansible under its C locale (romamo/treaty#61, #62).

Breaking: `playbook run --check` is `--dry-run`, since treaty recognizes
a dry run only by that name (romamo/treaty#63), and `inventory render`
puts the inventory under data.inventory; the --output file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
_cli_lifecycle returned dict[str, object], so every payload["data"][...]
in its callers failed mypy with "object is not indexable". Parsed JSON is
Any-shaped; typing it so makes CI's type-check pass again, which has
failed on main since these tests were written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@romamo
romamo merged commit dae5571 into main Sep 30, 2026
1 check passed
@romamo
romamo deleted the treaty-engine branch September 30, 2026 07:33
@shipmill-romamo shipmill-romamo Bot added this to the 0.6.0 milestone Oct 8, 2026
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.

1 participant