Title: Keep the rollout's host order in the rendered inventory file (#465) by shipmill-romamo[bot] · Pull Request #467 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Keep the rollout's host order in the rendered inventory file (#465) by shipmill-romamo[bot] · Pull Request #467 · cloudfall-dev/cloudfall
X Title: Keep the rollout's host order in the rendered inventory file (#465) by shipmill-romamo[bot] · Pull Request #467 · cloudfall-dev/cloudfall
Description: Plan Serves: quality bar Files: engine/src/cloudfall_engine/cli.py, engine/tests/test_ansible_inventory.py, changelog.d/465-render-keeps-host-order.md Order: the failing test first (a project whose MariaDB primary sorts after its replica, and an Elasticsearch cluster whose home sorts last, rendered with --output; the file's cloudfall_servers hosts and services.yml's play order put the home first), then render sorts every mapping but cloudfall_servers.hosts and writes and answers that same document, then the changelog fragment Proof: the new tests in engine/tests/test_ansible_inventory.py fail on main and pass after; the S-006-12, S-012-2 and S-019-2 byte-identical golden tests still pass unchanged Summary _rollout_order puts each multi-node Elasticsearch cluster's home and each MariaDB primary's server first in cloudfall_servers, so a serial: 1 play converges them first (S-012, S-019). cloudfall-engine inventory render --output then wrote the file with json.dumps(..., sort_keys=True), which sorted the hosts by name, and every converge runs from that file. render now sorts every mapping's keys itself except the cloudfall_servers hosts mapping, which keeps the render's rollout order, and writes without sort_keys. Everything else in the file stays sorted, so a project whose homes already sort first (the examples included) renders the same bytes as before: the golden file is unchanged. Other writers checked: render is the only writer of the converge inventory (the SDK's lifecycle runs cloudfall-engine inventory render --output, nothing in sdk/ re-serialises it). sdk/src/cloudfall/observe.py's write_overlay also uses sort_keys=True, but that overlay feeds the read-only inspect run, where host order doesn't matter, so it is left alone. The stdout answer carries the same inventory, but treaty's envelope (treaty/_envelope.py, serialize) dumps every answer with sort_keys=True, so its hosts stay sorted by name there; the test checks the answer equals the file as data, and only the file keeps the order. Test plan New test_engine_cli_writes_the_hosts_home_first, parametrised over a MariaDB primary on h2 with its replica on h1, and an Elasticsearch cluster of h1 and h2 homed on h2: the written file lists h2, h1, and Ansible's InventoryManager gives services.yml's play (serial: 1) its hosts as h2, h1. Both cases failed on main (['h1', 'h2']) and pass now uv run pytest on engine/tests/test_ansible_inventory.py, test_examples_render_unchanged.py, test_s019_mariadb_render.py, test_s012_elasticsearch_render.py, test_unsafe_config_values.py, test_services_passwords.py, test_s012_elasticsearch_cluster_role.py, test_s019_mariadb_replication_role.py, test_release_command.py, test_component_hosts.py: 175 passed, golden files untouched uv run ruff check . and uv run mypy clean The full suite is left to CI Fixes #465 🤖 Generated with Claude Code
Open Graph Description: Plan Serves: quality bar Files: engine/src/cloudfall_engine/cli.py, engine/tests/test_ansible_inventory.py, changelog.d/465-render-keeps-host-order.md Order: the failing test first (a project whos...
X Description: Plan Serves: quality bar Files: engine/src/cloudfall_engine/cli.py, engine/tests/test_ansible_inventory.py, changelog.d/465-render-keeps-host-order.md Order: the failing test first (a project whos...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/467
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:9f729f09-8421-6ba0-f95e-26a62f1de189 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9F18:3C6CAF:EBB765:1426ECE:6B055794 |
| html-safe-nonce | 25695d7438aed1c9069b99a7547277024426d0f0719da21ce8731f02a3053528 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RjE4OjNDNkNBRjpFQkI3NjU6MTQyNkVDRTo2QjA1NTc5NCIsInZpc2l0b3JfaWQiOiI4NDM5NTE1ODc4NzY3NTUzNDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3b3800934cc7f9c91eba632cb2c2b275e897d8da64af42eba019c97d916be54b |
| hovercard-subject-tag | pull_request:5347881426 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/467/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Plan Serves: quality bar Files: engine/src/cloudfall_engine/cli.py, engine/tests/test_ansible_inventory.py, changelog.d/465-render-keeps-host-order.md Order: the failing test first (a project whos... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width