You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PR Review: ci(worker): guard strategy selection in Worker Operations CI
Summary: This is a focused CI fix that correctly addresses the root cause of a failing Worker Operations test — a hardcoded strategy identifier that didn't match the one deployed in the emulator environment. The approach (runtime detection via the existing check_yieldvault_details.cdc script + env var injection with fallback) is sound.
Correctness & Logic
The core fix is correct. The mismatch between FlowYieldVaultsStrategies.TracerStrategy (hardcoded) and MockStrategies.TracerStrategy (actually deployed in the emulator) was clearly the cause of the failures described in the PR body. Detecting the strategy at runtime is the right approach.
The TracerStrategy-preference heuristic in the detection step is a reasonable tie-breaker when multiple strategies exist:
[^]]* only matches characters that are not ], so this works only if the entire supportedStrategies array appears on a single line in the Flow CLI output. If the CLI ever pretty-prints the result across multiple lines (e.g., one strategy per line), this grep produces nothing and the step exits with ❌ Could not parse supported strategy list.
A safer alternative would be to use flow scripts execute ... --output json (if supported) and parse with jq, or at minimum collapse the output to a single line first:
The fallback is the pre-fix hardcoded value (FlowYieldVaultsStrategies, not MockStrategies). This is fine for the CI path (env var is always injected), but local developers running run_worker_tests.sh directly without going through detect_strategy will still hit the original failure. A comment documenting this known limitation would help:
# NOTE: This fallback is for local development; CI injects STRATEGY_IDENTIFIER at runtime.# If running locally, ensure this matches the strategy deployed in your emulator.
STRATEGY_IDENTIFIER="${STRATEGY_IDENTIFIER:-A.045a1763c93006ca.FlowYieldVaultsStrategies.TracerStrategy}"
3. GITHUB_ENV injection — minimal but worth noting
If $STRATEGY_IDENTIFIER were to contain a newline (e.g., from a tampered emulator response), this would allow environment variable injection. In practice the risk is negligible here since the value comes from a locally running emulator and passes through grep | head -n 1, which prevents multi-line values. Still, using the heredoc delimiter syntax is the hardened pattern:
4. Step placed outside the # === RUN WORKER TESTS === section comment
Minor nit — the comment block # === RUN WORKER TESTS === appears after the new step, which makes it look like the strategy detection is infrastructure setup. Placing the comment above the detection step (or renaming it to # === DETECT RUNTIME CONFIG & RUN WORKER TESTS ===) would improve readability.
Positives
The detection step correctly echoes $YIELDVAULT_CHECK before parsing it, which will help future CI debugging.
Failing fast (exit 1) when the strategy list can't be parsed or is empty prevents silent test pollution.
The change is minimal and CI-only — no production contract changes.
The check_yieldvault_details.cdc script already exports supportedStrategies, so no additional Cadence changes were needed.
Summary
Area
Status
Root cause fix
✅ Correct
Regex parsing robustness
⚠️ May fail on multi-line output
Local dev experience
⚠️ Fallback still broken for direct local runs
GITHUB_ENV injection hardening
ℹ️ Low risk, but improvable
Code organization
ℹ️ Minor comment placement nit
The fix is good and unblocks the CI. The regex concern is the most likely to cause a future recurrence and is worth addressing before merging.
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
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.
Summary
Detect Strategy Identifierstep in.github/workflows/worker_tests.ymlbefore running worker tests.flow scripts execute ./cadence/scripts/check_yieldvault_details.cdc 0x045a1763c93006casupportedStrategiesTracerStrategy, otherwise use the first supported entrySTRATEGY_IDENTIFIERvia$GITHUB_ENVlocal/run_worker_tests.shwith a one-line change soSTRATEGY_IDENTIFIERis read from env when present:${STRATEGY_IDENTIFIER:-<previous-default>}fallback assignmentWhy It Was Failing Before
run_worker_tests.shalways used the hardcoded value:A.045a1763c93006ca.FlowYieldVaultsStrategies.TracerStrategyA.045a1763c93006ca.MockStrategies.TracerStrategy22385373935/ job64794799651:0Why It Works Now
Run Worker Tests.run_worker_tests.shnow picks that env value via shell fallback expansion, and uses it in its CREATE calls.Scope