Skip to content

refactor: convert IR map fields to slices to ensure deterministic Dee…#7953

Merged
arkodg merged 6 commits intoenvoyproxy:mainfrom
Junnygram:refactor/ir-map-to-slice
Feb 1, 2026
Merged

refactor: convert IR map fields to slices to ensure deterministic Dee…#7953
arkodg merged 6 commits intoenvoyproxy:mainfrom
Junnygram:refactor/ir-map-to-slice

Conversation

@Junnygram
Copy link
Copy Markdown
Contributor

@Junnygram Junnygram commented Jan 14, 2026

refactor: convert IR map fields to slices to ensure deterministic DeepEqual

This PR refactors the Intermediate Representation (IR) to replacing map fields with slices of structs. This ensures consistent ordering of elements, which is critical for deterministic DeepEqual comparisons and preventing unnecessary xDS updates.

Key changes:

  • Replaced map[string]string with []MapEntry in IR structs.
  • Replaced map[string]CustomTag with []CustomTagMapEntry.
  • Decoupled TrafficFeatures.Telemetry from API types to enforce slice usage.
  • Updated gatewayapi translator to convert API maps to sorted IR slices.
  • Updated xds/translator to consume slice-based IR.
  • Updated test data inputs and regenerated output snapshots.

Fixes #7783.

@Junnygram Junnygram requested a review from a team as a code owner January 14, 2026 10:44
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 14, 2026

Deploy Preview for cerulean-figolla-1f9435 canceled.

Name Link
🔨 Latest commit cccddb4
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/697ef9feb3484900084fd7bd

