Final whole-branch review of M4-b. Six findings.
1. The player could press his way into an invalid draft. can_take_bonus()
refused an already-picked skill; can_pick() did not consider the bonus, so
the guard was one-directional. Take athletics as the human's bonus, pick it
again from the Sellsword's pool, and the draft is one NewGame.validate
rejects — the invalid draft "he did not cause and cannot see" that
set_calling's own comment forbids. Fixed in the DRAFT (the screen owns no
rules): can_pick() now mirrors can_take_bonus(), so the chip goes inert, the
idiom the pool row already uses for a race-granted skill. Recoverable: hand
the bonus back and the chip is live again. Both directions tested.
2. The theme drift guard STILL could not fail. ThemeKeys.ALL is stylebox
variations only, by its own docstring — so the six FONT roles the builder
sets fonts, sizes and colours for were entirely unguarded. Changing
Palette.CREAM and skipping the rebuild shipped a stale game_theme.tres with
the suite green (proven, on the committed test). Adds ThemeKeys.FONT_ROLES
beside ALL (never inside it — ALL's contract is relied on), compares fonts,
font sizes and font colours as well as styleboxes, and names the variation
AND the property that drifted. Plus a meta-guard that walks the builder's own
output and fails if a variation it styles is in neither collection — this is
the second time this guard has been fixed by "enumerate the right set", and
nothing was checking the set.
3. §13: the CTA label piped NewGame.validate's diagnostics straight to the
player. On the game's SECOND SCREEN he read "hedge_mage picks 2 skills, got
0". Now CreationCopy.error_line maps them to authored copy — "name yourself",
"choose two more proficiencies" (the number DERIVED from Callings.skill_count,
never written down), "one more proficiency, any of them — take it" — with an
authored fallback for anything unmapped, because §13 means the unmapped case
still speaks in voice. validate's strings are untouched: they are a contract,
so they are translated in the presentation layer, not rewritten.
4. §2 had no test that fails if the boundary is breached. The emit test compared
the signal to draft.to_creation() — both sides move together. Pins the seven
contract keys exactly, and feeds construct a hostile creation dict carrying an
18 in every stat, asserting the sheet is still roll_attributes(seed) + spend.
Every other test in test_new_game passed with that breach in place.
5. Three holes: the orphan sweep skipped PoolRow (a stray Pool6 rendered unbound
and visible, suite green — the exact bug the test exists to catch, in the one
row it forgot); the §7 sweep forbade "luck" but not Luck.BANDS' descriptors,
which are worse than the number (the player would re-roll until his Luck read
well — calculable Luck); and the DM panel's composition hardcodes the article
"a", so a vowel-initial calling would break it silently — guarded in the
content parity test, which names the template as the reason.
6. The calling card printed "talent second_wind". Four of seven talents carry an
underscore. Humanised, the way skill_label() already does. The test that
pinned the RAW form is moved to the full derived phrase ("talent second wind")
so it still fails if someone hardcodes a talent into the format string.
Every guard was proven by re-breaking the code and watching the named test go
red (docs/traps.md). Suite 302 -> 315, content build green, no new warnings.
Report: .superpowers/sdd/final-review-fix-report.md
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.6 KiB
GDScript
70 lines
2.6 KiB
GDScript
# client/scripts/theme/theme_keys.gd
|
|
class_name ThemeKeys
|
|
extends RefCounted
|
|
## Type-variation names for game_theme.tres. Scripts set `theme_type_variation`
|
|
## to one of these so a typo is a compile-time symbol error, not a silent miss.
|
|
## §2: presentation.
|
|
|
|
const PRIMARY_CTA := &"PrimaryCTA"
|
|
const TAB := &"Tab"
|
|
const TAB_ACTIVE := &"TabActive"
|
|
const CHIP := &"Chip"
|
|
const DOCK_BUTTON := &"DockButton"
|
|
const PARCHMENT_BUTTON := &"ParchmentButton"
|
|
const ITEM_TILE := &"ItemTile"
|
|
const ITEM_TILE_EMPTY := &"ItemTileEmpty"
|
|
const PARCHMENT_CARD := &"ParchmentCard"
|
|
const PARCHMENT_INSET := &"ParchmentInset"
|
|
const DARK_PANEL := &"DarkPanel"
|
|
const SELECT_CARD := &"SelectCard" # race/calling card: a Button whose `pressed` is CHOSEN
|
|
const SKILL_CHIP := &"SkillChip" # toggle: unpicked / picked / granted-so-inert
|
|
const CHOSEN_TAG := &"ChosenTag" # the little crimson "CHOSEN" flag
|
|
const PRIMARY_TAG := &"PrimaryTag" # the little gold "PRIMARY" flag
|
|
const PRIMARY_CARD := &"PrimaryCard" # the ability card ringed as the calling's primary
|
|
|
|
## Font roles (Label type-variations carrying a font, not a stylebox). Kept
|
|
## separate from ALL below, which is stylebox variations + their base type only.
|
|
const HEADING := &"Heading"
|
|
const ACCENT := &"Accent"
|
|
const MONO := &"Mono"
|
|
const TITLE_LOGO := &"TitleLogo"
|
|
const TITLE_KICKER := &"TitleKicker"
|
|
const SECTION_LABEL := &"SectionLabel"
|
|
|
|
## Every FONT role + the base Control type it decorates. Deliberately NOT folded
|
|
## into ALL — ALL's "stylebox variations only" contract is relied on elsewhere
|
|
## (test_every_variation_resolves, and the styleboxes the screens set). Kept as a
|
|
## second enumerable set so a guard that means "every variation the builder
|
|
## touches" can iterate BOTH and never silently cover only half of them: the
|
|
## drift guard used to iterate ALL alone, so a font, a font size or a font colour
|
|
## could change in the builder and the committed .tres stay stale, suite green.
|
|
const FONT_ROLES := {
|
|
HEADING: "Label",
|
|
ACCENT: "Label",
|
|
MONO: "Label",
|
|
TITLE_LOGO: "Label",
|
|
TITLE_KICKER: "Label",
|
|
SECTION_LABEL: "Label",
|
|
}
|
|
|
|
## Every variation name + the base Control type it decorates. The builder and the
|
|
## test both iterate this so they can never drift apart.
|
|
const ALL := {
|
|
PRIMARY_CTA: "Button",
|
|
TAB: "Button",
|
|
TAB_ACTIVE: "Button",
|
|
CHIP: "Button",
|
|
DOCK_BUTTON: "Button",
|
|
PARCHMENT_BUTTON: "Button",
|
|
ITEM_TILE: "PanelContainer",
|
|
ITEM_TILE_EMPTY: "PanelContainer",
|
|
PARCHMENT_CARD: "PanelContainer",
|
|
PARCHMENT_INSET: "PanelContainer",
|
|
DARK_PANEL: "PanelContainer",
|
|
SELECT_CARD: "Button",
|
|
SKILL_CHIP: "Button",
|
|
CHOSEN_TAG: "Label",
|
|
PRIMARY_TAG: "Label",
|
|
PRIMARY_CARD: "PanelContainer",
|
|
}
|