Skip to content

feat(agents): normalize option keys to snake_case#303

Merged
pocky merged 1 commit intomainfrom
feature/F077-normalize-option-keys-to-snakecase
Apr 7, 2026
Merged

feat(agents): normalize option keys to snake_case#303
pocky merged 1 commit intomainfrom
feature/F077-normalize-option-keys-to-snakecase

Conversation

@pocky
Copy link
Copy Markdown
Contributor

@pocky pocky commented Apr 7, 2026

Summary

  • Normalize all agent provider option keys from camelCase to snake_case (allowedToolsallowed_tools, dangerouslySkipPermissionsdangerously_skip_permissions) — this is a breaking change; old keys are silently ignored
  • Extend dangerously_skip_permissions support to Gemini (--approval-mode=yolo) and Codex (--yolo), making permission bypass available uniformly across all three CLI providers
  • Remove dead helper functions getWorkflowID() and getStepName() whose keys were never injected by any caller, and simplify audit log entries by dropping redundant workflow/step fields
  • Add tests verifying snake_case key recognition and that camelCase keys no longer trigger the security audit warning

Changes

Application Layer

  • internal/application/execution_service.go: Update audit log key lookup from dangerouslySkipPermissions to dangerously_skip_permissions
  • internal/application/execution_service_dangerous_skip_audit_test.go: New test suite verifying snake_case key fires audit warning and camelCase key does not

Agent Providers

  • internal/infrastructure/agents/claude_provider.go: Rename option key lookups to allowed_tools and dangerously_skip_permissions; remove workflow/step fields from audit log
  • internal/infrastructure/agents/gemini_provider.go: Add dangerously_skip_permissions support mapping to --approval-mode=yolo
  • internal/infrastructure/agents/codex_provider.go: Add dangerously_skip_permissions support mapping to --yolo
  • internal/infrastructure/agents/cli_executor.go: Related cleanup

Dead Code Removal

  • internal/infrastructure/agents/helpers.go: Remove getWorkflowID() and getStepName() dead helpers
  • internal/infrastructure/agents/helpers_test.go: Remove tests for deleted helpers

Tests

  • internal/infrastructure/agents/claude_provider_unit_test.go: Update all option key references to snake_case; add CLI argument construction tests for both renamed keys
  • internal/infrastructure/agents/claude_provider_test.go: Update integration test option key to allowed_tools
  • internal/infrastructure/agents/codex_provider_unit_test.go: Add tests for dangerously_skip_permissions flag mapping
  • internal/infrastructure/agents/gemini_provider_unit_test.go: Add tests for dangerously_skip_permissions flag mapping
  • tests/integration/validation/validation_providers_test.go: Update option keys in validation fixtures

Documentation & Config

  • docs/user-guide/agent-steps.md: Document allowed_tools and dangerously_skip_permissions for Claude, Codex, and Gemini with security warnings
  • CHANGELOG.md: Add breaking change notice and feature/removal entries under Unreleased
  • CLAUDE.md: Add architecture rule for per-provider flag mapping; add pitfall rules for dead helper cleanup and consistent option key naming

Test plan

  • Run unit tests: make test-unit — all provider option key tests pass
  • Verify camelCase keys are silently ignored: set dangerouslySkipPermissions: true in a workflow YAML and confirm no permission skip occurs
  • Verify snake_case keys work end-to-end: set dangerously_skip_permissions: true for each provider and confirm the corresponding CLI flag is passed
  • Run lint: make lint — no camelCase option key references remain

Closes #300


Generated with awf commit workflow

- `CHANGELOG.md`: Document F077 breaking changes, added features, and removed helpers
- `CLAUDE.md`: Add per-provider flag mapping rule and dead helper cleanup pitfall
- `docs/user-guide/agent-steps.md`: Document `allowed_tools` and `dangerously_skip_permissions` for Claude, Codex, Gemini
- `internal/application/execution_service.go`: Update audit log key from `dangerouslySkipPermissions` to `dangerously_skip_permissions`
- `internal/application/execution_service_dangerous_skip_audit_test.go`: Add audit log key regression tests (snake_case vs camelCase)
- `internal/infrastructure/agents/claude_provider.go`: Rename `allowedTools`→`allowed_tools`, `dangerouslySkipPermissions`→`dangerously_skip_permissions`
- `internal/infrastructure/agents/claude_provider_test.go`: Update option key references to snake_case
- `internal/infrastructure/agents/claude_provider_unit_test.go`: Expand unit tests for snake_case option keys
- `internal/infrastructure/agents/cli_executor.go`: Update option key reads to snake_case
- `internal/infrastructure/agents/codex_provider.go`: Add `dangerously_skip_permissions` support via `--yolo`
- `internal/infrastructure/agents/codex_provider_unit_test.go`: Add unit tests for Codex `dangerously_skip_permissions`
- `internal/infrastructure/agents/gemini_provider.go`: Add `dangerously_skip_permissions` support via `--approval-mode=yolo`
- `internal/infrastructure/agents/gemini_provider_unit_test.go`: Add unit tests for Gemini `dangerously_skip_permissions`
- `internal/infrastructure/agents/helpers.go`: Remove dead `getWorkflowID` and `getStepName` helpers
- `internal/infrastructure/agents/helpers_test.go`: Remove tests for deleted dead helpers
- `tests/integration/validation/validation_providers_test.go`: Update option key references to snake_case

Closes #300
@pocky pocky marked this pull request as ready for review April 7, 2026 14:54
@pocky pocky merged commit a985070 into main Apr 7, 2026
5 checks passed
@pocky pocky deleted the feature/F077-normalize-option-keys-to-snakecase branch April 7, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

F077: Normalize Option Keys to snake_case

1 participant