Discord: channel permission math for radio bots (#225 S1) #230
No Reviewers
Labels
Clear labels
area/ai-pipeline
area/auth
area/billing
area/correlation
area/discord
area/frontend
area/governance
area/growth
area/infra-deploy
area/legal
area/map
area/mqtt
area/node-ota
area/osint
area/recording-audio
area/sdr-radio
area/transcription
board
board:agenda
minutes:draft
minutes:final
role:ceo
role:cfo
role:cio
role:ciso
role:cmo
role:coo
role:cto
Scene/entity extraction, summarizer, AI providers, embeddings
AuthN/Z, roles, tenancy/org scoping, API keys, credentials
Plans, entitlements, AI spend accounting and caps
Incident correlation, linking, lifecycle, severity, corr_debug
Discord bot, radio bots, voice streams, bot tokens, webhooks
Web UI: Next.js app and the edge-node local dashboard
Board process, minutes, unattended runner, agent tooling
Go-to-market, outreach, cold email, discovery conversations
CI/CD, VM, registry, Firestore rules/indexes deploy, Terraform/Caddy
ToS, retention, licences/DAAs, CAN-SPAM, E&O, name suppression
Live map: pins, paths, tiles, legend, geocoding
Node-C2 MQTT, checkins, commands, node sweeper, dynsec
Node install, enrollment, OTA updater, image skew
External feeds: cameras, 511, ADS-B, AIS, outages, and their licences
Call capture, boundaries, PulseAudio, ring buffer, trimming, attribution
OP25 decode, SDR hardware/tuning, conventional, second SDR, mesh radio
STT, transcript correction, place verification, name accuracy
Board process: minutes and board-filed items
Needs board scoping at the next sitting; CEO removes the label once scoped
One exec pre-read, closed by CEO
CEO ruling; open until enacted
Filed by the CEO
Filed by the CFO
Filed by the CIO
Filed by the CISO
Filed by the CMO
Filed by the COO
Filed by the CTO
kind
behavior-bug
Wrong product behavior; the instrument reads it correctly
kind
measurement-bug
Corrupts the recording/instrument (debug data, evals, health checks), not behavior
priority
p0
Drop everything: prod broken, live exposure, or owner-ruled P0
priority
p1
Next up: blocks a gate, a customer, or core incident quality
priority
p2
Normal: real defect or planned work, schedule in turn
priority
p3
Low: minor, cosmetic, or someday
status
blocked
Waiting on an external party, spend, or another issue
status
in-progress
Branch or PR open against it
status
needs-decision
Waiting on an owner or board ruling before work
status
needs-info
Root cause or repro unknown; needs a reading first
type
bug
Something built is wrong: code, data, or a measurement
type
chore
Maintenance, refactor, tests, pinning, cleanup: no user-visible change
type
decision
A ruling to make or record: board minutes, owner calls, legal reviews
type
docs
Docs, runbooks, CLAUDE.md, skills, SOPs
type
feature
New capability or an extension of an existing one
type
security
Security, privacy, credential or tenant-isolation exposure
type
tracking
Tracker, checklist, initiative or punch-list spanning several changes
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: logan/server-26#230
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Slice S1 of #225 (permission math). New files only; no caller yet (S3 wires it into
pick_token).app/internal/discord_perms.pyeffective_permissions(guild, member, channel, *, now=None) -> (bits, trace)in Discord's order: owner → base (@everyone | member roles) → ADMINISTRATOR → @everyone overwrite → role overwrites (all denies, then all allows) → member overwrite → no View Channel = 0 → no Connect drops voice perms (discord.py's rule, so labels match the edge) → timeout keeps only View + Read History.tracemaps each missing radio permission to what removed it, e.g.denied by #dispatch's override for @Muted.check_voice(bits, channel, trace=None) -> {ok, is_voice, missing, reasons, user_limit, limit_bypass}. Only type-2 channels count. Labels match node-26#38_join_refusalexactly. Move Members = limit bypass; user limit is advisory.int(values above 2**53 tested). Malformed values raiseValueError, so S3 can treat them as unknown (fail-open) instead of a silent deny.tests/test_discord_perms.py: 37 tests, including the required-bits check againstdiscord_leases.RADIO_BOT_PERMISSIONS.Tests:
pytest tests/test_discord_perms.py37 passed; full c2-core suite 723 passed. flake8 (max 120) clean on both files.Not merged; the main session merges after review.
🤖 Generated with Claude Code
New pure module app/internal/discord_perms.py: - effective_permissions(guild, member, channel) -> (bits, trace), in Discord's order: owner, base (@everyone | member roles), ADMINISTRATOR, @everyone overwrite, role overwrites (all denies then all allows), member overwrite, no View Channel = 0, no Connect drops voice perms (as discord.py does, so labels match the edge), timeout keeps only View + Read History. - trace names what removed each radio permission, e.g. "denied by #dispatch's override for @Muted". - check_voice(bits, channel, trace=None) -> {ok, is_voice, missing, reasons, user_limit, limit_bypass}; only type-2 channels count; labels match node-26#38's _join_refusal ("View Channel", "Connect", "Speak"). - Permission strings parsed with int (values above 2**53 tested); malformed values raise ValueError so callers treat them as unknown. No caller yet; S3 wires it into pick_token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>S1 review: ship (not merged).
VoiceChannel.permissions_for. 0 mismatches on View/Connect/Speak/Move Members._join_refusalexactly. Required bits equalRADIO_BOT_PERMISSIONS.9e850fe: a guild payload with no @everyone role (or no permissions on it) used to become base 0, which is a definite deny. It now raises ValueError, so S3 treats it as unknown and fails open.check_voicereturns ok=False with missing=[] for channels that are not voice. Map that to bad_channel, not to missing_permissions.🤖 Generated with Claude Code