Skip to content

docs(rfc): split TransformConfig build lifecycle into four phases#25848

Draft
pront wants to merge 5 commits into
masterfrom
pront-rfc-split-transform-lifecycle
Draft

docs(rfc): split TransformConfig build lifecycle into four phases#25848
pront wants to merge 5 commits into
masterfrom
pront-rfc-split-transform-lifecycle

Conversation

@pront

@pront pront commented Jul 15, 2026

Copy link
Copy Markdown
Member

Summary

Adds an RFC proposing to split the monolithic TransformConfig::build() into four explicit lifecycle phases: validate_structure, validate_environment, build (pure/sync), and start.

Motivation: build() currently conflates structural validation, environment validation, pure construction, and task spawning. This causes:

  • vector validate unable to exercise VRL compilation without a workaround (validate_env(), context key guards, stub enrichment tables)
  • Background tokio tasks spawned before a topology reload is committed -- leaks on rollback
  • Transform unit tests require spinning up background machinery

Scope: TransformConfig trait and all existing transforms. SourceConfig/SinkConfig are deferred.

Vector configuration

N/A -- no behavior change.

How did you test this PR?

RFC only -- no code changes.

Change Type

  • Bug fix
  • New feature
  • Dependencies
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

pront added 5 commits July 15, 2026 12:49
Replaces the two-step actions/cache save+restore for ~/.cargo with
Swatinem/rust-cache, which additionally caches target/ build artifacts.

Design:
  - Cache key = prefix + rustc hash + Cargo.lock hash (Swatinem default).
    PRs with unchanged Cargo.lock get an exact hit; PRs that bump
    Cargo.lock fall back to Swatinem's restore-keys prefix match and
    reuse most of master's target/.
  - save-if: master only. PRs restore but don't write.
  - cache-bin: false. Setup action installs cargo bins explicitly; letting
    Swatinem manage ~/.cargo/bin risks removing tools on persistent
    self-hosted release builders.

Validated on vectordotdev/ci-sandbox with a minimal binary using the
same rdkafka feature set:
  cold                    120s
  PR, src-only change      12s  (exact key hit,          -90%)
  PR, Cargo.lock bump       9s  (restore-key prefix hit, -93%)
Addresses three findings from the PR review:

1. Save on merge-queue runs (not only master).
   test.yml runs on pull_request + merge_group and never on master
   pushes, so cache-producing jobs like check-clippy never had a
   producer under the previous save-if: master-only condition.
   Merge-queue commits are the ones fast-forwarded onto master, so
   their caches are the closest possible representation of master state.

2. Trigger test workflow on setup action edits.
   The setup composite action's path was absent from changes.yml,
   letting setup changes ship without exercising the heavy consumers
   (clippy, tests). Added .github/actions/setup/** to the test-yml
   filter.

3. Differentiate matrix cache keys.
   Introduces optional cache-key-suffix input, passed through as
   Swatinem's 'key'. build-linux-cross's six targets share the same
   GITHUB_JOB and previously collided on the same cache key; now each
   target owns its own entry.
Switches Swatinem/rust-cache to shared-key 'workspace' so all Rust
jobs restore from one common cache entry. Removes the merge_group
save trigger: GitHub scopes caches by ref, and merge-queue refs are
isolated from master and PRs, so saves there aren't visible to any
consumer.

Producer for this cache is the new warm-cache.yml workflow (separate
commit), which runs on master and produces .rlib artifacts consumers
can link against.
Producer workflow for the shared cache introduced in the previous
commit. Runs on:
  - daily schedule (0 5 * * *)
  - push to master when Cargo.lock or toolchain files change (for
    immediate refresh after dep bumps)
  - manual workflow_dispatch

Seed command is 'cargo build --workspace --tests --locked' so cached
artifacts include .rlib files (not just .rmeta), which is required
for consumers like 'cargo test' to link deps without recompiling
them. Validated on ci-sandbox with a kafka-demo binary using the same
rdkafka feature set as Vector's kafka source/sink:

  Cold cargo build --tests          68s
  PR cargo test (warm, .rlib cache)  8s  (only workspace crate recompiled)

Compared with the wrong seed verb (cargo check, produces only .rmeta):
  PR cargo test (warm, .rmeta only) 50s  (all deps recompiled — no reuse)
@github-actions github-actions Bot added domain: ci Anything related to Vector's CI environment domain: rfc labels Jul 15, 2026
@datadog-vectordotdev

datadog-vectordotdev Bot commented Jul 15, 2026

Copy link
Copy Markdown

Pipelines  Tests

⚠️ Warnings

🚦 3 Pipeline jobs failed

Changelog | validate-changelog   View in Datadog   GitHub Actions

Test Suite | Check Markdown   View in Datadog   GitHub Actions

Test Suite | Test Suite   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7563720 | Docs | Give us feedback!

@pront pront added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: ci Anything related to Vector's CI environment domain: rfc no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant