Skip to content

refactor(graph): rewrite builder as a multi stage compiler pipeline#1074

Open
a-hilaly wants to merge 1 commit intokubernetes-sigs:mainfrom
a-hilaly:compilers-ftw
Open

refactor(graph): rewrite builder as a multi stage compiler pipeline#1074
a-hilaly wants to merge 1 commit intokubernetes-sigs:mainfrom
a-hilaly:compilers-ftw

Conversation

@a-hilaly
Copy link
Member

@a-hilaly a-hilaly commented Feb 26, 2026

The old Builder was a single ~2k+ line file that parsed, validated,
resolved, linked, type-checked, compiled, and assembled a graph all in
one pass. This made it hard to test individual concerns, hard to produce
good error messages, and hard to reason about what data was available at
which point in the process. This commit replaces it with a proper staged
pipeline where each phase has a clear input, a clear output, and no
hidden coupling to the others.

The stages are Parse, Validate, Resolve, Link, TypeCheck, Generate, and
Assemble. Each one produces a typed intermediate representation that the
next stage consumes, so the builder itself becomes a short function that
chains them together. Errors are now classified as terminal or retriable
at the source, which lets the controller decide retry behavior without
string matching.

The outcome is better local reasoning, safer evolution, and clearer runtime
behavior. Errors are produced at the phase where they originate and carry
retry semantics from the source, allowing controllers to make deterministic
requeue decisions without string matching.

d2(1)

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 26, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 26, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 26, 2026
@a-hilaly
Copy link
Member Author

/test presubmits-integration-tests

@a-hilaly a-hilaly force-pushed the compilers-ftw branch 5 times, most recently from 476544a to 9d1670b Compare February 27, 2026 01:18
The old Builder was a single ~2k+ line file that parsed, validated,
resolved, linked, type-checked, compiled, and assembled a graph all in
one pass. This made it hard to test individual concerns, hard to produce
good error messages, and hard to reason about what data was available at
which point in the process. This commit replaces it with a proper staged
pipeline where each phase has a clear input, a clear output, and no
hidden coupling to the others.

The stages are `Parse`, `Validate`, `Resolve`, `Link`, `TypeCheck`, `Compile`, and
`Assemble`. Each one produces a typed intermediate representation that the
next stage consumes, so the builder itself becomes a short function that
chains them together. Errors are now classified as terminal or retriable
at the source, which lets the controller decide retry behavior without
string matching.

The outcome is better local reasoning, safer evolution, and clearer runtime
behavior. Errors are produced at the phase where they originate and carry
retry semantics from the source, allowing controllers to make deterministic
requeue decisions without string matching.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants