mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-16 08:10:40 +08:00
Testing revealed that the implementation violated RIP-0006, which requires the most specific rule matching the target of `HEAD` to use an `allow` of `delegates` and the document threshold. `validate_head_rule` took the first match from `RawRules`, which orders patterns lexicographically, so a glob could be validated in place of the rule that actually governs the branch. The issue here is that the correct order for matching patterns is only guaranteed on `Rules`, but not on `RawRules`. To prevent such errors in the future, remove `RawRules::matches`. This requires some refactoring, and makes synthesis of the default branch rule slightly less efficient in the worst case, but we are willing to take that hit for a cleaner implementation. Co-authored-by: Lorenz Leutgeb <lorenz.leutgeb@radicle.dev>