IFC-2304: Runtime resolution of webhook custom headers#8597
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (4)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Coding Plan
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 |
Merging this PR will improve performance by 38.93%
Performance Changes
Comparing Footnotes |
c2b4f1f to
f9d4190
Compare
…hen environment variable is not resolved successfully
f9d4190 to
f0f6996
Compare
ogenstad
left a comment
There was a problem hiding this comment.
LGTM. Nice work! I think we can revisit some of the typing parts once we've locked down the namespace and consider our options at that point.
d8323d0
into
pmi-20260227-webhooks-ifc-2272
* IFC-2303: CoreKeyValue schema definitions for webhook custom headers (#8590) * IFC-2257 new unit test against httpx regression * IFC-2304: Runtime resolution of webhook custom headers (#8597) * IFC-2334: Webhook cache invalidation on KeyValue changes (#8602) * IFC-2337: Invalidate webhook cache on reconcile_all (#8603) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Why
Webhook custom headers defined via
CoreKeyValueschema entities (from IFC-2303) need to be resolved at send time. Static headers pass their value through directly, while environment variable headers must read fromos.environon the worker at dispatch time. Without this, the schema-level header definitions have no runtime effect.Closes IFC-2304
What changed
os.environon the worker when the webhook fires. Missing env vars are logged as warnings and skipped (no crash).Content-Type, giving full control over the HTTP request.CoreKeyValuepeers are mapped to a lightweight runtime model that carries through the send pipeline.to_cache()/from_cache()roundtrip so cached webhooks retain their header configuration.How to review
backend/infrahub/webhook/models.py— theWebhookHeadermodel and changes to_assign_headers()backend/infrahub/webhook/tasks/process.py— the extraction logic and plumbing intoconvert_node_to_webhookbackend/tests/unit/webhook/How to test
Impact & rollout
CoreEnvironmentVariableKeyValueheaders must be set on the worker environment.Checklist