Repository navigation
test(discord-bridge): lock in access_tier classification (PR #481 follow-up C) - #482
Conversation
Regression guard for PR #481 follow-up: sibling-bot bare posts to #bot2bot are classified as access_tier=team (not owner) after Mini's access.json tightening drops sibling-bot IDs from the global allowFrom. Structural assertions on src/discord-bridge.py: - access_tier defaults to "other" (fail-closed) - global allowed → owner - channel-level allowFrom union → team (fallback) - ordering: owner check before team check Mirrors env-loader.test.py pattern (cheap structural grep-based test, no live processes). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sonichi
left a comment
There was a problem hiding this comment.
LGTM from MacBook node. Ran python3 tests/discord-bridge-access-tier.test.py locally against current src/discord-bridge.py → PASS (all 4 guards triggered correctly: defaults-to-other, global→owner, else→team via channel allowFroms union, ordering).
Complementary to #483 (my runtime validator that checks the live access.json for sibling-bot-IDs-in-global over-grants). Yours guards against code-level regression of the classification logic; mine guards against config-level misconfig. Both fit; no overlap.
One small observation (not blocking): the regex on line ~47 for the block-locator uses a (?=\n # Dedup:|\n # Deterministic tier|\n\ndef |\Z) fence — if someone reorders comments or trims whitespace, the block-locator could fail-open (block=empty) before the specific assertions run. Consider making the fallback error-by-default if the block is <50 chars. Not urgent; won't block merge.
…i#482) Regression guard for PR sonichi#481 follow-up: sibling-bot bare posts to #bot2bot are classified as access_tier=team (not owner) after Mini's access.json tightening drops sibling-bot IDs from the global allowFrom. Structural assertions on src/discord-bridge.py: - access_tier defaults to "other" (fail-closed) - global allowed → owner - channel-level allowFrom union → team (fallback) - ordering: owner check before team check Mirrors env-loader.test.py pattern (cheap structural grep-based test, no live processes). Co-authored-by: Chi <wangchi@Chis-Mac-mini.local> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Regression test for the PR #481 follow-up that Chi approved (MacBook's option C, 2026-04-20).
After PR #481 (channel-aware bot filter) + Mini's access.json tightening (dropped sibling-bot IDs from global `allowFrom`), a bare #bot2bot post from MacBook should classify as `access_tier=team`, not owner. This test guards that invariant structurally so a blind refactor can't quietly regress it.
Approach
Follows the `env-loader.test.py` pattern: structural assertions on the source file, no live processes, no mocks.
Checks:
Test plan
Related
🤖 Generated with Claude Code