Skip to content

feat(recipes): expose default_from in the JSON contract - #108

Merged
NovusEdge merged 1 commit into
mainfrom
feat/recipe-schema-default-from
Sep 6, 2026
Merged

feat(recipes): expose default_from in the JSON contract#108
NovusEdge merged 1 commit into
mainfrom
feat/recipe-schema-default-from

Conversation

@NovusEdge

@NovusEdge NovusEdge commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Follow-up to #107, which added default_from = "ssh_user" to the schema 3 param table without exposing it to machine consumers.

stoat recipe show --json and the MCP recipe_schema tool report a param's default but had no way to say the value comes from the VM. So docker.user read as default: "", required: false, and an agent parsing that concluded the param was optional and unset. Stoat in fact fills it from config.VM.SSHUser at apply time.

core.RecipeParam and the wire RecipeParam now carry DefaultFrom, serialized as default_from with omitempty, so a param that does not declare it emits no new key and existing consumers see no change.

The contract stays at 3. docs/reference/json.md:111 states that an additive optional field does not bump it, and this is one.

docs/reference/mcp.md is untouched: it does not document recipe_schema's result shape.

Tests

TestRecipeSchemaListsParams was relaxed in #107 to only assert docker's user param exists. It now asserts the param reports default_from as ssh_user. TestRecipeSchemaOmitsDefaultFromWhenUndeclared uses python-dev.venv_dir, which declares a static default and no default_from, to prove the key stays out of the JSON.

go build ./..., go vet ./..., gofmt -l clean, and go test for internal/core, internal/cli, internal/mcpsrv, internal/recipes all pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XNEYeG6gFKQc2hxbzYN1oh

Summary by CodeRabbit

  • New Features

    • Recipe parameters can now use a dynamic default source, such as ssh_user, when no value is provided.
    • Parameter schemas expose the new default_from field where applicable.
    • Dynamic defaults cannot be used together with a fixed default value.
  • Documentation

    • Updated the JSON reference to document default_from, its supported values, usage, and compatibility with version 3.

recipe show --json and MCP recipe_schema now report a param's
default_from alongside default, so a consumer no longer reads
docker.user as unset when Stoat fills it from the VM's SSH account.

Signed-off-by: NovusEdge <novusedge0@gmail.com>
@NovusEdge NovusEdge added documentation Improvements or additions to documentation recipes bundled or index recipes labels Sep 6, 2026
@NovusEdge NovusEdge self-assigned this Sep 6, 2026
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Team

Run ID: e2970a54-1e13-437d-b4c4-e5006c0f6e56

📥 Commits

Reviewing files that changed from the base of the PR and between ce1a290 and c17a612.

📒 Files selected for processing (4)
  • docs/reference/json.md
  • internal/cli/wire/dto.go
  • internal/core/apply.go
  • internal/mcpsrv/tools_read_test.go

Walkthrough

The change adds optional RecipeParam.default_from support. Core and wire models propagate the field, JSON output serializes it when declared, documentation defines its behavior, and MCP tests cover declared and undeclared cases.

Changes

Recipe parameter default source

Layer / File(s) Summary
Core recipe parameter propagation
internal/core/apply.go
The core RecipeParam stores DefaultFrom, and fromManifest copies the manifest value.
Wire serialization
internal/cli/wire/dto.go
The wire DTO emits default_from when present. Both recipe conversion paths copy the core value.
JSON contract and output validation
docs/reference/json.md, internal/mcpsrv/tools_read_test.go
The reference documents supported behavior and version compatibility. MCP tests verify ssh_user output and omission when undeclared.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Manifest
  participant CoreRecipeParam
  participant WireRecipeParam
  participant MCPRecipeSchema
  Manifest->>CoreRecipeParam: provide DefaultFrom
  CoreRecipeParam->>WireRecipeParam: copy DefaultFrom
  WireRecipeParam->>MCPRecipeSchema: serialize default_from
Loading

Poem

A rabbit found a field so neat
default_from made schemas complete
From manifest to wire it ran
Tests checked every planned span
SSH defaults hopped in time

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/recipe-schema-default-from

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NovusEdge
NovusEdge merged commit d84365d into main Sep 6, 2026
7 of 8 checks passed
@NovusEdge
NovusEdge deleted the feat/recipe-schema-default-from branch September 6, 2026 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation recipes bundled or index recipes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant