Skip to content

feat(actions): JSON Schema validation, CLI validate command, and agent-facing capabilities#220

Open
skypper wants to merge 8 commits intomasterfrom
feat/sec-1117-schema
Open

feat(actions): JSON Schema validation, CLI validate command, and agent-facing capabilities#220
skypper wants to merge 8 commits intomasterfrom
feat/sec-1117-schema

Conversation

@skypper
Copy link
Copy Markdown
Contributor

@skypper skypper commented Mar 30, 2026

Summary

Adds offline validation tooling and machine-readable interfaces for tenderly.yaml actions configuration, making the CLI usable by both humans and AI agents.

Schema alignment with runtime

Validated the JSON Schema against actions-trigger-service (tenderly-core) and official docs to close gaps where the schema would accept configs the runtime rejects:

  • Fixed PeriodicTrigger additionalProperties interaction with oneOf
  • Added anyOf enforcing the minimum filter constraint (from/to/function/eventEmitted/logEmitted)
  • Tightened Hex64 pattern, address/signature regex (case-insensitive for EIP-55)
  • Added cron format pattern, action name validation via patternProperties
  • Added parameters to FunctionValue, {exact, not} form to ParameterCondValue.string
  • Made execution_type optional (defaults to sequential)

New commands

Command Purpose
tenderly actions validate Two-phase offline validation: JSON Schema (structure) + Go-level (semantics). No login required.
tenderly actions validate --json Structured {valid, schema_errors, trigger_errors} output for programmatic consumption
tenderly actions capabilities JSON manifest of CLI capabilities: commands, trigger types, runtimes, enums, embedded schema

IDE integration

  • tenderly actions init now generates tenderly-schema.json and sets $schema in tenderly.yaml for automatic IDE autocomplete (VS Code, JetBrains)

Why this matters for AI agents

AI agents building web3 actions previously had to reverse-engineer valid configs from Go source code or deploy and parse failures. This PR creates a proper machine interface:

  1. Discoverytenderly actions capabilities returns all valid enums, trigger types, and the full JSON Schema in one call. An agent can generate correct configs without reading docs.
  2. Feedback looptenderly actions validate --json provides structured errors that agents can parse and act on programmatically, enabling write-validate-fix cycles without human intervention.
  3. Schema as contract — The JSON Schema serves as a machine-readable spec that any JSON Schema-aware tool can consume.

Tested on a real project

Ran both commands against a test project (7 actions with transaction triggers, event parameters, function filters, NOT conditions, int ranges):

$ tenderly actions validate --json
{"valid": true}

$ tenderly actions capabilities | jq '.trigger_types'
["periodic", "webhook", "block", "transaction", "alert"]

Test plan

  • go test ./model/actions/... — 55 tests pass (24 schema tests)
  • tenderly actions validate — text output on valid/invalid configs
  • tenderly actions validate --json — structured JSON output, exit 0/1
  • tenderly actions capabilities | jq . — valid JSON with all fields
  • tenderly actions schema -o schema.json + external validator (ajv-cli) against sample configs
  • Tested on real web3 actions project with 7 action specs

Introduces a hand-written JSON Schema builder and a CLI command
(`tenderly actions schema`) so users can get editor autocomplete
and validation for tenderly.yaml via VS Code or JetBrains.
@skypper skypper self-assigned this Mar 30, 2026
skypper added 5 commits March 30, 2026 22:12
- Fix PeriodicTrigger: move properties to top level so additionalProperties works with oneOf
- Add minimum filter constraint (anyOf) on TransactionFilter requiring at least one of from/to/function/eventEmitted/logEmitted
- Fix Hex64 pattern from permissive ^0x to ^0x[0-9a-fA-F]+$
- Use case-insensitive address/signature regex in schema to accept EIP-55 checksummed addresses
- Add cron field pattern validation (5-field format)
- Make execution_type optional in ActionSpec (defaults to sequential)
- Add action name pattern validation via patternProperties
- Add parameters field to FunctionValue (now supported in CLI)
- Support StrValue {exact, not} object form in ParameterCondValue.string
Two-phase validation using the generated JSON Schema:
1. JSON Schema validation (structure, types, enums, required fields)
2. Go-level validation (cross-field constraints, regex, cron parsing)

No login required. Supports --project flag for single-project validation.
Init command now generates tenderly-schema.json alongside tenderly.yaml
and sets $schema reference for IDE auto-detection.
- New `tenderly actions capabilities` command outputs a JSON manifest
  with available commands, trigger types, runtimes, enums, and the
  embedded JSON Schema for agent/tooling discovery.
- Add --json flag to `tenderly actions validate` for structured output
  with schema_errors and trigger_errors arrays.
@skypper skypper changed the title feat(actions): add JSON Schema generation for tenderly.yaml config feat(actions): JSON Schema validation, CLI validate command, and agent-facing capabilities Mar 31, 2026
skypper added 2 commits March 31, 2026 13:26
- Switch jsonschema/v6 to v5 to keep go.mod at Go 1.18 (no breaking change)
- Promote StrValue to named $def for consistency with all other composite types
- Split validate into runValidation() + separate text/JSON renderers
- Capabilities: lightweight by default, full schema behind --include-schema flag
- Add .gitignore entry for generated tenderly-schema.json
- Add 7 integration tests for ValidateConfig (valid, invalid runtime,
  missing filter constraint, bad action name, both interval+cron,
  checksummed address, function with parameters)
- Replace MustGetActions() with direct YAML parsing in validate to avoid
  os.Exit inside runValidation (returns errors instead)
- Add capabilities output tests (JSON shape, schema inclusion, enum sync)
@skypper skypper requested a review from g4zyn March 31, 2026 11:34
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.

1 participant