Repository navigation
test: assert every provider adapter against one conformance suite - #193
Conversation
054d4b3 to
ab27443
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 054d4b389b
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 05883b0c57
ℹ️ 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".
b28a571 to
12b012f
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12b012f669
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3e85be125
ℹ️ 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".
The tests were organised per module while the architecture is organised by contract, so nothing asserted that every adapter satisfies the same one. An adapter could diverge and only fail at runtime, on the provider nobody exercises locally - which is how the destructive-apply guards ended up called from the cloud platform apply with a config they were never written for, and never covered there. The suite parameterizes over the Provider enum rather than a literal list, so a provider is enrolled the moment the enum names it and every assertion fails until its adapter conforms. It needs no cluster and no cloud credentials: providers are built from an empty environment onto a recording runner, and each root's contract is read from the fixture already captured beside it. Three more provider-touching changes (#130, #131, #155) are about to be written; this exists first so they are written against it. Refs #188. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
Four review findings, all about the suite asserting the wrong thing. The destructive-apply guards were called directly with `adapter.config`, so deleting either call from `cloud/platform.py` left every test green -- the coverage claim the debt row made was not one the tests backed. They now run through each provider's own platform apply; removing the call fails ten cases across AWS and Azure. Cross-provider equality compared physical bucket names and runtime principals. Architectural rule 2 delegates physical naming to the provider contract, so an adapter deriving account-specific names was correct and failed anyway. Equality now covers only the logical identities olf derives. Comparing stage sets by intersection meant a fixture that dropped PROD was skipped rather than caught -- the exact omission the suite exists to detect. The stages are now a declared constant every provider must serve. Protocol conformance compared `str(inspect.signature(...))`, which breaks on an added keyword-only argument or an equivalent annotation spelling without breaking any caller. It now binds Protocol-shaped calls. The debt row records what the tests actually prove: behaviour is covered, by `test_cloud_platform.py` since #163 and by this suite for every provider, and the type gap alone remains. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
Two claims were wider than their evidence. The debt row said cloud guard behaviour is covered. Driving the guards through `platform_up` proves they run, not that they inspect the right cluster -- and they do not: `platform_up` hands them `config`, whose `kube_context` is empty on cloud until the foundation outputs resolve, so they query `kubectl --context ''` and fall through to whatever the kubeconfig's current context happens to be. The sibling `import_namespace_if_missing_in_state` call is given `facts.kube_context` explicitly; these two are not. The row now records that, and the fix path leads with it. The stage-reference check reads `stages` as one opaque expression string, because that is all hcl2 returns, so it can only prove a token appears somewhere -- not that each field is pinned to its own stage. Pinning the wrong stage into one field while another still carries the token passes it. The failure message and the module docstring now say so, rather than advertising a cross-stage isolation guarantee only a rendered contract can give. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
`env` was asserted with `hasattr` on the class, so an adapter whose `env` is None, raises, or yields something a subprocess cannot take would have passed here and failed at activation. It is now resolved and checked as a non-empty str-to-str mapping carrying KUBE_CONTEXT, with the fake foundation facts primed first so a cloud adapter does not reach a real Terraform to do it. The two phase tests record the steps rather than run them, which is what keeps them cluster-free and is equally their limit: they prove which step each phase selects, and in what order, on every adapter -- not that a step does the right work. An adapter whose `platform_up` became a no-op still passes. Their docstrings say so now instead of implying a lifecycle regression would be caught here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
e3e85be to
34f26d3
Compare
Priming `adapter.__dict__["_foundation_facts"]` reached past the adapter into how a cached property stores what it resolved. A `CloudProvider` that kept its facts anywhere else would have written an unrelated dict entry, let `env` fall through to real foundation resolution, and failed this suite while its public behaviour stayed correct -- the coupling a conformance test is least entitled to. The resolver it calls is stubbed instead, leaving the adapter free to store the result however it likes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34f26d3dbc
ℹ️ 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".
Nothing connected a captured contract back to the provider it stands for. `_topology_of` derives the expected topology from the fixture's own `deployment.provider`, so a copied or mislabelled capture would validate one provider's contract while the suite reported it as another's coverage. The fixture loader now asserts that field matches the parameterized provider. The Protocol-call generator only ever offered a positional call for POSITIONAL_OR_KEYWORD parameters, so an adapter narrowing one to positional-only passed while rejecting `plan(phase=...)` -- a call a holder of `DeploymentProvider` may legally make. Both forms are generated when every positional slot can also be named. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…enLakeForge#193) * test: assert every provider adapter against one conformance suite The tests were organised per module while the architecture is organised by contract, so nothing asserted that every adapter satisfies the same one. An adapter could diverge and only fail at runtime, on the provider nobody exercises locally - which is how the destructive-apply guards ended up called from the cloud platform apply with a config they were never written for, and never covered there. The suite parameterizes over the Provider enum rather than a literal list, so a provider is enrolled the moment the enum names it and every assertion fails until its adapter conforms. It needs no cluster and no cloud credentials: providers are built from an empty environment onto a recording runner, and each root's contract is read from the fixture already captured beside it. Three more provider-touching changes (OpenLakeForge#130, OpenLakeForge#131, OpenLakeForge#155) are about to be written; this exists first so they are written against it. Refs OpenLakeForge#188. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 * test: drive the conformance guards through each provider's apply Four review findings, all about the suite asserting the wrong thing. The destructive-apply guards were called directly with `adapter.config`, so deleting either call from `cloud/platform.py` left every test green -- the coverage claim the debt row made was not one the tests backed. They now run through each provider's own platform apply; removing the call fails ten cases across AWS and Azure. Cross-provider equality compared physical bucket names and runtime principals. Architectural rule 2 delegates physical naming to the provider contract, so an adapter deriving account-specific names was correct and failed anyway. Equality now covers only the logical identities olf derives. Comparing stage sets by intersection meant a fixture that dropped PROD was skipped rather than caught -- the exact omission the suite exists to detect. The stages are now a declared constant every provider must serve. Protocol conformance compared `str(inspect.signature(...))`, which breaks on an added keyword-only argument or an equivalent annotation spelling without breaking any caller. It now binds Protocol-shaped calls. The debt row records what the tests actually prove: behaviour is covered, by `test_cloud_platform.py` since OpenLakeForge#163 and by this suite for every provider, and the type gap alone remains. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 * docs: say what the conformance checks actually prove Two claims were wider than their evidence. The debt row said cloud guard behaviour is covered. Driving the guards through `platform_up` proves they run, not that they inspect the right cluster -- and they do not: `platform_up` hands them `config`, whose `kube_context` is empty on cloud until the foundation outputs resolve, so they query `kubectl --context ''` and fall through to whatever the kubeconfig's current context happens to be. The sibling `import_namespace_if_missing_in_state` call is given `facts.kube_context` explicitly; these two are not. The row now records that, and the fix path leads with it. The stage-reference check reads `stages` as one opaque expression string, because that is all hcl2 returns, so it can only prove a token appears somewhere -- not that each field is pinned to its own stage. Pinning the wrong stage into one field while another still carries the token passes it. The failure message and the module docstring now say so, rather than advertising a cross-stage isolation guarantee only a rendered contract can give. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 * test: resolve the adapter environment instead of checking for it `env` was asserted with `hasattr` on the class, so an adapter whose `env` is None, raises, or yields something a subprocess cannot take would have passed here and failed at activation. It is now resolved and checked as a non-empty str-to-str mapping carrying KUBE_CONTEXT, with the fake foundation facts primed first so a cloud adapter does not reach a real Terraform to do it. The two phase tests record the steps rather than run them, which is what keeps them cluster-free and is equally their limit: they prove which step each phase selects, and in what order, on every adapter -- not that a step does the right work. An adapter whose `platform_up` became a no-op still passes. Their docstrings say so now instead of implying a lifecycle regression would be caught here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 * test: stub the foundation resolver, not the property's cache Priming `adapter.__dict__["_foundation_facts"]` reached past the adapter into how a cached property stores what it resolved. A `CloudProvider` that kept its facts anywhere else would have written an unrelated dict entry, let `env` fall through to real foundation resolution, and failed this suite while its public behaviour stayed correct -- the coupling a conformance test is least entitled to. The resolver it calls is stubbed instead, leaving the adapter free to store the result however it likes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 * test: tie each fixture to its provider and offer keyword calls Nothing connected a captured contract back to the provider it stands for. `_topology_of` derives the expected topology from the fixture's own `deployment.provider`, so a copied or mislabelled capture would validate one provider's contract while the suite reported it as another's coverage. The fixture loader now asserts that field matches the parameterized provider. The Protocol-call generator only ever offered a positional call for POSITIONAL_OR_KEYWORD parameters, so an adapter narrowing one to positional-only passed while rejecting `plan(phase=...)` -- a call a holder of `DeploymentProvider` may legally make. Both forms are generated when every positional slot can also be named. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Closes #188.
One suite at
tools/olf/tests/test_provider_conformance.pythat every provideradapter must pass. 40 tests, ~0.8s, no cluster and no cloud credentials: every
provider is built from an empty environment onto a recording runner, and each
root's contract is read from the v3 fixture already captured beside the file.
The parameter list is the
Providerenum, not a literal. Adding a providerenrols it in every assertion at once, and each one fails with a message naming
the contract it broke. Verified by temporarily adding
GCP = "gcp"to the enum:all 14 test functions failed (13 parameterized cases for
gcp, plus thecross-provider identity test), starting with "'gcp' has no
DeploymentContext.gcp()factory. Every provider needs one: it is how sharedcode resolves that provider's paths, kube context, and scoped command
environment without knowing which provider it is running against."
Invariants implemented
DeploymentProviderstructurally__annotations__+ its functions), so a member added there is required of every adapter from that moment. Method signatures are compared exactly.envoverlay shared callers usehcl2over each root'scontracts.tf:schema_version == "3.0.0",stagesbuilt overlocal.enabled_stages, and the canonical stage-scoped references (stage/${name}/runtime_identity,.../catalog,.../orchestration,activations/${name},shared/ops_storage) pinned to the stage being emitted.provider_contracts,shared_namespace,stage_names.stage_namesis load-bearing: a root that omits it makesterraform outputanswer "output variable requested could not be found", whichapplied_stage_namesreads as an unapplied root — silently disarming the stage-removal guard on that provider only.parse_provider_contractsover each provider's captured output; every enabled stage resolves by name, and a stage the profile does not enable raises.namespace,catalog_name,activation.prefixequal their canonical derivation; no identity carries a provider or implementation name; each bucket carries its own stage and layer.(namespace, catalog_name, activation prefix, principal, bronze/silver/gold buckets)on local, AWS, and Azure. This is rule 2 as a property rather than a naming convention — it is what makes an adapter swappable.require_no_stage_removalandrequire_no_shared_namespace_replacementdriven through each provider's own config: applied-stage removal, the drift path (state gone, namespace still labelled), the--allow-stage-removalopt-in, and the pre-v0.3lakehousenamespace.--phase <p>runs that phase's step and nothing else, andolf deployruns foundation → platform → artifacts.What I dropped, and why
"Every root emits a v3 stage index that
provider_contractsparses" — notcheckable in full without Terraform.
hcl2parses HCL syntax, not Terraformsemantics: a root's
stagesvalue collapses to one opaque${...}expressionstring, so nothing short of a real
init+apply(with provider credentials)renders the payload. Split into the two halves that are checkable without a
cluster: the root declares a v3 stage-indexed surface with canonical
stage-scoped refs (static,
hcl2), and the captured output parses for everyenabled stage (fixture-driven). The remaining half — that a real apply emits
exactly the fixture's payload — stays with
olf e2e run. The module docstringsays so explicitly rather than implying the suite covers it.
Nothing else was dropped.
Gaps found, for #187
envis on both providers and read byshared code, but not on the Protocol. I asserted it on what the adapters
actually expose rather than adding the member, so this PR stays the suite and
not the refactor. The one-line addition is worth its own commit on Complete the DeploymentProvider contract: config is still reached past the Protocol #187.
_adapter()returns thebuilt provider and the guard tests read
adapter.config— because there is noDeploymentConfigon the Protocol to read instead. The suite reaches past theseam for exactly the reason Complete the DeploymentProvider contract: config is still reached past the Protocol #187 exists.
require_no_stage_removaland
require_no_shared_namespace_replacement, declared againstLocalDeploymentConfig, behave identically given aCloudDeploymentConfig:everything they touch (
context.enabled_stages,context.owned_namespaces,context.topology,context.allow_stage_removal,context.shared_namespace,kube_context,paths.kubeconfig_path) exists on both. It is covered now, notfixed — the type gap is untouched, and
olf.deployment.cloud.platformstays onthe mypy override list.
docs/technical-debt.md's row said the path was"neither type-checked nor covered by a cloud-path test"; that sentence is no
longer true, so the row is updated to "partly fixed" with the type gap intact
rather than left stale.
Gate results (from the repository root)
Re-run after rebasing onto
e5134a0(#192). #192 removed the "Seven CLI tests depend on the working directory" debt row, adjacent to the guards row this change rewrites; main's deletion is kept and the rewritten row carried forward. The numbers below are the post-rebase measurements, not the pre-rebase ones — they happen to be identical.olf check allruff check tools/olfmypy --config-file tools/olf/pyproject.toml tools/olf/olfpytest tools/olf/tests --cov --cov-config=tools/olf/pyproject.tomlCoverage moves from 81.01% to 81.03% (baseline re-measured on the rebased tree: 1373 tests, 81.01%) — honestly, a rounding error. The suite
exercises mostly already-covered lines; its value is that it fails when a
contract breaks, not that it touches new ones. The floor stays at 81%; nothing
was lowered.
Notes
parses, and that stage-scoped refs are canonical — never an exhaustive field
list), so Derive Dagster code locations from the provider contract, not two hardcoded copies #185's
orchestrationextension needs no change here.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ue9Z94NHioRFYyjVB6egE5