From ca7609e33747a472c6916365afe273f59525614a Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Wed, 4 Feb 2026 23:42:33 -0800 Subject: [PATCH 01/10] ok better errors --- PLAN.md | 279 +++--------------- WISHLIST.md | 21 ++ cli/cmd/yapi/run.go | 1 + cli/internal/runner/runner.go | 90 ++++++ cli/internal/validation/analyzer.go | 33 +++ cli/internal/vars/vars.go | 20 ++ .../debugging/assertion-failure-demo.yapi.yml | 27 ++ .../debugging/bare-variable-warning.yapi.yml | 26 ++ .../debugging/chain-verbose-demo.yapi.yml | 37 +++ examples/debugging/missing-key-demo.yapi.yml | 23 ++ 10 files changed, 327 insertions(+), 230 deletions(-) create mode 100644 WISHLIST.md create mode 100644 examples/debugging/assertion-failure-demo.yapi.yml create mode 100644 examples/debugging/bare-variable-warning.yapi.yml create mode 100644 examples/debugging/chain-verbose-demo.yapi.yml create mode 100644 examples/debugging/missing-key-demo.yapi.yml diff --git a/PLAN.md b/PLAN.md index 5157da4a..4137f5ce 100644 --- a/PLAN.md +++ b/PLAN.md @@ -1,262 +1,81 @@ -# Plan: `wait_for` Feature - DX Design +# Plan: Better Error Messages & Debuggability -## Overview - -A new `wait_for` block that repeatedly polls an endpoint until a condition is satisfied. Designed for async server operations that require time to complete (job processing, webhooks, eventual consistency, etc.). - -## DX Design - -### Basic Syntax - -```yaml -yapi: v1 -url: ${url}/jobs/${job_id} -method: GET - -wait_for: - until: - - .status == "completed" - period: 2s - timeout: 60s -``` - -### Fixed Period (Simple) - -```yaml -wait_for: - until: - - .status == "completed" - period: 2s # Fixed time between attempts - timeout: 60s # Total time limit -``` - -### Exponential Backoff - -```yaml -wait_for: - until: - - .status == "completed" - backoff: - seed: 1s # Initial wait time - multiplier: 2 # Each attempt waits multiplier * previous - timeout: 60s # Total time limit -``` - -Backoff example with `seed: 1s, multiplier: 2`: -- Attempt 1 → wait 1s -- Attempt 2 → wait 2s -- Attempt 3 → wait 4s -- Attempt 4 → wait 8s -- ...continues until timeout - -### Behavior - -1. Execute the request -2. If `until` conditions pass → success, stop polling -3. If `until` conditions fail OR request errors (5xx, network) → wait (period or backoff), retry -4. If `timeout` exceeded → fail with timeout error - -**Error handling**: Intermediate failures (5xx, network errors, 4xx) are treated as "not ready yet" and polling continues. Only timeout causes failure. - -**Timing**: Either `period` OR `backoff` must be specified (mutually exclusive). +## Context +Implementing WISHLIST.md items #1, #2, and #4 (removing #3 since `yapi send` already exists). --- -## Use Cases - -### 1. Single Request - Job Completion - -```yaml -yapi: v1 -url: ${url}/jobs/${job_id} -method: GET +## 1. WISHLIST.md cleanup +Remove item #3 (yapi send) since it's already shipped. -wait_for: - until: - - .status == "completed" or .status == "failed" - period: 2s - timeout: 120s - -expect: - status: 200 - assert: - - .status == "completed" # Final assertion after wait_for succeeds -``` - -### 2. Chain Step - Async Workflow - -```yaml -yapi: v1 -chain: - - name: create_job - url: ${url}/jobs - method: POST - body: - type: "data_export" - expect: - status: 202 - assert: - - .job_id != null - - - name: wait_for_job - url: ${url}/jobs/${create_job.job_id} - method: GET - wait_for: - until: - - .status == "completed" - backoff: - seed: 1s - multiplier: 2 - timeout: 300s - expect: - status: 200 - assert: - - .download_url != null - - - name: download_result - url: ${wait_for_job.download_url} - method: GET - output_file: ./export.csv -``` - -### 3. Webhook/Callback Waiting +--- -```yaml -yapi: v1 -chain: - - name: trigger_webhook - url: ${url}/webhooks/trigger - method: POST +## 2. Warn on bare `$word.word` variable syntax (WISHLIST #1) - - name: check_received - url: ${url}/webhooks/received - method: GET - wait_for: - until: - - . | length > 0 - - .[0].payload.event == "user.created" - period: 1s - timeout: 30s -``` +The problem: `$step.field` (no braces) silently passes as a literal string instead of being substituted. Only `${step.field}` works. -### 4. Database Eventual Consistency +**Changes:** -```yaml -yapi: v1 -chain: - - name: create_user - url: ${url}/users - method: POST - body: - email: "test@example.com" - expect: - status: 201 +- **`cli/internal/vars/vars.go`**: Add a `BareChainRef` regex that matches `$word.word` patterns that are NOT inside `${...}`. +- **`cli/internal/vars/vars.go`**: Add `FindBareRefs(s string) []string` that returns the bare refs found. +- **`cli/internal/validation/analyzer.go`**: In `analyzeParsed()`, call a new `warnBareChainRefs(text)` validation function that scans the raw YAML text for bare `$word.word` patterns and emits `SeverityWarning` diagnostics with line numbers and an actionable message like: + `"possible bare variable reference '$step.field' -- did you mean '${step.field}'? Only the ${...} form is substituted."` - - name: verify_searchable - url: ${url}/users/search?email=test@example.com - method: GET - wait_for: - until: - - . | length == 1 - period: 500ms - timeout: 10s -``` +This catches the problem at config analysis time (before execution), so users see the warning immediately -- even in `yapi validate`. --- -## Interaction with Existing Features - -### With `expect` +## 3. Show resolved request details in verbose chain execution (WISHLIST #2) -`wait_for` runs first. Once `until` conditions pass, `expect` runs on the final response: +The problem: When a chain step fails, you can't see what values were actually sent because variable substitution is invisible. -```yaml -wait_for: - until: - - .status != "pending" # Wait until not pending - period: 1s - timeout: 30s +**Changes:** -expect: - status: 200 - assert: - - .status == "completed" # Then verify it's completed (not failed) -``` +- **`cli/internal/runner/runner.go`**: Add `Verbose bool` field to `runner.Options`. +- **`cli/internal/runner/runner.go`**: In `RunChain()`, after `interpolateConfig()` succeeds and before executing, if `opts.Verbose` is true, print the resolved config to stderr: + - Resolved URL (with method) + - Resolved headers + - Resolved body (JSON-serialized if map, or raw if string) + - Uses `fmt.Fprintf(os.Stderr, ...)` with `[VERBOSE]` prefix, consistent with the existing Logger pattern. +- **`cli/cmd/yapi/run.go`**: Set `opts.Verbose = ctx.verbose` when building runner.Options in `executeRunE()`. -### With `timeout` - -The existing `timeout` field is per-request. `wait_for.timeout` is total polling time: - -```yaml -timeout: 5s # Each poll attempt times out after 5s +--- -wait_for: - until: - - .ready == true - period: 2s - timeout: 60s # Total polling time limit -``` +## 4. Print step responses in verbose chain mode (WISHLIST #4) -### With `delay` +The problem: In chain execution, you only see the final failing step's output, not intermediate step responses. -`delay` happens before `wait_for` starts: +**Changes:** -```yaml -delay: 5s # Wait 5s before starting to poll +- **`cli/internal/runner/runner.go`**: In `RunChain()`, after each step executes, if `opts.Verbose` is true, print the step's response details to stderr: + - Status code + - Response body (truncated at 1000 chars for readability) + - Duration -wait_for: - until: - - .status == "done" - period: 2s - timeout: 30s -``` + This replaces the need for a per-step `debug: true` field -- verbose mode shows everything, which is simpler and avoids new config surface area. --- -## Output During Polling +## 5. Example files: `examples/debugging/` -When running with verbose/default output: +Create example `.yapi.yml` files that demonstrate the improved debugging experience: -``` -[POLL] Attempt 1 - conditions not met, retrying in 2s... -[POLL] Attempt 2 - conditions not met, retrying in 2s... -[POLL] Attempt 3 - request failed (503), retrying in 2s... -[POLL] Attempt 4 - conditions met! -``` +- **`bare-variable-warning.yapi.yml`**: A chain that uses `$step.field` (bare) to trigger the new warning. +- **`chain-verbose-demo.yapi.yml`**: A multi-step chain against jsonplaceholder with variables that shows how `--verbose` reveals resolved values. +- **`assertion-failure-demo.yapi.yml`**: A request with an `expect:` block that will fail, showing the detailed assertion error output. +- **`missing-key-demo.yapi.yml`**: A chain that references a nonexistent JSON key, showing the precise error path. --- -## Config Schema - -```go -type Backoff struct { - Seed string `yaml:"seed"` // Initial wait, e.g., "1s" - Multiplier float64 `yaml:"multiplier"` // e.g., 2 -} - -type WaitFor struct { - Until []string `yaml:"until"` // Required: JQ assertions - Period string `yaml:"period,omitempty"` // Fixed interval, e.g., "2s" - Backoff *Backoff `yaml:"backoff,omitempty"` // Exponential backoff - Timeout string `yaml:"timeout"` // Required: total time limit -} -``` - -Added to `ConfigV1`: -```go -type ConfigV1 struct { - // ... existing fields ... - WaitFor *WaitFor `yaml:"wait_for,omitempty"` -} -``` - ---- +## Files changed -## Validation Rules +| File | Change | +|------|--------| +| `WISHLIST.md` | Remove item #3 | +| `cli/internal/vars/vars.go` | Add `BareChainRef` regex + `FindBareRefs()` function | +| `cli/internal/validation/analyzer.go` | Add `warnBareChainRefs()`, call from `analyzeParsed()` | +| `cli/internal/runner/runner.go` | Add `Verbose` to `Options`, add verbose logging in `RunChain()` | +| `cli/cmd/yapi/run.go` | Thread `verbose` into `runner.Options` | +| `examples/debugging/*.yapi.yml` | 4 new example files | -1. `until` is required and must have at least one assertion -2. `timeout` is required and must be valid Go duration -3. Exactly one of `period` OR `backoff` must be specified (mutually exclusive) -4. If `period`: must be valid Go duration -5. If `backoff`: `seed` must be valid Go duration, `multiplier` must be > 1 -6. All `until` expressions must be valid JQ +**No new dependencies. No config schema changes. No breaking changes.** diff --git a/WISHLIST.md b/WISHLIST.md new file mode 100644 index 00000000..ecd921c8 --- /dev/null +++ b/WISHLIST.md @@ -0,0 +1,21 @@ +# YAPI Wishlist + +Issues encountered while writing MIDI clip note tests against the Ableton Live Remote Script. + +## 1. Chain variable syntax not documented clearly + +YAPI uses `${step.result.field}` (curly braces required), but the old docs and some examples show `$step.result.field` (bare dollar sign). The bare form is silently passed as a literal string rather than substituted, which makes debugging painful — the Remote Script receives the string `"$create_track.result.index"` instead of `3`. + +**Wish:** Either support both forms, or emit a clear warning when a string matching `$word.word` is found without braces. + +## 2. No way to inspect resolved variable values + +When a chain step fails, the output shows the raw response but not the resolved parameter values that were sent. If variable substitution silently fails (e.g., wrong syntax), you can't tell from the output. + +**Wish:** Show the resolved request body in verbose/debug mode so you can verify what was actually sent over the wire. + +## 3. No way to print step results mid-chain for debugging + +When a chain step fails, you get the response for the failing step but not intermediate steps (unless you scroll through the full output). Being able to mark a step as `debug: true` to print its full response would help. + +**Wish:** `debug: true` on chain steps to always print the full response body, or a `--verbose` flag that prints all step responses. diff --git a/cli/cmd/yapi/run.go b/cli/cmd/yapi/run.go index e07b9040..7abf6f64 100644 --- a/cli/cmd/yapi/run.go +++ b/cli/cmd/yapi/run.go @@ -206,6 +206,7 @@ func (app *rootCommand) executeRunE(ctx runContext) error { NoColor: app.noColor, BinaryOutput: app.binaryOutput, Insecure: app.insecure, + Verbose: ctx.verbose, ConfigFilePath: ctx.path, StrictEnv: ctx.strictEnv, } diff --git a/cli/internal/runner/runner.go b/cli/internal/runner/runner.go index 0ed1cee3..09cd779d 100644 --- a/cli/internal/runner/runner.go +++ b/cli/internal/runner/runner.go @@ -16,6 +16,7 @@ import ( "yapi.run/cli/internal/domain" "yapi.run/cli/internal/executor" "yapi.run/cli/internal/filter" + "yapi.run/cli/internal/vars" ) const ( @@ -44,6 +45,7 @@ type Options struct { NoColor bool BinaryOutput bool Insecure bool + Verbose bool // Show resolved request/response details during execution EnvOverrides map[string]string // Environment variables from project config ProjectRoot string // Path to project root (for validation) ProjectEnv string // Selected environment name (for validation) @@ -342,12 +344,20 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV // 1. Merge step with base config to get full config merged := base.Merge(step) + // 1b. Warn about bare $word.word patterns that won't be substituted + warnBareChainRefsInConfig(step.Name, &merged) + // 2. Interpolate variables in the merged config interpolatedConfig, err := interpolateConfig(chainCtx, &merged) if err != nil { return nil, fmt.Errorf("step '%s': %w", step.Name, err) } + // 2b. Verbose: show resolved request details + if opts.Verbose { + logResolvedConfig(i+1, step.Name, interpolatedConfig) + } + // 3. Handle Delay (wait before executing step) if interpolatedConfig.Delay != "" { d, err := time.ParseDuration(interpolatedConfig.Delay) @@ -392,6 +402,11 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV } } + // 6b. Verbose: show response details + if opts.Verbose { + logStepResponse(i+1, step.Name, result) + } + // 7. Assert Expectations expectRes := CheckExpectationsWithEnv(step.Expect, result, opts.EnvOverrides) @@ -409,6 +424,81 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV return chainResult, nil } +// logResolvedConfig prints the resolved request config to stderr for debugging. +func logResolvedConfig(stepNum int, stepName string, cfg *config.ConfigV1) { + fmt.Fprintf(os.Stderr, "[VERBOSE] Step %d (%s) resolved request:\n", stepNum, stepName) + if cfg.Method != "" || cfg.URL != "" { + fmt.Fprintf(os.Stderr, "[VERBOSE] %s %s\n", cfg.Method, cfg.URL) + } + if cfg.Path != "" { + fmt.Fprintf(os.Stderr, "[VERBOSE] Path: %s\n", cfg.Path) + } + for k, v := range cfg.Headers { + fmt.Fprintf(os.Stderr, "[VERBOSE] Header: %s: %s\n", k, v) + } + if cfg.Body != nil { + bodyJSON, err := json.Marshal(cfg.Body) + if err == nil { + body := string(bodyJSON) + if len(body) > 1000 { + body = body[:1000] + fmt.Sprintf("... (%d bytes total)", len(body)) + } + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", body) + } + } + if cfg.JSON != "" { + j := cfg.JSON + if len(j) > 1000 { + j = j[:1000] + fmt.Sprintf("... (%d bytes total)", len(j)) + } + fmt.Fprintf(os.Stderr, "[VERBOSE] JSON: %s\n", j) + } + if cfg.Data != "" { + d := cfg.Data + if len(d) > 1000 { + d = d[:1000] + fmt.Sprintf("... (%d bytes total)", len(d)) + } + fmt.Fprintf(os.Stderr, "[VERBOSE] Data: %s\n", d) + } +} + +// logStepResponse prints response details to stderr for debugging. +func logStepResponse(stepNum int, stepName string, result *Result) { + fmt.Fprintf(os.Stderr, "[VERBOSE] Step %d (%s) response:\n", stepNum, stepName) + fmt.Fprintf(os.Stderr, "[VERBOSE] Status: %d\n", result.StatusCode) + fmt.Fprintf(os.Stderr, "[VERBOSE] Duration: %s\n", result.Duration) + body := result.Body + if len(body) > 1000 { + body = body[:1000] + fmt.Sprintf("... (%d bytes total)", len(body)) + } + if body != "" { + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", body) + } +} + +// warnBareChainRefsInConfig checks a config's string fields for bare $word.word patterns +// and prints warnings to stderr during chain execution. +func warnBareChainRefsInConfig(stepName string, cfg *config.ConfigV1) { + check := func(field, value string) { + refs := vars.FindBareRefs(value) + for _, ref := range refs { + fmt.Fprintf(os.Stderr, "[WARN] step '%s' %s: possible bare variable '%s' -- did you mean '${%s}'?\n", + stepName, field, ref, ref[1:]) + } + } + + check("url", cfg.URL) + check("path", cfg.Path) + check("json", cfg.JSON) + check("data", cfg.Data) + for k, v := range cfg.Headers { + check(fmt.Sprintf("header '%s'", k), v) + } + for k, v := range cfg.Query { + check(fmt.Sprintf("query '%s'", k), v) + } +} + // interpolateConfig expands chain variables in a config func interpolateConfig(chainCtx *ChainContext, cfg *config.ConfigV1) (*config.ConfigV1, error) { result := *cfg // Copy diff --git a/cli/internal/validation/analyzer.go b/cli/internal/validation/analyzer.go index 6e055e6b..27cdcfef 100644 --- a/cli/internal/validation/analyzer.go +++ b/cli/internal/validation/analyzer.go @@ -260,6 +260,8 @@ func analyzeParsed(text string, parseRes *config.ParseResult, project *config.Pr diags = append(diags, validateEnvVarsWithEnvFiles(text, envFileVarNames)...) } + diags = append(diags, warnBareChainRefs(text)...) + return &Analysis{ Chain: parseRes.Chain, Base: parseRes.Base, @@ -304,6 +306,8 @@ func analyzeParsed(text string, parseRes *config.ParseResult, project *config.Pr diags = append(diags, ValidateChainAssertions(text, parseRes.WaitFor.Until, "wait_for")...) } + diags = append(diags, warnBareChainRefs(text)...) + return &Analysis{ Request: req, Diagnostics: diags, @@ -521,6 +525,35 @@ func scanForUndefinedRefs(text, value string, definedSteps map[string]bool, curr return diags } +// warnBareChainRefs scans YAML text for bare $word.word patterns that look like +// chain variable references but aren't wrapped in ${...}, which means they won't +// be substituted. Emits a warning diagnostic for each occurrence. +func warnBareChainRefs(text string) []Diagnostic { + var diags []Diagnostic + lines := strings.Split(text, "\n") + + for lineNum, line := range lines { + trimmed := strings.TrimSpace(line) + // Skip comments and graphql blocks (which use $var syntax legitimately) + if strings.HasPrefix(trimmed, "#") { + continue + } + + bareRefs := vars.FindBareRefs(line) + for _, ref := range bareRefs { + col := strings.Index(line, ref) + diags = append(diags, Diagnostic{ + Severity: SeverityWarning, + Field: "", + Message: fmt.Sprintf("possible bare variable reference '%s' -- did you mean '${%s}'? Only the ${...} form is substituted", ref, ref[1:]), + Line: lineNum, + Col: col, + }) + } + } + return diags +} + // EnvVarInfo holds information about an env var reference for hover/diagnostics type EnvVarInfo struct { Name string diff --git a/cli/internal/vars/vars.go b/cli/internal/vars/vars.go index f1e58f8a..63eb68f8 100644 --- a/cli/internal/vars/vars.go +++ b/cli/internal/vars/vars.go @@ -31,6 +31,26 @@ func HasEnvVars(s string) bool { return EnvOnly.MatchString(s) } +// BareChainRef matches bare $word.word patterns (without braces) that look like +// chain variable references. Negative lookbehind for { ensures we don't match ${...}. +// We use a two-step approach: find all $word.word patterns, then exclude those inside ${}. +var BareChainRef = regexp.MustCompile(`\$([A-Za-z_][A-Za-z0-9_]*\.[A-Za-z0-9_.]+)`) + +// FindBareRefs returns bare chain-style references ($step.field) that are NOT +// wrapped in ${...}. These are likely user mistakes since only ${...} is substituted. +func FindBareRefs(s string) []string { + var results []string + for _, loc := range BareChainRef.FindAllStringIndex(s, -1) { + start := loc[0] + // Check that this is not inside ${...} by looking for a preceding { + if start > 0 && s[start-1] == '{' { + continue + } + results = append(results, s[start:loc[1]]) + } + return results +} + // ExpandString replaces all ${VAR} occurrences in input using the resolver. func ExpandString(input string, resolver Resolver) (string, error) { var capturedErr error diff --git a/examples/debugging/assertion-failure-demo.yapi.yml b/examples/debugging/assertion-failure-demo.yapi.yml new file mode 100644 index 00000000..84f72eef --- /dev/null +++ b/examples/debugging/assertion-failure-demo.yapi.yml @@ -0,0 +1,27 @@ +# Demonstrates detailed assertion failure messages. +# +# This request intentionally asserts wrong values so you can see +# the error output format with expected vs actual values. +# +# Run with: +# yapi run assertion-failure-demo.yapi.yml +# +# Expected output: +# [PASS] .userId != null +# [FAIL] .id == 999 +# [FAIL] .title == "wrong title" +# +# assertion failed +# Expected: .id to equal 999 +# Actual: .id = 1 +# Expression: .id == 999 + +yapi: v1 +url: https://jsonplaceholder.typicode.com/todos/1 +method: GET +expect: + status: 200 + assert: + - .userId != null + - .id == 999 + - .title == "wrong title" diff --git a/examples/debugging/bare-variable-warning.yapi.yml b/examples/debugging/bare-variable-warning.yapi.yml new file mode 100644 index 00000000..34bfa267 --- /dev/null +++ b/examples/debugging/bare-variable-warning.yapi.yml @@ -0,0 +1,26 @@ +# Demonstrates the bare variable warning. +# +# This chain uses $step.field (bare dollar sign) instead of ${step.field}. +# The bare form is NOT substituted -- it's passed as the literal string +# "$get_todo.userId". yapi now warns about this at validation time. +# +# Run with: +# yapi validate bare-variable-warning.yapi.yml +# yapi run bare-variable-warning.yapi.yml +# +# Expected output: +# [WARN] line 18: possible bare variable reference '$get_todo.userId' +# -- did you mean '${get_todo.userId}'? Only the ${...} form is substituted + +yapi: v1 +chain: + - name: get_todo + url: https://jsonplaceholder.typicode.com/todos/1 + method: GET + expect: + status: 200 + + - name: get_user + # BUG: This should be ${get_todo.userId} -- note the missing braces! + url: https://jsonplaceholder.typicode.com/users/$get_todo.userId + method: GET diff --git a/examples/debugging/chain-verbose-demo.yapi.yml b/examples/debugging/chain-verbose-demo.yapi.yml new file mode 100644 index 00000000..3fb38007 --- /dev/null +++ b/examples/debugging/chain-verbose-demo.yapi.yml @@ -0,0 +1,37 @@ +# Demonstrates --verbose mode for chain debugging. +# +# This chain fetches a todo, then uses its userId to fetch the user. +# With --verbose, you can see exactly what URL/body was sent after +# variable substitution, plus each step's response body. +# +# Run with: +# yapi run chain-verbose-demo.yapi.yml --verbose +# +# Verbose output will show: +# [VERBOSE] Step 1 (get_todo) resolved request: +# [VERBOSE] GET https://jsonplaceholder.typicode.com/todos/1 +# [VERBOSE] Step 1 (get_todo) response: +# [VERBOSE] Status: 200 +# [VERBOSE] Body: {"userId":1,"id":1,"title":"delectus aut autem",...} +# [VERBOSE] Step 2 (get_user) resolved request: +# [VERBOSE] GET https://jsonplaceholder.typicode.com/users/1 +# ... + +yapi: v1 +chain: + - name: get_todo + url: https://jsonplaceholder.typicode.com/todos/1 + method: GET + expect: + status: 200 + assert: + - .userId != null + + - name: get_user + url: https://jsonplaceholder.typicode.com/users/${get_todo.userId} + method: GET + expect: + status: 200 + assert: + - .name != null + - .email != null diff --git a/examples/debugging/missing-key-demo.yapi.yml b/examples/debugging/missing-key-demo.yapi.yml new file mode 100644 index 00000000..fa8cf895 --- /dev/null +++ b/examples/debugging/missing-key-demo.yapi.yml @@ -0,0 +1,23 @@ +# Demonstrates the error when referencing a nonexistent JSON key. +# +# The second step references ${get_todo.nonexistent_field}, which +# doesn't exist in the response. yapi provides a precise error +# showing exactly which key was missing and at what path. +# +# Run with: +# yapi run missing-key-demo.yapi.yml +# +# Expected output: +# step 'get_user': url: key 'nonexistent_field' not found at path 'nonexistent_field' + +yapi: v1 +chain: + - name: get_todo + url: https://jsonplaceholder.typicode.com/todos/1 + method: GET + expect: + status: 200 + + - name: get_user + url: https://jsonplaceholder.typicode.com/users/${get_todo.nonexistent_field} + method: GET From 3eaf848cd2349160a9c5367fc403dab49cac3f59 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Fri, 6 Feb 2026 13:06:00 -0800 Subject: [PATCH 02/10] can do vars in jq --- cli/internal/runner/runner.go | 40 ++++++++++++++++++- cli/internal/validation/graphql_jq.go | 9 ++++- .../debugging/chain-var-in-assertion.yapi.yml | 27 +++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 examples/debugging/chain-var-in-assertion.yapi.yml diff --git a/cli/internal/runner/runner.go b/cli/internal/runner/runner.go index 09cd779d..cee6e119 100644 --- a/cli/internal/runner/runner.go +++ b/cli/internal/runner/runner.go @@ -407,8 +407,12 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV logStepResponse(i+1, step.Name, result) } - // 7. Assert Expectations - expectRes := CheckExpectationsWithEnv(step.Expect, result, opts.EnvOverrides) + // 7. Assert Expectations (with chain variable interpolation) + interpolatedExpect, err := interpolateExpectations(chainCtx, step.Expect) + if err != nil { + return nil, fmt.Errorf("step '%s': %w", step.Name, err) + } + expectRes := CheckExpectationsWithEnv(interpolatedExpect, result, opts.EnvOverrides) // 8. Store Result (including expectation result even if failed) chainCtx.AddResult(step.Name, result) @@ -499,6 +503,38 @@ func warnBareChainRefsInConfig(stepName string, cfg *config.ConfigV1) { } } +// interpolateExpectations expands chain variables in assertion expressions. +// This allows assertions like: .result.track_index == ${create_track.result.index} +func interpolateExpectations(chainCtx *ChainContext, expect config.Expectation) (config.Expectation, error) { + result := expect + + // Interpolate body assertions + if len(expect.Assert.Body) > 0 { + result.Assert.Body = make([]string, len(expect.Assert.Body)) + for i, assertion := range expect.Assert.Body { + expanded, err := chainCtx.ExpandVariables(assertion) + if err != nil { + return result, fmt.Errorf("assertion '%s': %w", assertion, err) + } + result.Assert.Body[i] = expanded + } + } + + // Interpolate header assertions + if len(expect.Assert.Headers) > 0 { + result.Assert.Headers = make([]string, len(expect.Assert.Headers)) + for i, assertion := range expect.Assert.Headers { + expanded, err := chainCtx.ExpandVariables(assertion) + if err != nil { + return result, fmt.Errorf("header assertion '%s': %w", assertion, err) + } + result.Assert.Headers[i] = expanded + } + } + + return result, nil +} + // interpolateConfig expands chain variables in a config func interpolateConfig(chainCtx *ChainContext, cfg *config.ConfigV1) (*config.ConfigV1, error) { result := *cfg // Copy diff --git a/cli/internal/validation/graphql_jq.go b/cli/internal/validation/graphql_jq.go index 634be6db..2634da45 100644 --- a/cli/internal/validation/graphql_jq.go +++ b/cli/internal/validation/graphql_jq.go @@ -9,6 +9,7 @@ import ( "github.com/itchyny/gojq" "gopkg.in/yaml.v3" "yapi.run/cli/internal/domain" + "yapi.run/cli/internal/vars" ) // ValidateGraphQLSyntax validates the GraphQL query syntax if present. @@ -130,11 +131,17 @@ func findFieldInNode(node *yaml.Node, field string) int { } // ValidateChainAssertions validates JQ syntax for all assertions in chain steps. +// Chain variable references like ${step.field} are replaced with null before +// parsing, since they'll be interpolated at runtime. func ValidateChainAssertions(text string, assertions []string, stepName string) []Diagnostic { var diags []Diagnostic for _, assertion := range assertions { - _, err := gojq.Parse(assertion) + // Replace ${...} chain variable refs with null for syntax validation + // These will be expanded at runtime before JQ evaluation + sanitized := vars.Expansion.ReplaceAllString(assertion, "null") + + _, err := gojq.Parse(sanitized) if err != nil { // Find the line where this assertion appears line := findValueInTextForAssertion(text, assertion) diff --git a/examples/debugging/chain-var-in-assertion.yapi.yml b/examples/debugging/chain-var-in-assertion.yapi.yml new file mode 100644 index 00000000..f4932639 --- /dev/null +++ b/examples/debugging/chain-var-in-assertion.yapi.yml @@ -0,0 +1,27 @@ +# Demonstrates using chain variables in assertions. +# +# The second step's assertion compares a response value against +# a value from the first step using ${step.field} syntax. +# +# Run with: +# yapi run chain-var-in-assertion.yapi.yml +# +# The assertion `.userId == ${get_todo.userId}` expands to `.userId == 1` +# before being evaluated by JQ. + +yapi: v1 +chain: + - name: get_todo + url: https://jsonplaceholder.typicode.com/todos/1 + method: GET + expect: + status: 200 + + - name: get_another_todo + url: https://jsonplaceholder.typicode.com/todos/2 + method: GET + expect: + status: 200 + assert: + # This todo also belongs to userId 1, so this should pass + - .userId == ${get_todo.userId} From 6a00e68cb16114f16a92ba9e5d7ebf7c0942c435 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Fri, 6 Feb 2026 13:06:21 -0800 Subject: [PATCH 03/10] wip --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b4a39864..3f845a39 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ chain: **Key features:** - Reference previous step data with `${step_name.field}` syntax - Access nested JSON properties: `${login.data.token}` +- Use chain variables in assertions: `.id == ${previous_step.expected_id}` - Assertions use JQ expressions that must evaluate to true - Chains stop on first failure (fail-fast) From 7bfe04e49a66d7527d679d9001f3b019ff08dc66 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Fri, 6 Feb 2026 13:08:29 -0800 Subject: [PATCH 04/10] great --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index 3f845a39..caa11bd2 100644 --- a/README.md +++ b/README.md @@ -232,6 +232,29 @@ expect: - .[] | .active == true # all items are active ``` +**Chain variable assertions** - compare values across steps: + +```yaml +yapi: v1 +chain: + - name: create_item + url: https://api.example.com/items + method: POST + body: + name: "Test Item" + expect: + status: 201 + + - name: get_item + url: https://api.example.com/items/${create_item.id} + method: GET + expect: + status: 200 + assert: + - .id == ${create_item.id} # verify same ID + - .name == "Test Item" +``` + ### 5\. JQ Filtering (Built-in\!) Don't grep output. Filter it right in the config. From de2a24a463358f2d3eee44ee7b0c4093571a6f48 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Sat, 7 Feb 2026 11:56:47 -0800 Subject: [PATCH 05/10] Add Jamie Pond attribution to footer Co-Authored-By: Claude Opus 4.6 --- apps/web/app/components/Landing.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/web/app/components/Landing.tsx b/apps/web/app/components/Landing.tsx index fde34196..cbeeaa24 100644 --- a/apps/web/app/components/Landing.tsx +++ b/apps/web/app/components/Landing.tsx @@ -330,6 +330,7 @@ export default async function Landing() { From 7762a0bfe1f45fb6dd59d29e4674daa13bf697a4 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Wed, 11 Feb 2026 11:53:41 -0800 Subject: [PATCH 06/10] Move editor integration section near top of README Co-Authored-By: Claude Opus 4.6 --- README.md | 110 +++++++++++++++++++++++++++--------------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 5ba899d0..29c25d1c 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,61 @@ make install ----- +## 🧠 Editor Integration (LSP) + +Unlike other API clients, **yapi** ships with a **full LSP implementation** out of the box. Your editor becomes an intelligent API development environment with real-time validation, autocompletion, and inline execution. + +### VS Code & Cursor + +Install the official extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=yapi.yapi-extension) or [Open VSX](https://open-vsx.org/extension/yapi/yapi-extension): + +**Features:** +- **Run with `Cmd+Enter`** (Mac) or `Ctrl+Enter` (Windows/Linux) - execute requests without leaving your editor +- **Inline results panel** - see responses, headers, and timing right in VS Code +- **Real-time validation** - errors and warnings as you type +- **Intelligent autocompletion** - context-aware suggestions for keys, methods, and variables +- **Hover info** - hover over `${VAR}` to see environment variable status + +The extension automatically detects `.yapi.yml` files and activates the language server. No configuration needed. + +### Neovim (Native Plugin) + +**yapi** was built with Neovim in mind. First-class support via `lua/yapi_nvim`: + +```lua +-- lazy.nvim +{ + dir = "~/path/to/yapi/lua/yapi_nvim", + config = function() + require("yapi_nvim").setup({ + lsp = true, -- Enables the yapi Language Server + pretty = true, -- Uses the TUI renderer in the popup + }) + end +} +``` + +Commands: +- `:YapiRun` - Execute the current buffer +- `:YapiWatch` - Open a split with live reload + +### Other Editors + +The LSP communicates over stdio and works with any editor that supports the Language Server Protocol: + +```bash +yapi lsp +``` + +| Feature | Description | +|---------|-------------| +| **Real-time Validation** | Errors and warnings as you type, with precise line/column positions | +| **Intelligent Autocompletion** | Context-aware suggestions for keys, HTTP methods, content types | +| **Hover Info** | Hover over `${VAR}` to see environment variable status | +| **Go to Definition** | Jump to referenced chain steps and variables | + +----- + ## 🚀 Quick Start 1. **Create a request file** (e.g., `get-user.yapi.yml`): @@ -459,61 +514,6 @@ yapi test ./tests --verbose # See server output ----- -## 🧠 Editor Integration (LSP) - -Unlike other API clients, **yapi** ships with a **full LSP implementation** out of the box. Your editor becomes an intelligent API development environment with real-time validation, autocompletion, and inline execution. - -### VS Code & Cursor - -Install the official extension from [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=yapi.yapi-extension) or [Open VSX](https://open-vsx.org/extension/yapi/yapi-extension): - -**Features:** -- **Run with `Cmd+Enter`** (Mac) or `Ctrl+Enter` (Windows/Linux) - execute requests without leaving your editor -- **Inline results panel** - see responses, headers, and timing right in VS Code -- **Real-time validation** - errors and warnings as you type -- **Intelligent autocompletion** - context-aware suggestions for keys, methods, and variables -- **Hover info** - hover over `${VAR}` to see environment variable status - -The extension automatically detects `.yapi.yml` files and activates the language server. No configuration needed. - -### Neovim (Native Plugin) - -**yapi** was built with Neovim in mind. First-class support via `lua/yapi_nvim`: - -```lua --- lazy.nvim -{ - dir = "~/path/to/yapi/lua/yapi_nvim", - config = function() - require("yapi_nvim").setup({ - lsp = true, -- Enables the yapi Language Server - pretty = true, -- Uses the TUI renderer in the popup - }) - end -} -``` - -Commands: -- `:YapiRun` - Execute the current buffer -- `:YapiWatch` - Open a split with live reload - -### Other Editors - -The LSP communicates over stdio and works with any editor that supports the Language Server Protocol: - -```bash -yapi lsp -``` - -| Feature | Description | -|---------|-------------| -| **Real-time Validation** | Errors and warnings as you type, with precise line/column positions | -| **Intelligent Autocompletion** | Context-aware suggestions for keys, HTTP methods, content types | -| **Hover Info** | Hover over `${VAR}` to see environment variable status | -| **Go to Definition** | Jump to referenced chain steps and variables | - ------ - ## 🌍 Environment Management Create a `yapi.config.yml` file in your project root to manage multiple environments: From 3417a25905144c90ea4e19d3d97b5152d3adfd9f Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Wed, 11 Feb 2026 12:10:02 -0800 Subject: [PATCH 07/10] Use lspconfig for neovim LSP setup instead of vim.lsp.config Co-Authored-By: Claude Opus 4.6 --- integrations/nvim/lua/yapi_nvim/init.lua | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/integrations/nvim/lua/yapi_nvim/init.lua b/integrations/nvim/lua/yapi_nvim/init.lua index 7e68e1e5..55beff68 100644 --- a/integrations/nvim/lua/yapi_nvim/init.lua +++ b/integrations/nvim/lua/yapi_nvim/init.lua @@ -175,12 +175,20 @@ function M.setup(opts) -- Setup LSP for yapi files if M._opts.lsp then - vim.lsp.config.yapi = { - cmd = { "yapi", "lsp" }, - filetypes = { "yaml.yapi" }, - root_markers = { "yapi.config.yml", "yapi.config.yaml", ".git" }, - } - vim.lsp.enable("yapi") + local ok, lspconfig = pcall(require, "lspconfig") + if ok then + local configs = require("lspconfig.configs") + if not configs.yapi then + configs.yapi = { + default_config = { + cmd = { "yapi", "lsp" }, + filetypes = { "yaml.yapi" }, + root_dir = lspconfig.util.root_pattern("yapi.config.yml", "yapi.config.yaml", ".git"), + }, + } + end + lspconfig.yapi.setup({}) + end -- Set filetype to yaml.yapi for yapi config files vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, { From 5c023d07e4d15bf02ff2f484888b5e177a99b7c2 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Tue, 17 Feb 2026 16:26:27 -0800 Subject: [PATCH 08/10] Address review feedback: extract truncateStr helper, add FindBareRefs tests, fix example line number MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DRY up duplicated truncation logic into a UTF-8-safe truncateStr helper - Add table-driven tests for FindBareRefs covering bare refs, wrapped refs, edge cases - Fix incorrect line number in bare-variable-warning example comment (18 → 25) Co-Authored-By: Claude Opus 4.6 --- cli/internal/runner/runner.go | 43 ++++++++++--------- cli/internal/vars/vars_test.go | 33 ++++++++++++++ .../debugging/bare-variable-warning.yapi.yml | 2 +- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/cli/internal/runner/runner.go b/cli/internal/runner/runner.go index cee6e119..45bcdb39 100644 --- a/cli/internal/runner/runner.go +++ b/cli/internal/runner/runner.go @@ -428,6 +428,23 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV return chainResult, nil } +// truncateStr truncates s to maxLen bytes (at a valid UTF-8 boundary) and appends +// a size note if truncated. +func truncateStr(s string, maxLen int) string { + if len(s) <= maxLen { + return s + } + // Walk back to avoid splitting a multi-byte UTF-8 character + cut := maxLen + for cut > 0 && s[cut-1]&0xC0 == 0x80 { + cut-- + } + if cut > 0 && s[cut-1]&0x80 != 0 { + cut-- // skip the leading byte of the split character + } + return s[:cut] + fmt.Sprintf("... (%d bytes total)", len(s)) +} + // logResolvedConfig prints the resolved request config to stderr for debugging. func logResolvedConfig(stepNum int, stepName string, cfg *config.ConfigV1) { fmt.Fprintf(os.Stderr, "[VERBOSE] Step %d (%s) resolved request:\n", stepNum, stepName) @@ -443,26 +460,14 @@ func logResolvedConfig(stepNum int, stepName string, cfg *config.ConfigV1) { if cfg.Body != nil { bodyJSON, err := json.Marshal(cfg.Body) if err == nil { - body := string(bodyJSON) - if len(body) > 1000 { - body = body[:1000] + fmt.Sprintf("... (%d bytes total)", len(body)) - } - fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", body) + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(string(bodyJSON), 1000)) } } if cfg.JSON != "" { - j := cfg.JSON - if len(j) > 1000 { - j = j[:1000] + fmt.Sprintf("... (%d bytes total)", len(j)) - } - fmt.Fprintf(os.Stderr, "[VERBOSE] JSON: %s\n", j) + fmt.Fprintf(os.Stderr, "[VERBOSE] JSON: %s\n", truncateStr(cfg.JSON, 1000)) } if cfg.Data != "" { - d := cfg.Data - if len(d) > 1000 { - d = d[:1000] + fmt.Sprintf("... (%d bytes total)", len(d)) - } - fmt.Fprintf(os.Stderr, "[VERBOSE] Data: %s\n", d) + fmt.Fprintf(os.Stderr, "[VERBOSE] Data: %s\n", truncateStr(cfg.Data, 1000)) } } @@ -471,12 +476,8 @@ func logStepResponse(stepNum int, stepName string, result *Result) { fmt.Fprintf(os.Stderr, "[VERBOSE] Step %d (%s) response:\n", stepNum, stepName) fmt.Fprintf(os.Stderr, "[VERBOSE] Status: %d\n", result.StatusCode) fmt.Fprintf(os.Stderr, "[VERBOSE] Duration: %s\n", result.Duration) - body := result.Body - if len(body) > 1000 { - body = body[:1000] + fmt.Sprintf("... (%d bytes total)", len(body)) - } - if body != "" { - fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", body) + if result.Body != "" { + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(result.Body, 1000)) } } diff --git a/cli/internal/vars/vars_test.go b/cli/internal/vars/vars_test.go index fd5e3a81..fc3d8a3a 100644 --- a/cli/internal/vars/vars_test.go +++ b/cli/internal/vars/vars_test.go @@ -59,6 +59,39 @@ func TestExpandString(t *testing.T) { } } +func TestFindBareRefs(t *testing.T) { + tests := []struct { + name string + input string + want []string + }{ + {"no refs", "hello world", nil}, + {"bare ref", "$step.field", []string{"$step.field"}}, + {"wrapped ref not matched", "${step.field}", nil}, + {"bare among text", "url: http://example.com/$step.id/path", []string{"$step.id"}}, + {"multiple bare refs", "$a.b and $c.d", []string{"$a.b", "$c.d"}}, + {"mixed bare and wrapped", "$bare.ref and ${wrapped.ref}", []string{"$bare.ref"}}, + {"no dot no match", "$FOO", nil}, + {"deep ref", "$step.response.body", []string{"$step.response.body"}}, + {"dollar amount", "$100", nil}, + {"bcrypt hash", "$2a$12$hash", nil}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got := FindBareRefs(tt.input) + if len(got) != len(tt.want) { + t.Fatalf("FindBareRefs(%q) = %v, want %v", tt.input, got, tt.want) + } + for i := range got { + if got[i] != tt.want[i] { + t.Errorf("FindBareRefs(%q)[%d] = %q, want %q", tt.input, i, got[i], tt.want[i]) + } + } + }) + } +} + func FuzzExpandString(f *testing.F) { // Seed with various variable patterns (only ${VAR} form supported) f.Add("hello world") diff --git a/examples/debugging/bare-variable-warning.yapi.yml b/examples/debugging/bare-variable-warning.yapi.yml index 34bfa267..08a36c8a 100644 --- a/examples/debugging/bare-variable-warning.yapi.yml +++ b/examples/debugging/bare-variable-warning.yapi.yml @@ -9,7 +9,7 @@ # yapi run bare-variable-warning.yapi.yml # # Expected output: -# [WARN] line 18: possible bare variable reference '$get_todo.userId' +# [WARN] line 25: possible bare variable reference '$get_todo.userId' # -- did you mean '${get_todo.userId}'? Only the ${...} form is substituted yapi: v1 From 86561eb395c598ed936cfbae12eaa048099bf6f9 Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Tue, 17 Feb 2026 16:30:09 -0800 Subject: [PATCH 09/10] Fix lint: remove unused maxLen parameter from truncateStr Co-Authored-By: Claude Opus 4.6 --- cli/internal/runner/runner.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/cli/internal/runner/runner.go b/cli/internal/runner/runner.go index 45bcdb39..cde5a115 100644 --- a/cli/internal/runner/runner.go +++ b/cli/internal/runner/runner.go @@ -428,14 +428,15 @@ func RunChain(ctx context.Context, factory ExecutorFactory, base *config.ConfigV return chainResult, nil } -// truncateStr truncates s to maxLen bytes (at a valid UTF-8 boundary) and appends -// a size note if truncated. -func truncateStr(s string, maxLen int) string { - if len(s) <= maxLen { +const verboseMaxLen = 1000 + +// truncateStr truncates s for verbose output at a valid UTF-8 boundary. +func truncateStr(s string) string { + if len(s) <= verboseMaxLen { return s } // Walk back to avoid splitting a multi-byte UTF-8 character - cut := maxLen + cut := verboseMaxLen for cut > 0 && s[cut-1]&0xC0 == 0x80 { cut-- } @@ -460,14 +461,14 @@ func logResolvedConfig(stepNum int, stepName string, cfg *config.ConfigV1) { if cfg.Body != nil { bodyJSON, err := json.Marshal(cfg.Body) if err == nil { - fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(string(bodyJSON), 1000)) + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(string(bodyJSON))) } } if cfg.JSON != "" { - fmt.Fprintf(os.Stderr, "[VERBOSE] JSON: %s\n", truncateStr(cfg.JSON, 1000)) + fmt.Fprintf(os.Stderr, "[VERBOSE] JSON: %s\n", truncateStr(cfg.JSON)) } if cfg.Data != "" { - fmt.Fprintf(os.Stderr, "[VERBOSE] Data: %s\n", truncateStr(cfg.Data, 1000)) + fmt.Fprintf(os.Stderr, "[VERBOSE] Data: %s\n", truncateStr(cfg.Data)) } } @@ -477,7 +478,7 @@ func logStepResponse(stepNum int, stepName string, result *Result) { fmt.Fprintf(os.Stderr, "[VERBOSE] Status: %d\n", result.StatusCode) fmt.Fprintf(os.Stderr, "[VERBOSE] Duration: %s\n", result.Duration) if result.Body != "" { - fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(result.Body, 1000)) + fmt.Fprintf(os.Stderr, "[VERBOSE] Body: %s\n", truncateStr(result.Body)) } } From a64d1a5c6ad455fdf9745b3c100a998ffbecb71d Mon Sep 17 00:00:00 2001 From: Jamie Pond Date: Tue, 17 Feb 2026 19:06:25 -0800 Subject: [PATCH 10/10] wip --- cli/internal/runner/runner.go | 1 - cli/internal/utils/fn.go | 2 +- cli/internal/utils/fn_test.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/internal/runner/runner.go b/cli/internal/runner/runner.go index 3119100b..cde5a115 100644 --- a/cli/internal/runner/runner.go +++ b/cli/internal/runner/runner.go @@ -537,7 +537,6 @@ func interpolateExpectations(chainCtx *ChainContext, expect config.Expectation) return result, nil } - // interpolateConfig expands chain variables in a config func interpolateConfig(chainCtx *ChainContext, cfg *config.ConfigV1) (*config.ConfigV1, error) { result := *cfg // Copy diff --git a/cli/internal/utils/fn.go b/cli/internal/utils/fn.go index e8767d08..6cb54063 100644 --- a/cli/internal/utils/fn.go +++ b/cli/internal/utils/fn.go @@ -1,5 +1,5 @@ // Package utils provides generic utility functions. -package utils +package utils //nolint:revive // grab-bag utility package; no better name exists import ( "io" diff --git a/cli/internal/utils/fn_test.go b/cli/internal/utils/fn_test.go index 7eee8e81..55696651 100644 --- a/cli/internal/utils/fn_test.go +++ b/cli/internal/utils/fn_test.go @@ -1,4 +1,4 @@ -package utils +package utils //nolint:revive // matches package declaration in fn.go import "testing"