[Permissions] Schema checking gives unrelated errors #3185
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#3185
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Command bugs
Command name
[p]permissions acl setglobal/setserver/updateglobal/updateserverWhat cog is this command from?
Permissions
What were you expecting to happen?
Either get error about incorrect type of key or have Permissions automatically convert int to str.
What actually happened?
I got error "Top-level keys must be either
COGorCOMMAND"How can we reproduce this issue?
[p]permissions acl setglobal/setserver/updateglobal/updateserverThe above is reproduction for issue that was already fixed, but the unrelated errors can still happen for yaml file like this:
For anyone currently experiencing this issue:
Wrapping a numeric command in quotes will work fine.
I'm not sure if we should actually consider this as a bug with permissions, this was intended to catch a mistake like
and quoting the command makes sure it was an explicit choice. I think we can be a little more intelligent about it, or at least give a more useful error if/when it occurs so that if it is intentional, people know how to handle it.
The latter example wouldn't be valid because
trueis not a dict so it should still be possible to differentiate these 2 errors, right?We can definitely be smarter about the rror handling here. Just requires someone to update the schema handling for this.
Reopening, apparently the issue with unrelated errors was never fixed, and the related PR only fixed integer commands and empty dict rules - you can still get unrelated error, when you for example spell
defaultwronglyThe error message for non-boolean values is also currently broken. Example:
I think this could either:
voluptuousand think that we could get reasonable error messages with it, if we processed its exceptions ourselves (it does not have custom error messages likeschemathough it's not like what we do in Trivia really uses them in their intended way)Behoben in
93d1d683e: Die verschachteltenOr()s im Schema führten dazu, dass jeder Fehler in der Datei als "Top-level keys must be either COG or COMMAND" gemeldet wurde. Die Regeln werden jetzt von einem kleinen Validator geprüft, der den Fehler an der tatsächlich falschen Stelle meldet. Beidefault_but_spelt_incorrectlykommt jetzt "Keys under command names must be IDs (numbers) ordefault."; die Meldungen sind dieselben, bereits übersetzten Texte.Generated by Claude Code