refactor: extract verified-identical cloud-substrate machinery into stackless-cloud#7
Merged
Merged
Conversation
Extend stackless-cloud with the next batch of verified-identical cloud
substrate machinery, following the crate's existing rule: shared helpers
return neutral data each substrate maps to its own fault, so per-provider
error codes stay distinct (ARCHITECTURE.md §2).
- health::poll — the health-gate polling loop (was byte-identical across
all four cloud substrates; only the fault raised differed).
- spend::line — the spend line, parameterized by provider/cap/dashboard.
- prepare::{resolve_prepare_env, run_service_prepare} — operator-side
prepare env resolution + spawn, with the namespace supplied by the
caller (substrates differ in what it carries).
Adds reqwest/tokio/stackless-stripe-projects deps + unit tests
(wiremock health, prepare env resolution).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the byte-identical health-gate loop and spend line in all four
cloud substrates with stackless_cloud::{health,spend}, and route prepare
through stackless_cloud::prepare::run_service_prepare on Render, Vercel,
and Netlify. Each substrate maps the neutral helper result to its own
fault, so its stable error codes/remediation are unchanged (§2). The
orphaned per-crate prepare.rs wrappers are removed.
Fly is intentionally left on its own resolved_env path for prepare: it
shares that helper with start_service and maps env-resolution failures
to ConfigInvalid (not PrepareFailed), so it only adopts the shared
health/spend helpers to avoid changing an agent-facing error code.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…drift The Workers, Workers AI, and Browser Run resources provision the same account-level Workers enablement and share one output envelope; hoist it into WORKERS_FAMILY_OUTPUT_FIELDS/_OUTPUTS consts (the three stay distinct types). Add a hermetic test asserting Hostable::OUTPUTS equals the names column of CatalogResource::OUTPUT_FIELDS for every catalog resource, so the co-located redundancy can't silently drift. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
After implementing every Stripe-Projects-backed provider, we asked what's common across them so adding the next one is cheap. The answer split by family:
Hostable+CatalogResource+ blanketProviderOps+ registry). Only two small dups remained.stackless-cloudalready documents the rule for fixing it — only verified-identical machinery, returned as neutral data each substrate maps to its own fault (§2). This PR extends that pattern rather than inventing one.Changes
stackless-cloud— three new shared helpers (628dc87)health::poll(...)— the health-gate loop (was byte-identical ×4).spend::line(...)— the spend line, parameterized by provider/cap/dashboard.prepare::{resolve_prepare_env, run_service_prepare}— prepare env resolution + the operator-side spawn; the caller supplies the namespace.Substrate migrations (
3d4c790)health::poll+spend::line; Render/Vercel/Netlify also route prepare throughrun_service_prepare. Each maps the neutral result to its own fault, so stable error codes/remediation are unchanged. The three orphaned per-crateprepare.rswrappers are deleted.resolved_envprepare path — it shares that helper withstart_serviceand maps env-resolution failures toConfigInvalid(notPrepareFailed). Forcing it through the shared helper would change an agent-facing error code, so Fly only adopts health/spend. (Happy to unify it as a follow-up if we'd rather have one prepare path everywhere.)Integration cleanups (
0fb8ea3)WORKERS_FAMILY_OUTPUT_FIELDS/_OUTPUTS.Hostable::OUTPUTS == names(OUTPUT_FIELDS)for everyCatalogResource, so the co-located redundancy can't drift.Net
~490 lines of duplicated substrate code removed; two new shared modules added. Each substrate
lib.rssheds ~110 lines.Verification
cargo test --workspace— all green, 0 failures.cargo clippy --workspace --all-targets— clean, no warnings.health::poll(wiremock success + timeout),resolve_prepare_env(interp + secret injection), and thecatalog_outputs_match_output_fieldsdrift guard.fixtures/smoke/<substrate>) is unchanged behaviorally.🤖 Generated with Claude Code