[PR #2807] [MERGED] policy: fix autogroup:self propagation and optimize cache invalidation #2872

Closed
opened 2025-12-29 04:19:27 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2807
Author: @kradalby
Created: 10/19/2025
Status: Merged
Merged: 10/23/2025
Merged by: @kradalby

Base: mainHead: kradalby/2802-acl-self-propagate


📝 Commits (4)

  • f96a374 integration: add test to validate acl propagation
  • 7a8d888 policy: fix autogroup:self propagation and optimize cache invalidation
  • aba890f integration: more eventually and timing handling
  • f0281a1 chore: fix formatting and linting issues

📊 Changes

32 files changed (+3300 additions, -1752 deletions)

View changed files

📝 .github/workflows/test-integration.yaml (+1 -0)
📝 cmd/hi/tar_utils.go (+1 -1)
📝 hscontrol/capver/capver_generated.go (+11 -12)
📝 hscontrol/derp/derp_test.go (+0 -1)
📝 hscontrol/mapper/batcher_lockfree.go (+0 -1)
📝 hscontrol/mapper/builder.go (+10 -7)
📝 hscontrol/policy/pm.go (+4 -0)
📝 hscontrol/policy/policy.go (+0 -61)
📝 hscontrol/policy/policy_test.go (+0 -815)
hscontrol/policy/policyutil/reduce.go (+71 -0)
hscontrol/policy/policyutil/reduce_test.go (+841 -0)
📝 hscontrol/policy/v2/filter_test.go (+0 -1)
📝 hscontrol/policy/v2/policy.go (+262 -28)
📝 hscontrol/policy/v2/policy_test.go (+235 -0)
📝 hscontrol/state/node_store.go (+38 -5)
📝 hscontrol/state/state.go (+14 -2)
📝 hscontrol/types/config.go (+5 -5)
📝 hscontrol/types/node.go (+19 -0)
📝 hscontrol/types/node_test.go (+176 -0)
📝 integration/acl_test.go (+596 -158)

...and 12 more files

📄 Description

autogroup:self uses per-node filters, causing stale peer maps when nodes
change (global filter hash unchanged). Fix by detecting autogroup:self
in SetNodes() and forcing peer map rebuild.

Replace blanket cache clearing with granular invalidation of affected
nodes only. Move ReduceFilterRules to policyutil package and add
NodeView.HasNetworkChanges() for network change detection.

Fixes #2802

Claude was used in this PR.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2807 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 10/19/2025 **Status:** ✅ Merged **Merged:** 10/23/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/2802-acl-self-propagate` --- ### 📝 Commits (4) - [`f96a374`](https://github.com/juanfont/headscale/commit/f96a374984eb8692a47c1d1d2f287b78ab8f64ef) integration: add test to validate acl propagation - [`7a8d888`](https://github.com/juanfont/headscale/commit/7a8d8886ded2f079d93e45d6022cc5345da28d3d) policy: fix autogroup:self propagation and optimize cache invalidation - [`aba890f`](https://github.com/juanfont/headscale/commit/aba890f19f0cbd41d6dd974b7ff6396c98a978f2) integration: more eventually and timing handling - [`f0281a1`](https://github.com/juanfont/headscale/commit/f0281a15a68eb18f80cc60dbe90788ce95dbf35e) chore: fix formatting and linting issues ### 📊 Changes **32 files changed** (+3300 additions, -1752 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test-integration.yaml` (+1 -0) 📝 `cmd/hi/tar_utils.go` (+1 -1) 📝 `hscontrol/capver/capver_generated.go` (+11 -12) 📝 `hscontrol/derp/derp_test.go` (+0 -1) 📝 `hscontrol/mapper/batcher_lockfree.go` (+0 -1) 📝 `hscontrol/mapper/builder.go` (+10 -7) 📝 `hscontrol/policy/pm.go` (+4 -0) 📝 `hscontrol/policy/policy.go` (+0 -61) 📝 `hscontrol/policy/policy_test.go` (+0 -815) ➕ `hscontrol/policy/policyutil/reduce.go` (+71 -0) ➕ `hscontrol/policy/policyutil/reduce_test.go` (+841 -0) 📝 `hscontrol/policy/v2/filter_test.go` (+0 -1) 📝 `hscontrol/policy/v2/policy.go` (+262 -28) 📝 `hscontrol/policy/v2/policy_test.go` (+235 -0) 📝 `hscontrol/state/node_store.go` (+38 -5) 📝 `hscontrol/state/state.go` (+14 -2) 📝 `hscontrol/types/config.go` (+5 -5) 📝 `hscontrol/types/node.go` (+19 -0) 📝 `hscontrol/types/node_test.go` (+176 -0) 📝 `integration/acl_test.go` (+596 -158) _...and 12 more files_ </details> ### 📄 Description autogroup:self uses per-node filters, causing stale peer maps when nodes change (global filter hash unchanged). Fix by detecting autogroup:self in SetNodes() and forcing peer map rebuild. Replace blanket cache clearing with granular invalidation of affected nodes only. Move ReduceFilterRules to policyutil package and add NodeView.HasNetworkChanges() for network change detection. Fixes #2802 Claude was used in this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 04:19:27 +01:00
adam closed this issue 2025-12-29 04:19:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2872