Skip to content

refactor(pipelineinspector): use oneof for operation/composition context#914

Merged
phisco merged 1 commit intocrossplane:mainfrom
phisco:pipeline-inspector-oneof-context
Feb 3, 2026
Merged

refactor(pipelineinspector): use oneof for operation/composition context#914
phisco merged 1 commit intocrossplane:mainfrom
phisco:pipeline-inspector-oneof-context

Conversation

@phisco
Copy link
Copy Markdown
Contributor

@phisco phisco commented Feb 2, 2026

Extract composition and operation metadata into separate message types and use a oneof to enforce that only one context type is set per step.

This allows the PipelineInspector to handle both Composition-based pipelines and Operation-based pipelines with a clear distinction at the protocol level.

Description of your changes

Yet another breaking change to the inspector interface to account for Operations too, see crossplane/crossplane#7025 (comment).

Fixes #

I have:

Need help with this checklist? See the cheat sheet.

@phisco phisco requested a review from a team as a code owner February 2, 2026 13:43
@phisco phisco requested a review from haarchri February 2, 2026 13:43
@phisco phisco force-pushed the pipeline-inspector-oneof-context branch 2 times, most recently from 0d285d8 to 62624b0 Compare February 2, 2026 13:47
Extract composition and operation metadata into separate message types
and use a oneof to enforce that only one context type is set per step.

This allows the PipelineInspector to handle both Composition-based
pipelines and Operation-based pipelines with a clear distinction at
the protocol level.

Signed-off-by: Philippe Scorsolini <p.scorsolini@gmail.com>
@phisco phisco force-pushed the pipeline-inspector-oneof-context branch from 62624b0 to 4f288e3 Compare February 2, 2026 13:48
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 2, 2026

📝 Walkthrough

Walkthrough

Restructures StepMeta in the Pipeline Inspector proto: adds google.protobuf.Timestamp and a oneof context holding new OperationMeta or CompositionMeta messages; moves previous composition-related fields into CompositionMeta and renumbers several StepMeta fields.

Changes

Cohort / File(s) Summary
Proto Schema Restructuring
apis/pipelineinspector/proto/v1alpha1/pipeline_inspector.proto
Adds CompositionMeta and OperationMeta messages; adds timestamp to StepMeta; replaces per-step composition fields with a oneof context { operation_meta, composition_meta }; renumbers existing StepMeta fields (trace_id, span_id, step_index, step_name, iteration, function_name) and relocates composition fields into CompositionMeta.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • negz
  • jbw976

Thank you — would you like me to generate a protobuf migration note or compatibility checklist for consumers of StepMeta?

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and descriptively summarizes the main change: refactoring StepMeta to use a oneof field for operation/composition context separation.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of extracting metadata into separate messages and using a oneof to enforce context type distinction.
Breaking Changes ✅ Passed All pipelineinspector Go changes are in newly-added generated protobuf files excluded from scope; no manually-written public Go code was removed or had breaking signature changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apis/pipelineinspector/proto/v1alpha1/pipeline_inspector.proto`:
- Around line 92-100: The new oneof "context" currently reuses field numbers 7
and 8 for OperationMeta and CompositionMeta which can break forward/backward
compatibility; instead add a reserved range for the previously-used field
numbers (e.g., reserve 7 to 12) and move the oneof entries to unused, higher
field numbers (choose numbers not overlapping timestamp = 13), updating the
oneof declaration (context) to use the new numbers for OperationMeta and
CompositionMeta, then regenerate stubs; ensure you reference the symbols
OperationMeta, CompositionMeta, context (oneof) and timestamp when making the
change so the proto evolution is explicit and old field numbers remain reserved.

@phisco phisco requested review from jbw976 and negz February 2, 2026 14:05
Copy link
Copy Markdown
Member

@jbw976 jbw976 left a comment

Choose a reason for hiding this comment

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

This looks correct according to the protobuf documentation on https://protobuf.dev/programming-guides/proto3/#oneof, and the generated go code looks reasonable as well ✅

message CompositionMeta {
// Name of the Composition defining this pipeline.
string composition_name = 7;
string composition_name = 1;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would composition revision be useful too?

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.

The composition revision is available through the composite at spec.crossplane.compositionRevisionRef

@phisco phisco merged commit a4cdda4 into crossplane:main Feb 3, 2026
10 of 11 checks passed
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.

2 participants