Skip to content

fix(#74): align runner expression functions with Actions - #143

Open
fullsend-ai-coder[bot] wants to merge 3 commits into
mainfrom
agent/74-runner-expression-functions
Open

fullsend-ai-coder[bot] wants to merge 3 commits into
mainfrom
agent/74-runner-expression-functions

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Since #35, an expression that reads a runner-only value (github.workspace, github.token, job.status ...) is left for the runner. The emulator runner then evaluates the whole expression itself. This PR closes the remaining gaps between that evaluator, the server's evaluator and Actions.

Emulator runner (src/runners/emulator/runner.py)

  • contains, startsWith and endsWith now compare strings case-insensitively. contains over an array matches items with Actions' loose equality (_loose_equal), so 1 matches '1' and null matches ''. An object contains nothing. Example: ${{ github.workspace && contains('ABC', 'a') }} now renders true, as on GitHub.
  • The parser now handles object filters (.* and [*]). An accessor after a filter applies to each element and keeps the elements that have the property (even when it is null), as on the server. The name token no longer swallows a trailing dot. A bare filter or index path (${{ steps.x.outputs.* }}) now goes through the parser instead of the dotted-path lookup.

Server (src/app/services/workflow_expressions.py, workflow_service.py)

  • _json_literal now escapes braces inside the encoded JSON strings directly, instead of swapping them for U+FDD0/U+FDD1 while encoding. Before, a value that already held one of those characters, or the plain text �, came back as a brace.
  • build_job_graph now refuses a job when any step's uses: contains ${{. GitHub rejects such a workflow. This follows the existing container/services refusal: one failing step with an ::error:: annotation. The reference is never rendered, and the message gives only the step numbers, so nothing from it (such as a deferred ${{ github.token }}) is evaluated or logged.

Ledger: docs/bugs/fixed/emulator-runner-expression-functions-differ-from-actions.md, indexed in PLAN.md.

Testing

New tests in tests/actions/test_render_github_parity.py. Each one renders on the server with a runner-only operand, finishes on the emulator runner, and compares with the value Actions gives:

  • contains('ABC', 'a'), startsWith('ABC', 'ab'), endsWith('ABC', 'bc') and server-bound strings: true on both the server and the runner.
  • Array membership with mixed-type items [1, "Two", true, null].
  • Filter accessors (.*.name, [*].name, contains(... .*.name, 'C'), bare steps.x.outputs.*) on a step output only the runner resolves.
  • Titles containing U+FDD0/U+FDD1, their escape text, and }} with ${{ github.token }} round-trip unchanged, both deferred and as server-resolved text.
  • An expression in a step's uses: refuses the job. The refusal fails, and its output contains neither the reference nor the job token.

All six new tests fail on main except the control test test_a_step_uses_without_an_expression_is_kept. ruff check (v0.17.3) and the pre-commit-hooks checks pass on the changed files. They were run directly because pre-commit could not fetch hook repositories in the sandbox. Full suite: 1632 passed, 2 failed. Both failures fail the same way on main in the sandbox: test_runner_shutdown (the step does not stop on the shutdown signal) and test_security_headers (it needs a built src/frontend/dist).

Notes

  • An expression that starts with a call and reads steps.* without a runner-only operand (for example ${{ toJSON(steps.x.outputs.y) }} in env:) is still evaluated on the server, where steps is empty. That predates this issue and is not changed here.
  • Composite-action steps on the runner whose uses: holds an expression are not checked. The issue covers workflow steps.

🤖 Generated with Claude Code


Closes #74

