diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-30 21:11:46 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-30 21:11:46 +0900 |
| commit | 1c79bee8f3c8fe20582afa96527cd298c043daa5 (patch) | |
| tree | 1c28055f6296d7866ea3916a65a005be2fb1a6bc /engine/src/test/kotlin/dev | |
| parent | 68052ce335ae11c4cb10a388848b42571bfc65b9 (diff) | |
| download | LunaticChat-1c79bee8f3c8fe20582afa96527cd298c043daa5.tar.gz LunaticChat-1c79bee8f3c8fe20582afa96527cd298c043daa5.tar.bz2 LunaticChat-1c79bee8f3c8fe20582afa96527cd298c043daa5.zip | |
fix(paper): stop the command category logging on every tree build
Three findings from review of #296.
Brigadier evaluates a `requires` predicate when it builds the command tree it
sends to a player - on every join and every updateCommands() - not when someone
is refused. The denial line sitting there put one entry per gated node per
player in the log, burying the command results the category exists to show. It
is dropped rather than moved: a hidden node is never reached by an execution, so
there is no refusal path to log from.
`all` was honoured by `debug: all` and `/lc debug all on` but not by
`categories: [all]`, which resolved to an unknown name - leaving `enabled: true`
with nothing switched on, reported as off by /lc status, explained only by a
warning in the log. The word now lives in one place that all three read.
Two dumps in the same second left one file, because the name is only accurate to
the second and the write replaces. Reproducing a bug means dumping either side of
the step that triggers it, so the second one now takes a suffix.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'engine/src/test/kotlin/dev')
| -rw-r--r-- | engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/debug/DebugCategoriesTest.kt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/debug/DebugCategoriesTest.kt b/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/debug/DebugCategoriesTest.kt index 44ccb86..5931c60 100644 --- a/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/debug/DebugCategoriesTest.kt +++ b/engine/src/test/kotlin/dev/m1sk9/lunaticChat/engine/debug/DebugCategoriesTest.kt @@ -68,6 +68,23 @@ class DebugCategoriesTest { } @Test + fun `all names every category wherever a category may be named`() { + // The same word works as `debug: all`, as `categories: [all]` and as `/lc debug all on`; + // reading it as a category name in only two of the three would log nothing for the third. + assertEquals(DebugCategory.entries.toSet(), DebugCategories.parse("all").active) + assertEquals(DebugCategory.entries.toSet(), DebugCategories.resolve(listOf("all")).active) + assertEquals(emptyList(), DebugCategories.resolve(listOf("ALL")).unknown) + } + + @Test + fun `all beside a named category still names every category`() { + val parsed = DebugCategories.resolve(listOf("velocity", "all")) + + assertEquals(DebugCategory.entries.toSet(), parsed.active) + assertEquals(emptyList(), parsed.unknown) + } + + @Test fun `every category is reachable by the key operators write`() { DebugCategory.entries.forEach { category -> assertEquals(category, DebugCategory.fromKey(category.key)) |