@Junnygram Junnygram force-pushed the refactor/ir-map-to-slice branch 2 times, most recently from e1ab70a to e53faad Compare January 14, 2026 10:49
@Junnygram Junnygram force-pushed the refactor/ir-map-to-slice branch 2 times, most recently from 71aa5ec to 8853dd2 Compare January 17, 2026 09:37
for k, v := range m {
res = append(res, MapEntry{Key: k, Value: v})
}
slices.SortFunc(res, func(a, b MapEntry) int {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: can you check if this style

sort.Slice(r.Gateways, func(i, j int) bool {
is faster ?

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jan 17, 2026

thanks @Junnygram this is great !
added a minor comment to avoid cmp and use below style

sort.Slice(mySlice, func(i, j int) bool {
		return mySlice[i].Ky < mySlice[j].Key
	})

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jan 25, 2026

hey @Junnygram can you rebase and also help fix the new map that was added for tracing, tia

@Junnygram Junnygram force-pushed the refactor/ir-map-to-slice branch from e7e1913 to ce95e57 Compare January 25, 2026 20:53
arkodg
arkodg previously approved these changes Jan 28, 2026
Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@arkodg arkodg requested review from a team and jukie January 28, 2026 04:56
@zirain zirain force-pushed the refactor/ir-map-to-slice branch from 0b91684 to 6d2e822 Compare January 28, 2026 05:13
@zirain
Copy link
Copy Markdown
Member

zirain commented Jan 30, 2026

@Junnygram can you rebase with main branch?

@Junnygram Junnygram force-pushed the refactor/ir-map-to-slice branch 2 times, most recently from 9dd6df3 to dde4a8f Compare January 30, 2026 23:19
@zirain zirain force-pushed the refactor/ir-map-to-slice branch from dde4a8f to 07d514b Compare January 31, 2026 02:01
@zirain zirain requested a review from arkodg January 31, 2026 02:01
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jan 31, 2026

there's an issue with rebase, can you rebase properly and only push your changes

Use sort.Slice instead of slices.SortFunc and cmp.Compare.

Fix undefined apisv1 in zz_generated.deepcopy.go.

Signed-off-by: Junnygram <[email protected]>
@Junnygram Junnygram force-pushed the refactor/ir-map-to-slice branch from 0f193a7 to 81624bf Compare January 31, 2026 21:53
zirain
zirain previously approved these changes Jan 31, 2026
@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Jan 31, 2026

lint is failing

zirain
zirain previously approved these changes Feb 1, 2026
@Junnygram
Copy link
Copy Markdown
Contributor Author

hi @arkodg I've addressed the linting issues by fixing the indentation in the YAML test data files. I also regenerated the test snapshots (make generate) to ensure they match the formatting changes. CI should be green now.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2026

Codecov Report

❌ Patch coverage is 91.01124% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.73%. Comparing base (c724a4f) to head (cccddb4).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
internal/xds/translator/tracing.go 55.55% 3 Missing and 1 partial ⚠️
internal/ir/utils.go 92.59% 1 Missing and 1 partial ⚠️
internal/xds/translator/accesslog.go 89.47% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7953      +/-   ##
==========================================
+ Coverage   73.67%   73.73%   +0.05%     
==========================================
  Files         240      241       +1     
  Lines       36488    36546      +58     
==========================================
+ Hits        26884    26948      +64     
+ Misses       7699     7693       -6     
  Partials     1905     1905              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arkodg arkodg merged commit c3f2982 into envoyproxy:main Feb 1, 2026
47 of 49 checks passed
cnvergence pushed a commit to cnvergence/gateway that referenced this pull request Feb 3, 2026
envoyproxy#7953)

* refactor: convert IR map fields to slices to ensure deterministic DeepEqual

Addresses issue envoyproxy#7852.

Signed-off-by: Junnygram <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
cnvergence added a commit that referenced this pull request Feb 3, 2026
* e2e: speed tracing tests (#8124)

* e2e: speed tracing tests

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix(translator): allow single-label backends in host mode (#8123)

Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* ci: release json report (#8107)

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix oidc flakiness (#8119)

* fix oidc flakiness

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: skip_test_workflow doesn't exist (#8116)

This also uses grouped redirects to satisfy shellcheck SC2129.

Signed-off-by: Dylan M. Taylor <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix e2e test panic (#8109)

fix e2e test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* chore: bump func-e to v1.4.0 (#8105)

bump func-e to v1.4.0

Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: route idle timeout (#8058)

* fix: route idle timeout

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* address comments

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* add test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* docs: add Mirakl to adopters list (#8138)

Signed-off-by: Thierry Wandja <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* docs: add security warning to control plane extensions (#7967)

chore(docs): add warnings about control plane extensions

Signed-off-by: Guy Daich <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* chore: add lint for release notes filenames (#8137)

* chore: add lint for release notes filenames

Signed-off-by: zirain <[email protected]>

* remove 1.7.0

Signed-off-by: zirain <[email protected]>

* fix lint

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: remove global logger in message package (#8131)

* fix: remove global logger in message package

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* docs: fix url result of regex rewrite (#7864)

* Update http-urlrewrite.md

Signed-off-by: Sadmi Bouhafs <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* chore: log skipped xds (#8132)

log skipped xds

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* docs: fixes for OPA sidecar + Unix Domain Socket task (#8142)

Signed-off-by: Matt Miller <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: basic auth validation (#8053)

* fix basic auth validation

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: controller cache-sync readiness check (#7430)

Signed-off-by: Karol Szwaj <[email protected]>

* fix: replace context.TODO with timeout context in config dump (#8122)

* fix: replace context.TODO with timeout context in config dump

Uses context.WithTimeout instead of context.TODO() to enable
proper cancellation and prevent indefinite hangs when Kubernetes
API is slow or unavailable.

Fixes #8121

Signed-off-by: jaffar <[email protected]>

* Make config dump timeout configurable with 30s default

- Add Timeout field to ConfigDump struct
- Add DefaultConfigDumpTimeout constant (30s)
- Add getTimeout() helper that returns configured timeout or default
- Update Collect() to use cd.getTimeout() instead of hardcoded value

Signed-off-by: jaffar <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* refactor: convert IR map fields to slices to ensure deterministic Dee… (#7953)

* refactor: convert IR map fields to slices to ensure deterministic DeepEqual

Addresses issue #7852.

Signed-off-by: Junnygram <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix links in releasing and develop docs (#8141)

* fix links in releasing and develop docs

Signed-off-by: Karol Szwaj <[email protected]>

* update quickstart link

Signed-off-by: Karol Szwaj <[email protected]>

---------

Signed-off-by: Karol Szwaj <[email protected]>

* docs: add provider guide for entra (#7977)

* docs: add provider guide for entra

Signed-off-by: Oliver Bähler <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* chore: clean up test output files (#8154)

clean up test output files

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: TCPRoute mTLS didn't work (#8152)

* fix: remove auto HTTP config on TCP cluster

Signed-off-by: zirain <[email protected]>

* fix lint

Signed-off-by: zirain <[email protected]>

* add e2e

Signed-off-by: zirain <[email protected]>

* fix e2e

Signed-off-by: zirain <[email protected]>

* fix comment

Signed-off-by: zirain <[email protected]>

* fix

Signed-off-by: zirain <[email protected]>

* fix resource name

Signed-off-by: zirain <[email protected]>

* address Arko's comment

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* v1.7.0-rc2 release notes (#8163)

* v1.7.0-rc2 release notes

Signed-off-by: Karol Szwaj <[email protected]>

* fix the date

Signed-off-by: Karol Szwaj <[email protected]>

---------

Signed-off-by: Karol Szwaj <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
Signed-off-by: Adrian Cole <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Dylan M. Taylor <[email protected]>
Signed-off-by: Thierry Wandja <[email protected]>
Signed-off-by: Guy Daich <[email protected]>
Signed-off-by: Sadmi Bouhafs <[email protected]>
Signed-off-by: Matt Miller <[email protected]>
Signed-off-by: jaffar <[email protected]>
Signed-off-by: Junnygram <[email protected]>
Signed-off-by: Oliver Bähler <[email protected]>
Co-authored-by: zirain <[email protected]>
Co-authored-by: Adrian Cole <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: Dylan M. Taylor <[email protected]>
Co-authored-by: Thierry Wandja <[email protected]>
Co-authored-by: Guy Daich <[email protected]>
Co-authored-by: Sadmi Bouhafs <[email protected]>
Co-authored-by: Matt Miller <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Co-authored-by: jaffar keikei <[email protected]>
Co-authored-by: Olaleye <[email protected]>
Co-authored-by: Oliver Bähler <[email protected]>
Inode1 pushed a commit to Inode1/gateway that referenced this pull request Feb 23, 2026
envoyproxy#7953)

* refactor: convert IR map fields to slices to ensure deterministic DeepEqual

Addresses issue envoyproxy#7852.

Signed-off-by: Junnygram <[email protected]>
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.

Convert IR maps into a Slice of Structs

4 participants