Simplify: references to avoid hardcoding and confusion#1000
Draft
harshadixit12 wants to merge 2 commits into
Draft
Simplify: references to avoid hardcoding and confusion#1000harshadixit12 wants to merge 2 commits into
harshadixit12 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors declarative planner/executor reference handling by replacing hardcoded sentinel strings ("", "[unknown]") with named constants and helper constructors/methods, to reduce ambiguity and improve readability across planning, dependency resolution, and execution.
Changes:
- Introduce
RefIDPendingCreation/RefIDPendingLookupplus helper constructors andIsResolved/NeedsResolutionmethods for reference/parent IDs. - Update planners and the reference resolver to use the new helpers instead of hardcoded sentinel strings.
- Update dependency resolution and executor logic/tests to use the new semantics consistently.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/declarative/planner/types.go | Adds reference/parent sentinel constants plus helper constructors and resolution methods. |
| internal/declarative/planner/resolver.go | Replaces "[unknown]" with RefIDPendingCreation in reference resolution. |
| internal/declarative/planner/portal_planner.go | Uses NewPendingLookupRef for portal auth-strategy references. |
| internal/declarative/planner/planner.go | Merges resolver results into existing ReferenceInfo while preserving lookup fields. |
| internal/declarative/planner/event_gateway_virtual_cluster_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_tls_trust_bundle_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_static_key_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_schema_registry_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_listener_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_data_plane_certificate_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/event_gateway_backend_cluster_planner.go | Uses NewPendingLookupRef for gateway ID resolution. |
| internal/declarative/planner/dependencies.go | Switches dependency checks to IsResolved/NeedsResolution helpers. |
| internal/declarative/planner/dependencies_test.go | Updates tests to use RefIDPendingCreation. |
| internal/declarative/executor/portal_operations_test.go | Updates executor portal test to use planner.RefIDPendingCreation. |
| internal/declarative/executor/executor.go | Centralizes unresolved-ID checks via constants and NeedsResolution/IsResolved. |
| internal/declarative/executor/executor_test.go | Updates executor tests to use planner.RefIDPendingCreation. |
Collaborator
|
@harshadixit12 please close or revive this PR when you are able. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rather than hardcoding ID as "" and "[unknown]", refactoring to use constants, and functions for initialising the types. This will make the code more readable.