Add test_campaign_dispatch_capture_value_type_checked#3392
Merged
Trecek merged 6 commits intoMay 31, 2026
Merged
Conversation
…changes Phases 1 and 2 of fix for shorthand capture specs defaulting to value_type='string', which rejects empty values from optional-output skills. Tests (Phase 1): - test_string_type_rejects_empty_value: asserts string rejects empty - test_normalize_capture_spec_shorthand_defaults_to_string: regression guard - test_shorthand_capture_with_empty_value_from_optional_contract_raises: end-to-end - test_optional_string_explicitly_accepted: explicit branch guard - test_optional_output_with_string_capture_type_flagged: bundled recipe scan - test_campaign_dispatch_capture_value_type_checked: value_type assertion on research-campaign - test_identify_optional_output_fields_extracts_from_contract: unit test for new helper Architectural changes (Phase 2): - _validate_capture_value: explicit optional_string branch (2b) - _normalize_capture_spec: widen to handle dict values with from+type (2c) - execute_dispatch: widen capture param to dict[str, str | dict[str, str]] (2c) - dispatch_food_truck: widen capture param to dict[str, str | dict[str, str]] (2c) - _identify_optional_output_fields: new helper cross-referencing contract outputs (2a) - capture-type-matches-contract-optionality: new ERROR rule for recipe steps (2a) - dispatch-capture-type-matches-contract-optionality: new ERROR rule for campaign dispatches (2a) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Converts all 8 shorthand capture specs that reference optional-output fields to long-form with type: optional_string. Prevents CaptureValueTypeError at runtime when a skill returns an empty value for fields the contract explicitly allows to be empty (e.g. pr_url when dry_run or preflight_failed, category_summary on preflight_failed). Files updated: - campaigns/promote-to-main.yaml: pr_url - promote-to-main-wrapper.yaml: pr_url, category_summary - implementation.yaml: compose_pr step pr_url - remediation.yaml: compose_pr step pr_url - implementation-groups.yaml: compose_pr step pr_url - research.yaml: compose_research_pr step pr_url - research-review.yaml: compose_research_pr step pr_url Compiled JSON files updated to match. Docstring for test_recipe_step_shorthand_capture_parses_to_capture_entry_spec updated to document that shorthand string captures remain valid for mandatory output fields. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tests that dispatch-capture-type-matches-contract-optionality emits an ERROR when pr_url uses value_type='string' on an optional output field, and that the fixed promote-to-main.yaml (using optional_string) passes clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The dispatch-capture-type-matches-contract-optionality rule requires an expected_output_pattern with an optional capture group to identify pr_url as optional. Without it, _identify_optional_output_fields returns empty and the rule never fires for pr_url captures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Eliminates cross-import between rule modules (rules_optional_capture → campaign/rules_campaign_capture) by moving the shared helper to the canonical _rule_helpers.py module. Re-exports from the original location for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…in _normalize_capture_spec Add explicit check for missing/empty 'from' key in dict-form capture entries — logs warning and skips instead of crashing in CaptureEntrySpec constructor. Add warning log before silently coercing invalid value_type to 'string', matching the established pattern in recipe/io.py. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b6ac427 to
43be18a
Compare
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.
Summary
Add the missing test function
test_campaign_dispatch_capture_value_type_checkedtotests/recipe/test_campaign_loader.py. This test exercises thedispatch-capture-type-matches-contract-optionalitysemantic rule with two assertions:value_type="string"on an optional output field → ERROR finding.promote-to-main.yaml(which usesoptional_string) → no ERROR finding.Closes #3334
Implementation Plan
Plan file:
/home/talon/projects/autoskillit-runs/remediation-20260530-204907-415625/.autoskillit/temp/make-plan/remediation_capture_value_type_test_plan_2026-05-30_214500.md🤖 Generated with Claude Code via AutoSkillit
Token Usage Summary
* Step used a non-Anthropic provider; caching behavior may differ.
Token Efficiency
Model Usage Breakdown