Post-script verification

  • Branch is not main/master (agent/74-runner-expression-functions)
  • Secret scan passed (gitleaks — fdad287855ddb6f1e85a045e407b1f09948ade1c..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

The emulator runner finishes expressions the server defers beside a
runner-only value. A few functions there still differed from Actions
and from the server's evaluator.

- Runner: contains, startsWith and endsWith compare strings
  case-insensitively; contains over an array matches items with
  Actions' loose equality (_loose_equal), as the server does.
- Runner: parse object filters (.* and [*]) with the server's
  element-wise semantics; a bare filter or index path goes through
  the parser.
- Server: _json_literal escapes braces inside the encoded JSON
  strings directly instead of swapping them for U+FDD0/U+FDD1,
  which turned those characters (and their escape text) into braces.
- Server: build_job_graph refuses a job whose step uses: holds an
  expression, as GitHub rejects such a workflow. The reference is
  neither rendered nor named in the refusal.

Tests in tests/actions/test_render_github_parity.py render each case
on the server with a runner-only operand, finish it on the emulator
runner and compare with Actions' value. Ledger entry added under
docs/bugs/fixed/ and indexed in PLAN.md.

Verification: ruff 0.17.3 and the pre-commit-hooks checks were run
directly on the changed files (pre-commit could not fetch hook repos
in the sandbox); all passed. Full suite: 1632 passed, 2 failed; both
failures (test_runner_shutdown shutdown signal, and security headers
needing a built frontend/dist) fail identically on main in this
sandbox.

Closes #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Dec 3, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:12 PM UTC · Completed 11:18 PM UTC

Commit: e293626 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.42

@fullsend-ai-review fullsend-ai-review Bot added the risk/moderate PR risk: moderate label Dec 3, 2026
@fullsend-ai-review

This comment has been minimized.

@fullsend-ai-review

This comment has been minimized.

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 11:21 PM UTC · Completed 11:44 PM UTC

Commit: e293626 · View workflow run →

Runtime: claude · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $0.81

fullsend-ai-coder Bot and others added 2 commits December 3, 2026 23:42
…zation

Reusable-workflow materialization substitutes inputs into step uses:
before build_job_graph runs, so an input-based reference such as
actions/checkout@${{ inputs.ref }} lost its expression and the job
ran. Record the steps holding an expression before substitution and
have build_job_graph refuse on that record too.

Note: pre-commit could not fetch hook repositories in the sandbox and
ruff is not installed, so hooks were not run. Full suite: 3 failures,
none from this change (test_composite_env fails identically without it;
test_runner_shutdown and test_security_headers are environmental).

Addresses #143

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (bot-triggered)

Addressed the single review finding (expression uses: lost during reusable-workflow materialization) in the earlier commit, and this run fixed the ruff import-block spacing in tests/actions/test_workflow_call_fidelity.py that blocked the pre-commit gate. Full test suite had 3 failures unrelated to this change (test_composite_env, test_runner_shutdown, test_security_headers).

Fixed (1):

  1. Step uses expressions are checked after reusable-workflow materialization has already rendered them (src/app/services/workflow_service.py) [f_ecf3ac62914216b2, fixed]: Materialization now records steps whose uses: holds an expression before input substitution, and build_job_graph refuses on that record as well, so actions/checkout@${{ inputs.ref }} is refused instead of being rendered to @v4. A test covers the materialize_reusable_workflows then build_job_graph path.

Tests: passed

Decision points
  • How to catch expression uses: references that materialization would otherwise render away (alternatives: Validate before substitution at each materialization level, Preserve a marker through materialization; rationale: Recording the affected steps before substitution and having build_job_graph honour that record keeps the single refusal point in build_job_graph.)

Finding threads:

  • f_ecf3ac62914216b2 (fixed): replied and resolved — thread

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push

Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 11:47 PM UTC · Completed 11:53 PM UTC

Commit: c8772b7 · View workflow run →

Runtime: pi · Model: sonnet → claude-sonnet-5-5 · Effort: high · Cost: $1.03

@fullsend-ai-review

Copy link
Copy Markdown

Risk Assessment: moderate (2/5)

Details

Moderate risk change aligning runner expression functions with GitHub Actions across 7 files and 373 lines, with clear issue scope and no protected paths, but modifying existing workflow services without feature flag gating.

@fullsend-ai-review

fullsend-ai-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Looks good to me

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review December 3, 2026 23:53

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/moderate PR risk: moderate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emulator runner: match Actions in the expression functions a deferred expression can reach

1 participant