Repository navigation
test: add strict managed workflow expression evaluator - #1960
Merged
Merged
Conversation
Keep shared test tooling beside workflow_scaffold.py and expose a JSON CLI for bats. Support literal string indexes and secrets lookups required by shipped workflows. Refs: #1959
Resolve context and JSON properties without case sensitivity and reject ambiguous keys. Add exact toJSON serialization, strict JSON constants, input strings, whole-value diagnostics, and clean CLI context errors. Refs: #1959
Share the runner number parser between literals and coercion, preserve doubles and signed zero, and apply string array indexes with conversion and bounds checks. Use simple uppercase mappings for equality and properties, reject non-finite CLI JSON, and name unsupported input types. Refs: #1959
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a strict GitHub Actions expression evaluator so test tooling can execute the managed workflows' runner wiring. Unknown syntax raises with the whole expression and position, even in short-circuited branches. Case-insensitive lookup closes a fork-safety regression that previously went undetected.
Type of Change
test-- Adding or updating testsModifiers
!)Changes Made
evaluate(expression, context), typedrender(value, context)for runs-on, and string-valuedrender_input(value, context)for step/reusable-job with values. The JSON CLI ispython -m tests.github_expression --context ctx.json --expr '...';--inputstringifies its result. Context-file errors exit 2 without a traceback.tests/besideworkflow_scaffold.pyandnix_helpers.py: shared pytest/bats infrastructure belongs here;packages/vig-utilsships consumer utilities. Document usage and strict limits in the module docstring.Changelog Entry
No changelog needed: internal test tooling with no user-visible impact; CLAUDE.md requires test changelog entries for user-visible impact.
Testing
Manual Testing Details
dbe30e27before implementation. Authorized toJSON RED: 53 failed, 95 passed (exit 1). A tokenizer quote regression separately failed twice before its fix.uv run --with pytest-xdist pytest tests/test_github_expression.py -n 4 --basetemp=$HOME/.cache/devkit-pytest/1959-r3: 177 passed, exit 0.ruff check,ruff format --check, andgit diff --check: exit 0. Commits run insidenix developwith hooks enabled.Checklist
Additional Notes
Prerequisite for S8 (#1935 / #1958). The expanded review requirements bring the helper and tests to 764 lines, exceeding the approximately 450-line target; coverage has been retained as directed by the review briefs. No full-suite local run on the shared host; pushed-head CI is the final gate.
Refs: #1959