feat(workflows/condition-evaluator): support shorthand path and unquoted numeric/boolean RHS#1777
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughExtends the workflow condition evaluator to accept shorthand node paths ( ChangesCondition Evaluator Shorthand and Unquoted Literals
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@auth-service/server.js`:
- Around line 159-162: The redirect builds an absolute Location from unvalidated
headers (x-forwarded-proto and x-forwarded-host) in the request handler where
proto, host, base, and safeRd are used; validate and normalize proto to only
"http" or "https" (default to "https" if invalid), validate host against a safe
pattern (hostname with optional port) or fall back to req.headers['host'] or a
configured canonical host, and construct the redirect URL using a safe URL
builder (e.g., URL) ensuring host and rd are properly encoded before calling
res.writeHead(302, { Location: ... }); replace the direct template string with
this validated/normalized approach to prevent malformed or unsafe Location
values.
In `@docker-compose.yml`:
- Around line 72-73: Update docker-compose.yml to use Docker compose required
variable interpolation for DOMAIN and ACME_EMAIL so parsing fails early: replace
all occurrences of ${DOMAIN} with ${DOMAIN:?DOMAIN is not set} and ${ACME_EMAIL}
with ${ACME_EMAIL:?ACME_EMAIL is not set}; specifically update the traefik label
keys like traefik.http.routers.archon.rule and any traefik.certresolver/email
labels (and the other two places where DOMAIN/ACME_EMAIL are used) to use the :?
form so compose-parse fails fast when those env vars are missing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ee47bfc3-6203-4176-a009-b53b4e522588
📒 Files selected for processing (7)
.env.exampleauth-service/server.jsdocker-compose.ymlpackages/workflows/src/condition-evaluator.test.tspackages/workflows/src/condition-evaluator.tstraefik-dynamic.ymltraefik.yml
…ted numeric/boolean RHS Accept `$nodeId.field` as shorthand for `$nodeId.output.field`, and allow bare numeric/boolean RHS (`$n.exit_code == 0`, `$n.passed == true`) so number and flag comparisons no longer have to quote their literal. The change is confined to the atom regex plus the path/RHS resolution in evaluateAtom; the AND/OR splitter, resolveOutputRef, and numeric coercion path are untouched, so every existing `when:` clause evaluates identically. Shorthand refs with a sub-field (`$n.field.sub`) are rejected fail-closed. Closes coleam00#1763
4f9e2d7 to
457798c
Compare
Review SummaryVerdict: blocking-issues This PR adds two useful features to the condition evaluator — shorthand path syntax ( Blocking issues
Suggested fixes
Minor / nice-to-have
Compliments
Reviewed via maintainer-review-pr workflow (Pi/Minimax). Aspects run: code-review, error-handling, test-coverage, comment-quality. |
…absent-field case Address review feedback: remove the stale task-id prefix from the shorthand/unquoted RHS section comments, and add a test asserting an absent shorthand field resolves to '' (parsed: true) rather than a parse error, matching the canonical $node.output.field semantics.
|
Thanks for the thorough review! A couple of clarifications. On the two "blocking" items — the
On the two suggested fixes — both applied in
The minor comment-wording nits I'm leaving as-is for now, since the capture-group docblock already covers the group semantics — happy to trim if you feel strongly. |
Summary
when:clauses force the verbose$nodeId.output.fieldform and only accept single-quoted RHS literals — even for numbers, so$test.exit_code > '0'quotes a number as a string.$nodeId.fieldshorthand (≡$nodeId.output.field) and bare numeric/boolean RHS (== 0,== true);evaluateAtomresolves the canonical-vs-shorthand path and picks quoted-or-unquoted RHS.resolveOutputRef, and the numeric coercion path are untouched. No new operators, parentheses, or function calls. Every currently-validwhen:clause evaluates identically. Shorthand with a sub-field ($n.field.sub) is rejected fail-closed.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
fieldargLabel Snapshot
risk: lowsize: Sworkflowsworkflows:condition-evaluatorChange Metadata
featureworkflowsLinked Issue
Validation Evidence (required)
bash:-node workflow through the CLI (workflow run --no-worktree) exercising the real DAG executor.condition_evaluateddebug logs confirmed shorthand path resolves to the correct field and unquoted int/bool/decimal RHS evaluated correctly; the$probe.passed == falsenode was correctly skipped. Temp workflow removed afterward.Security Impact (required)
NoNoNoNoCompatibility / Migration
YesNoNoHuman Verification (required)
$n.field), unquoted integer/decimal/boolean RHS, canonical.output.form still valid, mixed quoted+unquoted in AND/OR compounds, both unit-tested and run through the live DAG executor.$n.field.sub→ fail-closed), empty quoted RHS (== ''), negative integers, false-case skip.Side Effects / Blast Radius (required)
when:clause evaluation on DAG nodes.condition_parse_failed/condition_evaluateddebug logs already in place.Rollback Plan (required)
dag_node_skipped_condition_parse_errormessages on previously-valid clauses (none expected).Risks and Mitigations
Summary by CodeRabbit
New Features
Bug Fixes / Safety
Tests