Skip to content

test(permissions): add regression tests for deny/allow mixed chain precedence#2018

Open
okwn wants to merge 2 commits into
rtk-ai:developfrom
okwn:contrib/rtk/permissions-chain-test
Open

test(permissions): add regression tests for deny/allow mixed chain precedence#2018
okwn wants to merge 2 commits into
rtk-ai:developfrom
okwn:contrib/rtk/permissions-chain-test

Conversation

@okwn
Copy link
Copy Markdown

@okwn okwn commented May 21, 2026

No description provided.

okwn added 2 commits May 21, 2026 10:16
When user runs 'git log -1 --format='%H' HEAD' where HEAD is a merge
commit, rtk was adding --no-merges which filtered out the merge commit
itself and returned the second parent instead. This made 'git log -1'
return wrong SHAs for merge commits.

Fix: don't add --no-merges when user explicitly passes -n N or
--max-count=N. When a user specifies an exact count they expect exactly
that many commits, not filtered results. Also skip --no-merges if user
already passed --merges or --no-merges explicitly.

Fixes rtk-ai#2009.
…ecedence

Add 3 tests covering the missing deny/allow mixed chain scenario:
- test_chain_deny_short_circuits_allow: single denied segment short-circuits
- test_chain_deny_wins_over_partial_allow: deny wins in multi-segment chain
- test_chain_deny_wins_over_ask: deny > ask precedence in compound commands

These complement existing rtk-ai#1213 tests (which cover allow-only chains) by
covering the deny precedence edge cases that were not tested.

Fixes: rtk-ai#1213 (precedence documentation gap)
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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