feat(autopilot:playbooks-guidance): phase 0 — embedded playbook endpoint + field-path validation - #69
Merged
Conversation
…int + field-path validation
Deliverables (ADR-006):
- GET /api/remediation/playbooks/embedded: read-only, PlaybookResponse-shaped
view of the embedded default (via resolver embedded_default_yaml()); route
registered before /{id}.
- Playbook::validate_yaml: schema-aware, field-path validation (role, non-empty
tasks+instructions, loop.* incl. decimal-string max_cost_usd, tools_policy,
output_contract enum, provider_overlays known kinds + overlay enum, non-string
keys / non-mapping overlays), then a final strong-typed parse. Wired into
create/update to return 422 with the offending field path.
Tests: 27 ampel-worker unit tests + 4 Postgres-gated ampel-api integration tests.
clippy -D warnings + rustfmt clean. Tool-ceiling clamp and trusted/untrusted
split unchanged. Adversarial review: 2 findings (non-string task keys,
non-mapping overlay values), both fixed + covered.
Owner
Author
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
📊 Coverage Report
Coverage Thresholds
Coverage reports generated by CI workflow |
pacphi
added a commit
that referenced
this pull request
Jul 1, 2026
* chore(autopilot:playbooks-guidance): promote plan to active pipeline + seed ledger Retires the shipped remediation-model-catalog pipeline (survives in git history and its ledger). Seeds record 0 of the playbooks-guidance session ledger. pr_ci mode, base=develop, trunk=main, 4 phases. * feat(autopilot:playbooks-guidance): phase 0 complete — gate PASSED (#69) Embedded playbook endpoint + schema-aware field-path validation (ADR-006). All required CI checks green: CI Success, Backend Build/Lint/Unit(SQLite)/Integration(PostgreSQL)/Coverage/Security, frontend + i18n. Adversarial review: 2 findings fixed. * feat(autopilot:playbooks-guidance): phase 1 complete — gate PASSED (#70) Load built-in default + duplicate + preview pills; embedded endpoint wired; all i18n keys translated into 26 locales + types.ts regenerated. All required CI green (CI Success, Frontend Build/Lint, Validate React Translations, backend). Adversarial review: bogus locale dir fixed. * feat(autopilot:playbooks-guidance): phase 2 complete — gate PASSED (#71) Per-field schema hints + inline field-path validation errors; 27-locale i18n with interpolation-protected code tokens + types.ts regen. All required CI green (CI Success, Frontend Build/Lint, Validate React Translations, backend). Adversarial review: <root> error handling fixed. * feat(autopilot:playbooks-guidance): phase 3 complete — gate PASSED (#72) Docs (PLAYBOOKS.md) + preview no-model-call integration test. All required CI green after one rustfmt fix (CI Success, Backend Lint/Build/Integration(PostgreSQL), frontend, docs lint). Feature complete — all 4 phases shipped. * chore(autopilot:playbooks-guidance): cross-phase optimization — gate PASSED (#73) Shared invalid_playbook() 422 helper (create/update dedup). All required CI green. * fix(remediation): refresh default model choices per config/models.yaml The playbook embedded default overlays and the provider DEFAULT_MODEL fallbacks held out-of-date model ids. Update both to current catalog choices: - claude: claude-sonnet-4-6 -> claude-sonnet-5 - gemini: gemini-2.0-flash -> gemini-2.5-flash (repriced 0.0003/0.0025 per 1k) - ollama: qwen2.5-coder -> qwen3-coder:30b-a3b-q4_K_M (runnable Ollama tag) Updates crates/ampel-worker/playbooks/default.yaml (UI-visible overlays) and the claude/gemini/ollama provider DEFAULT_MODEL constants (runtime fallback), plus the gemini cost model + its two pricing tests to match 2.5-flash rates.
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.
Automated phase-0 run of the
playbooks-guidanceautopilot pipeline (ADR-006). Backend only.Deliverables
GET /api/remediation/playbooks/embedded— read-only,PlaybookResponse-shaped view of the embedded default playbook, sourced from the resolver'sembedded_default_yaml(). Synthetic (non-DB) row: nil id,source=builtin, global-sentinel scope, epoch timestamps. Route registered before/{id}(static segment wins in Axum 0.8).Playbook::validate_yamlinampel-worker/playbook.rs): assertsrole, non-emptytaskseach withinstructions,loop.{max_iterations,max_seconds,max_cost_usd}(cost a decimal string),tools_policy,output_contract(known enum), andprovider_overlayskeys (known provider kinds) + any overlayoutput_contract. Non-string keys and non-mapping overlays fail on their own field path. A final strong-typed parse catches residual type errors. Wired into create/update →422 invalid playbook \`: ` instead of an opaque parse error.DoD evidence
cargo test -p ampel-worker playbook→ 27 passedcargo test -p ampel-api playbooks→ 4 passed (verified against real PostgreSQL; Postgres-gated, auto-skip on SQLite)cargo build --workspace✓ ·cargo clippy --workspace --all-targets --all-features -- -D warnings✓ ·make format-check✓/api/remediation/playbooks/embeddedpresent incrates/ampel-api/src/routes/mod.rsAdversarial review
2 findings (non-string task keys, non-mapping overlay values silently deferred to the opaque parse) — both fixed and covered with regression tests.