Skip to content

http rule: the success expression is CEL; tighten and document the rule - #40

Open
flostadler wants to merge 6 commits into
mainfrom
flo/http-rule-cel
Open

flostadler wants to merge 6 commits into
mainfrom
flo/http-rule-cel

Conversation

@flostadler

@flostadler flostadler commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What the http rule does

delivery.http(...) and delivery.httpOutput(...) build a when rule for a Stage. Pulumi Cloud calls a URL on an interval, and the gate passes when successExpression is true. A request error or a check that does not pass never fails the run by itself; the gate keeps waiting until a check passes or the timeout (24h by default) ends the run.

What was wrong

  • The descriptions said successExpression is JMESPath. It is a CEL expression (https://cel.dev).
  • The example in the http function description, status == 'ok', was wrong: status is the HTTP status code.
  • The provider offered headersEnvironment, which the service refuses.
  • The limits were missing: https only, public addresses only, no redirects, header and body sizes, the five methods, interval and timeout ranges and defaults.

What changes

  • Cherry-picked from the repository owner: method is an enum (GET, POST, PUT, PATCH, HEAD, default GET), interval is at most 1h with default 1m, timeout defaults to 10s, and headersEnvironment is removed. Its generated files conflicted with the current layout, so they are regenerated rather than merged.
  • Every successExpression description now says CEL, names the variables status, headers and body, and shows a valid example. The url, headers, body, name and rule descriptions state the limits and the behavior above.
  • docs/_index.md gets an "HTTP gates" section with an example, the inputs, the variables, and lists of supported and unsupported CEL operations.
  • The http rule gets an overall timeout: how long the gate may wait in total, counted from when the gate opens for a run (1m to 168h, default 24h, at least interval). When it passes without a check passing, the run fails and the message names the rule and the timeout. A request error or a check that does not pass still never fails the run by itself. The time allowed for one request is now requestTimeout (1s to 20s, default 10s).
  • Tests use valid CEL expressions.
  • schema.json and all five SDKs are regenerated with make generate.
  • The provider keeps its light validation (required fields, duration format and ranges). It does not validate CEL; the service does.

Breaking change

Anyone who set headersEnvironment loses the input. It never worked, because the service refuses a rule that sets it; use secret headers. The timeout of an http rule changes meaning: it was the time allowed for one request, and is now the total wait, so a value below 1m is refused. Use requestTimeout for the request. The syntax of successExpression is CEL, not what the old description named.

Generated SDK note

The Python SDK's minimum pulumi version goes from 3.231.0 to 3.269.0. That is not part of the http change: the SDKs on main were last generated before the repository pinned its Pulumi version, and regenerating with the pinned version (3.276.0) sets this floor. The other SDK manifests do not change.

Release note

Merge and release only once Pulumi Cloud accepts http rules; until then the service refuses the rule at registration.

Test plan

  • make generate, then git status shows only intended changes.
  • make test_provider passes.
  • make build (provider and Go, Node.js, Python, .NET and Java SDKs) passes.
  • make TESTTAGS=go test: Go compile and preview and YAML preview pass. The HCL preview passes only with PULUMI_IGNORE_AMBIENT_PLUGINS=true, because a locally installed HCL plugin shadows the pinned one.
  • make lint reports the same findings as on main.

🤖 Generated with Claude Code

flostadler and others added 2 commits November 19, 2026 12:37
… headersEnvironment

interval is at most 1h and defaults to 1m, timeout defaults to 10s, and
method is an enum (GET, POST, PUT, PATCH, HEAD) that defaults to GET.
Invoke applies the defaults; literal rules keep empty values.

BREAKING: headersEnvironment is removed from the http rule because the
service never supported it. The repo keeps no changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The successExpression descriptions named JMESPath and the http function
example used status as a string. The expression is CEL, status is the HTTP
status code, and body and headers are available. Describe the expression,
the url, header and body limits and the gate behavior in the schema, add an
HTTP gates section to the guide, use valid expressions in tests, and
regenerate the schema and SDKs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Does the PR have any schema changes?

Generated by schema-tools v0.8.1.

Found 4 breaking changes:

Functions

  • 🔴 "delivery:index:http":
    • inputs:
      • 🔴 missing input "headersEnvironment"
      • 🟡 "method" type changed from "string" to "#/types/delivery:index:HTTPMethod"

Types

  • 🔴 "delivery:index:Rule":
    • properties:
      • 🔴 "headersEnvironment" missing
      • 🟡 "method" type changed from "string" to "#/types/delivery:index:HTTPMethod"

New types: 1

Maintainer note: consult the runbook for dealing with any breaking changes.

flostadler and others added 2 commits November 19, 2026 12:57
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
timeout is now how long the gate may wait in total (1m to 168h, default
24h, at least the interval); the run fails when it passes without a check
passing. The time allowed for one request is requestTimeout (1s to 20s,
default 10s). Update descriptions, validation, tests and the guide, and
regenerate the schema and SDKs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@flostadler
flostadler marked this pull request as ready for review November 19, 2026 15:35
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@flostadler

Copy link
Copy Markdown
Contributor Author

@pulumi-eon /review

🤖 Claude Code (claude-fable-5-2), on flostadler's behalf

1 similar comment
@flostadler

Copy link
Copy Markdown
Contributor Author

@pulumi-eon /review

🤖 Claude Code (claude-fable-5-2), on flostadler's behalf

@eon-pulumi-reviewer

eon-pulumi-reviewer Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Review Verdict: Comment Only

HIGH risk: Public schema and all five SDKs change, with breaking changes (headersEnvironment removed, timeout changes meaning, Python SDK floor bump) and release gated on service support. That is a one-way door a person should own. The code is correct and tests pass; only three nits.


View session · Was this review helpful? Yes · No

@eon-pulumi-reviewer eon-pulumi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the full diff (provider, docs, schema, tests), ran go test ./... in provider/ (passes), and checked that the typed (validateRule) and raw (validateRuleValue) validators agree on method, interval, requestTimeout, timeout and the timeout-versus-interval rule. The logic is sound and the new tests cover the limits well. The breaking changes (headersEnvironment removed, timeout changes meaning, method becomes an enum, a Python SDK floor bump) are called out in the description as AGENTS.md asks. I found no blocking issues, only three nits.

I am not approving. This changes the public schema and all five SDKs, which a person should sign off on. The docs also state service-side limits (https only, public addresses, header and body sizes, the CEL subset, the 24h default wait) that nothing in this repository enforces, and the description says the change must not be released before Pulumi Cloud accepts http rules. A maintainer should confirm those claims and the release timing against the service. I did not regenerate the SDKs to confirm they match a fresh make generate; CI checks that.

Specialist passes: child sessions

Comment thread provider/provider_test.go Outdated
request.Dependencies = nil
request.Inputs = request.Inputs.Set("environment", property.New(property.NewMap(map[string]property.Value{
"A": property.New("x").WithDependencies([]resource.URN{other}),
"A": property.New("status == 200").WithDependencies([]resource.URN{other}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit — tests

This test builds a Job environment map to check where property dependencies attach. No http rule is involved, so changing "x" to "status == 200" looks like a stray find-and-replace (the sibling value "y" was left alone).

Suggested change
"A": property.New("status == 200").WithDependencies([]resource.URN{other}),
"A": property.New("x").WithDependencies([]resource.URN{other}),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Code (claude-fable-5-2), on flostadler's behalf

Fixed in 2fc0532.

Comment thread provider/rule_functions.go Outdated
a := req.Input
method, interval, requestTimeout, timeout := a.Method, a.Interval, a.RequestTimeout, a.Timeout
if method == nil {
method = &defaultHTTPMethod

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit — bug

&defaultHTTPMethod hands every http() result a pointer to one package-level variable. A later write through *rule.Method would change the default for every rule. Copy the value instead.

Suggested change
method = &defaultHTTPMethod
m := defaultHTTPMethod
method = &m

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Code (claude-fable-5-2), on flostadler's behalf

Fixed in 2fc0532.

Comment thread provider/rule_functions_test.go Outdated
{name: "interval 60s", interval: "60s"},
{name: "interval 1h", interval: "1h"},
{name: "interval 61m", interval: "61m", wantErr: "at most 1 hour"},
{name: "interval 90s.5", interval: "90.5s", wantErr: "whole-second"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit — tests

The subtest name interval 90s.5 does not match its input 90.5s.

Suggested change
{name: "interval 90s.5", interval: "90.5s", wantErr: "whole-second"},
{name: "interval 90.5s", interval: "90.5s", wantErr: "whole-second"},

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Claude Code (claude-fable-5-2), on flostadler's behalf

Fixed in 2fc0532.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant