Repository navigation
feat(provider): check Fabric configurations and readiness inputs by name - #12857
Merged
Merged
Conversation
…ation
fabric_agent_configuration checked config_json against Fabric's types
only while planning, and reported any failure as "observation query
failed", without saying what was wrong.
The resource now checks config_json during validation and reports
"Invalid config_json" on that attribute, naming the rejected field
("at harness.adapter_id") through a safe path and never the value. An
attribute check can now build its message, so ValidateAttribute
returns a Cow instead of a fixed string; storage's checks are
unchanged.
Part of #12788.
fabric_sandbox_readiness took one sandbox map of strings. Generated graphs filled it with every string attribute of the sandbox, filtering out its typed inputs, and merged in the agent configuration's config_json. OpenTofu could not check which keys the read needed, and a missing or misspelled key surfaced only when the read failed. The data source now requires the nine attributes it reads by name: the sandbox's workspace, name, id, owner, generation, agent_name, agent_runtime, and runtime_json, and the configuration's config_json. The checks are unchanged; validation now also requires runtime_json and config_json, which the read already needed. Generated graphs reference each attribute directly. Part of #12788.
Collaborator
Author
cv
pushed a commit
that referenced
this pull request
Oct 9, 2026
…ame (#12900) Replaces #12857, which merged into the stale `feat/fabric-capabilities` branch instead of `v1`. Part of #12788 (step 2 of 3, the last). The first two commits are #12857's, cherry-picked onto `v1` unchanged. The third is new: `v1` added two attribute checks after #12857 was written. ## Failure - `fabric_agent_configuration` checked `config_json` against Fabric's types only while planning, and reported any failure as `observation query failed`, without saying what was wrong. - `fabric_sandbox_readiness` took one `sandbox` map of strings. Generated graphs filled it with every string attribute of the sandbox, filtering out its typed inputs, and merged in the configuration's `config_json`. OpenTofu could not check which keys the read needed; a missing or misspelled key surfaced only when the read failed. ## Decision Three commits: 1. **Invalid configurations name the rejected field.** `config_json` is checked during validation with `serde_path_to_error`, and reported as `Invalid config_json` on that attribute: `config_json is not a valid Fabric configuration at harness.adapter_id`. The path passes through `diagnostic_field`; the value and Fabric's own message, which can quote it, never appear. To build that message, `ValidateAttribute` returns `Cow<'static, str>` instead of `&'static str`; storage's checks return the same fixed text. 2. **Readiness takes its inputs by name.** It requires the sandbox's `workspace`, `name`, `id`, `owner`, `generation`, `agent_name`, `agent_runtime`, and `runtime_json`, and the configuration's `config_json`: the keys the read already used. The checks are unchanged; validation now also requires `runtime_json` and `config_json`. Generated graphs reference each attribute directly, and the filter for typed sandbox inputs goes away. 3. **`v1`'s newer attribute checks adopt the owned message.** The managed gateway and Kubernetes definitions pass SDK checks that return `&'static str`; their definitions now convert the error rather than changing those SDK signatures. Two items in #12788 were deliberately not done; the issue records why: - **`config` as an HCL value.** Fabric's configuration schema is open, so generated blocks would drop extension keys. A `dynamic` attribute would fit, but the pinned `tf-provider` decodes state without the schema and cannot tell a dynamic attribute's `[type, value]` pair from a two-element list. `config_json` stays a JSON string. - **Optional `owner` and `generation` on the configuration.** They are the sandbox's identity, which the provider verifies before acting, not the configuration's own. They stay required. ## Validation - New unit tests, written first: a valid configuration passes; a wrong type at `harness.adapter_id` and malformed JSON are reported without the input. Readiness exposes the nine required inputs and no `sandbox` map, hands the bridge exactly those nine, defers on unknown inputs, rejects missing or empty ones, and does not echo rejected values. - The standalone Pi lifecycle test now plans a rejected configuration through OpenTofu: it fails with `Invalid config_json ... at harness.adapter_id`, never shows the value, and makes no sandbox call. - `cargo ci` passed on linux_arm64 for #12857's two commits, including 108 lifecycle tests. - On this branch (linux_amd64, 2 cores): fmt, clippy, test, and bundle pass. Lifecycle passed 111 of 112; `deployment::web_search_cli_export_reapply_and_destroy` reached its 300 s limit under load and passed alone in 255 s. That test timed out the same way on this host before these changes, so CI on this PR is the authoritative lifecycle result.
Closed
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.
Part of #12788 (step 2 of 3, the last). Stacked on #12844, which is stacked on #12842; it retargets as those merge.
Failure
fabric_agent_configurationcheckedconfig_jsonagainst Fabric's types only while planning, and reported any failure asobservation query failed, without saying what was wrong.fabric_sandbox_readinesstook onesandboxmap of strings. Generated graphs filled it with every string attribute of the sandbox, filtering out its typed inputs, and merged in the configuration'sconfig_json. OpenTofu could not check which keys the read needed; a missing or misspelled key surfaced only when the read failed.Decision
Two commits:
config_jsonis checked during validation withserde_path_to_error, and reported asInvalid config_jsonon that attribute:config_json is not a valid Fabric configuration at harness.adapter_id. The path passes throughdiagnostic_field; the value and Fabric's own message, which can quote it, never appear. To build that message,ValidateAttributereturnsCow<'static, str>instead of&'static str; storage's checks return the same fixed text.workspace,name,id,owner,generation,agent_name,agent_runtime, andruntime_json, and the configuration'sconfig_json: the keys the read already used. The checks are unchanged; validation now also requiresruntime_jsonandconfig_json. Generated graphs reference each attribute directly, and the filter for typed sandbox inputs goes away.Two items in #12788 were deliberately not done; the issue records why:
configas an HCL value. Fabric's configuration schema is open, so generated blocks would drop extension keys. Adynamicattribute would fit, but the pinnedtf-providerdecodes state without the schema and cannot tell a dynamic attribute's[type, value]pair from a two-element list.config_jsonstays a JSON string.ownerandgenerationon the configuration. They are the sandbox's identity, which the provider verifies before acting, not the configuration's own. They stay required.Validation
harness.adapter_idand malformed JSON are reported without the input. Readiness exposes the nine required inputs and nosandboxmap, hands the bridge exactly those nine, defers on unknown inputs, rejects missing or empty ones, and does not echo rejected values.Invalid config_json ... at harness.adapter_id, never shows the value, and makes no sandbox call.cargo ci: all selected steps passed on linux_arm64, including 108 lifecycle tests.