Skip to main content
← Back to list
01Issue
BugClosedSwamp Club
AssigneesNone

model evaluate does not persist evaluated definitions for all models

Opened by swampadmin · 1/13/2025

Description

swamp model evaluate resolves expressions in model globalArguments and returns correct results, but only persists evaluated definitions to .swamp/definitions-evaluated/ for some models — not all. This causes swamp workflow run --last-evaluated to fail with "No previously evaluated definition found" for the missing models.

Steps to Reproduce

  1. Create 10 model instances of various @john/tailscale-* types, all with expressions in globalArguments:

    globalArguments:
      tailnet: ${{ model.my-settings.input.globalArguments.tailnet }}
      apiKey: ${{ model.my-settings.input.globalArguments.apiKey }}
      baseUrl: ${{ model.my-settings.input.globalArguments.baseUrl }}
  2. Run: swamp model evaluate --all --json

    • Output reports all 10 models evaluated successfully with hadExpressions: true
  3. Check disk:

    find .swamp/definitions-evaluated/ -name "*.yaml" -type f | wc -l
    # Returns: 5  (should be 10)
  4. Only 5 of 10 models are persisted. The result is deterministic across repeated runs.

Models that ARE persisted:

  • @john/tailscale-device
  • @john/tailscale-user
  • @john/tailscale-settings
  • @john/tailscale-acl
  • @john/tailscale-dns

Models that are NOT persisted:

  • @john/tailscale-auth-key
  • @john/tailscale-contact
  • @john/tailscale-log-config
  • @john/tailscale-posture
  • @john/tailscale-webhook
  1. Evaluating missing models individually also fails to persist:

    swamp model evaluate my-keys --json  # reports success
    find .swamp/definitions-evaluated/ -name "d12cb1c2*.yaml" | wc -l  # returns 0
  2. Running a workflow that uses a non-persisted model:

    swamp workflow run <name> --last-evaluated --json
    # Fails: "No previously evaluated definition found for 'my-log-config'"

Expected Behavior

swamp model evaluate (both --all and individual) should persist ALL evaluated model definitions to .swamp/definitions-evaluated/, mirroring how swamp workflow evaluate persists to .swamp/workflows-evaluated/.

Actual Behavior

  • model evaluate returns correct results for all models
  • Only some models are persisted to disk (5 of 10 in our case)
  • The result is deterministic — the same 5 succeed/fail every time
  • No error is reported for the models that fail to persist

Impact

This blocks workflow run --last-evaluated for any workflow that references a model whose evaluated definition wasn't persisted. Combined with the separate bug where workflow run doesn't evaluate expressions at runtime (#537), this means workflows using non-persisted models cannot be executed at all.

Environment

  • swamp version: 20260227.225234.0-sha.2b2b28be
  • OS: macOS Darwin 22.6.0

Summary

This affects the model evaluation persistence layer. The evaluate logic works correctly (expressions are resolved and returned), but the file write step silently fails for some model types. The fix would involve investigating why the persistence step in model evaluate only writes for a subset of models — potentially a race condition in parallel writes, a path construction issue for certain type names, or a silent error being swallowed.

02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.