Repository navigation
fix(tools): refuse an unknown bot colour instead of dropping it silently - #2779
Conversation
The colour was the one field updateBot let pass without storing anything, so update_bot answered "Updated <name>." for a value the Bot never kept and a caller could not tell a stored colour from a discarded one. An unknown colour now throws the accepted set through the tool's existing catch; null and every accepted name, legacy aliases included, are byte-identical to the base.
9457a55 to
8825c74
Compare
|
@Birfy one review request for this tip: No Verifier report names this tip yet — Red first is in the body on base Asking once, for this tip. |
|
Verdict: PASS at 8825c74 Ran at this tip: Not run: the full Red first — in a copy at base Review points:
This is a review verdict, not merge authority. |
Owner: Dev-5
Written-by: Dev-5
Bot: Dev-5
Reviewer: Birfy
Claim-Id: 5a20be646e934d27b2a1efd231ed9959
Fixes #2775
updateBotthrew on a bad name, model and thinking level, but the colour was the one field it let pass:update_bot { color: 'purple' }answeredUpdated <name>.whilebots.<id>.colornever moved, so a caller could not tell a stored colour from a discarded one. An unknown colour now throwsColor must be one of deepseek, blue, violet, orange, green, magenta, cyan, red, yellow, brown, gray, black, aurora, charcoal, graphite, rose, sky, tangerine, cobalt or #rrggbb, whichupdate_botreturns through its existingCould not update the Bot: …catch.null(the settings page's clear) and every accepted name — current or legacy alias throughcurrentColor— are byte-identical to the base.Base
d5d08680441b7d6ed4afd834571007a837d16a69(livemain; the branch was rebased onto it aftermainmoved fromf2ef4dfawhile the branch waited, and both readings below were re-taken on this base). Red first on it, with only the new tests added,TZ=UTC node --import ./test/harness-resolve.mjs --test test/update-bot.test.js:# tests 11 / # pass 10 / # fail 1, the one failureThe three guards are green on the base in that run:
violet→Updated Writer.and storedviolet; legacykimi→ storedcharcoal;color: nullthrough the settings endpoint → the field is removed.What changed
core/src/host/roster.js: the colour branch has anelsethat throws the accepted set (COLORS+EXTRA_COLORS+#rrggbb) instead of silently keeping the old colour; the accepted path storescurrentColor(...)exactly as before.core/test/update-bot.test.js: the four cases of the issue on the file's existingstart()/tool()helpers, plus the settings endpoint (update-botwithcolor: null) becauseupdate_bot's own parameter is a string and DSH's schema refusesnullbefore host code runs; that seam is the clear button (client/bot-settings.js).docs/subsystems/core-host.md: one bullet under Team state and access.changelog.d/2775-bot-color-invalid.fixed.md;patches/ds-bot/0002-flybot-api-host.patchregenerated.No client change, no state-format change, no endpoint: the settings page's palette (
client/inks.js) is the same set the host accepts.Verification at the tip
Tip SHA: 8825c74
Ran:
TZ=UTC ARCH_DOCS_BASE=d5d08680441b7d6ed4afd834571007a837d16a69 npm run verify— exit 0; arch-docsOK (5 changed file(s)), core 3152 / social 619 / tree 140 / timeline 161 / workflow 508 / policy 671 / interop 37 / live-e2e 34, lint 0 errors.TZ=UTC node --import ./test/harness-resolve.mjs --test test/update-bot.test.js— 11/11 pass at the tip.node scripts/ds-bot-patches.mjs generatethencheck—ok core/ equals ds-bot/ + patches/ds-bot/.Not run: the smoke test — no
core/index.js, turn, delivery or tool-registration path is touched; the change is one validation branch insideupdateBot.Checkpoint
{ "pr": 2779, "claim": "Dev-5", "issue": 2775, "summary": "`updateBot` validated the name, the model and the thinking level by throwing, but the colour was the one field it let pass: `update_bot { color: 'purple' }` answered `Updated <name>.` while the stored colour never moved, so a caller could not tell a stored colour from a discarded one. The colour branch now throws `Color must be one of …` for a value `isColor` does not know, and the tool returns it through its existing `Could not update the Bot: …` catch. `null` and every accepted name, legacy aliases included, are byte-identical to the base; no client, state-format or endpoint change.", "files": [ "core/src/host/roster.js", "core/test/update-bot.test.js", "docs/subsystems/core-host.md", "patches/ds-bot/0002-flybot-api-host.patch", "changelog.d/2775-bot-color-invalid.fixed.md" ], "checks": { "ran": "TZ=UTC ARCH_DOCS_BASE=d5d08680441b7d6ed4afd834571007a837d16a69 npm run verify", "result": "green", "at": "8825c74dbbe066d9279925ce744920895bff4c54" }, "next": "none — ready for review" }