Skip to content

feat(provider): check Fabric configurations and readiness inputs by name - #12857

Merged
cv merged 2 commits into
feat/fabric-capabilitiesfrom
feat/fabric-typed-inputs
Oct 8, 2026
Merged

cv merged 2 commits into
feat/fabric-capabilitiesfrom
feat/fabric-typed-inputs

Conversation

@kaofelix

@kaofelix kaofelix commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

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_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

Two 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.

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: all selected steps passed on linux_arm64, including 108 lifecycle tests.

…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.
@kaofelix kaofelix added area: architecture Architecture, design debt, major refactors, or maintainability v1 NemoClaw v1 branch labels Oct 8, 2026
@cv
cv merged commit fde9f14 into feat/fabric-capabilities Oct 8, 2026
4 checks passed
@cv
cv deleted the feat/fabric-typed-inputs branch October 8, 2026 22:08
@kaofelix

kaofelix commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

This merged into the stale feat/fabric-capabilities branch, which an unrelated push had recreated after #12844 merged, so it never reached v1. Replaced by #12900: the same two commits on v1, plus one that adapts the attribute checks v1 added since. The stale branch is deleted.

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.
@kaofelix kaofelix mentioned this pull request Oct 9, 2026
@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery feature PR adds or expands user-visible functionality security area: security Security controls, permissions, secrets, or hardening and removed security labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Architecture, design debt, major refactors, or maintainability area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening feature PR adds or expands user-visible functionality v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants