feat: agent guardrails, headless smoke test, and guardrails CI #58
Closed
Timmy
wants to merge 1 commits from
feat/agent-guardrails-and-smoke-test into main
pull from: feat/agent-guardrails-and-smoke-test
merge into: Timmy_Foundation:main
Timmy_Foundation:main
Timmy_Foundation:burn/dismantle-16
Timmy_Foundation:ci/retrigger-smoke
Timmy_Foundation:fix/resource-counter-animations
Timmy_Foundation:fix/ci-a11y-workflow
Timmy_Foundation:sprint/issue-101
Timmy_Foundation:burn/20260413-0400-fix-ui-bugs
Timmy_Foundation:fix/phase-transition-overlay
Timmy_Foundation:burn/20260413-0348-a11y-workflow-fix
Timmy_Foundation:fix/issue-100-ci-workflows
Timmy_Foundation:burn/20260413-0339-beacon-ui-fixes
Timmy_Foundation:fix/a11y-workflow-game-js-removal
Timmy_Foundation:feat/canvas-combat-visualization
Timmy_Foundation:beacon/polish
Timmy_Foundation:burn/20260413-0220-qa-fixes
Timmy_Foundation:burn/20260413-0202-qa-bug-sweep
Timmy_Foundation:burn/20260412-1220-polish-2
Timmy_Foundation:burn/fix-bilbo-randomness
Timmy_Foundation:sprint/issue-95
Timmy_Foundation:burn/fix-bilbo-drone-screenreader
Timmy_Foundation:sprint/issue-tutorial-fix
Timmy_Foundation:burn/fix-critical-bugs
Timmy_Foundation:qa/playtest-report
Timmy_Foundation:perplexity/dead-code-audit
Timmy_Foundation:burn/20260412-1227-sound
Timmy_Foundation:feat/symbolic-guardrails-1776010892175
Timmy_Foundation:feat/golden-ratio-drones
Timmy_Foundation:feat/gofai-npc-logic
Timmy_Foundation:burn/20260412-1150-a11y-fix
Timmy_Foundation:feat/beacon-mega-1775996281802
Timmy_Foundation:burn/a11y-aria-labels
Timmy_Foundation:burn/20260412-0757-polish
Timmy_Foundation:burn/20260412-0720-mobile-touch-polish
Timmy_Foundation:feat/better-rate-display
Timmy_Foundation:burn/20260411-1845-export-import-keyboard-help
Timmy_Foundation:polish
Timmy_Foundation:burn/20260411-1627-export-import-shortcuts
Timmy_Foundation:burn/20260411-1507-fix-debuff-corruption
Timmy_Foundation:beacon/polish-tutorial-onboarding
Timmy_Foundation:burn/20260411-0022-accessibility-aria-labels
Timmy_Foundation:burn/20260410-2215-boosted-rates-click-power
Timmy_Foundation:feat/modular-engine-v2
Timmy_Foundation:fix/accessibility-aria
Timmy_Foundation:rescue/export-import
Timmy_Foundation:burn/20260410-1920-49-accessibility-aria
Timmy_Foundation:refactor/unslop-phase-1-2
Timmy_Foundation:fix/add-smoke-test
Timmy_Foundation:feat/ci-a11y-checks
Timmy_Foundation:feat/a11y-smoke-test
Timmy_Foundation:burn/20260410-47-export-import-hotkeys
Timmy_Foundation:feat/progression-toasts
Timmy_Foundation:burn/20260410-0817-10-number-formatting
Timmy_Foundation:feat/offline-gains-popup
Timmy_Foundation:feature/locked-building-previews
Timmy_Foundation:feature/production-breakdown
Timmy_Foundation:fix/event-remediation-system
Timmy_Foundation:fix/creativity-double-count
Timmy_Foundation:burn/20260410-0423-25-mempalace-building
Timmy_Foundation:feat/combo-system
Timmy_Foundation:burn/20260410-0355-35-fix-offline-progress
Timmy_Foundation:feat/progress-bar-milestones
Timmy_Foundation:fix/offline-progress-all-resources
Timmy_Foundation:feature/buy-mode-toggle
Timmy_Foundation:burn/20260410-0225-fix-offline-progress
Timmy_Foundation:fix/offline-progress
Timmy_Foundation:burn/20260410-0052-13-static-site-meta
Timmy_Foundation:beacon/unlock-notifications
Timmy_Foundation:feature/save-toast
Timmy_Foundation:burn/20260409-2101-creativity-ops
Timmy_Foundation:burn/20260409-1926-18-spellf-full-number-formatting
Timmy_Foundation:feat/spellf-formatting
Timmy_Foundation:integration
Timmy_Foundation:allegro/code-review-and-enhancements
Timmy_Foundation:bezalel/fleet-story-integration
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
0e5538319b |
feat: agent guardrails, headless smoke test, and CI workflow
Adds a three-layer defense against the class of silent correctness bugs surfaced in #54. The layers are: documented rules (AGENTS.md), dynamic assertions (scripts/smoke.mjs), and static checks (scripts/guardrails.sh). A new Gitea Actions workflow runs the dynamic + static layers on every PR. Also fixes two of the bugs the smoke test immediately caught on main: 1. G.flags is now initialized to {} in the globals block. Previously it was created lazily by the p_creativity project effect, which forced every reader to write `G.flags && G.flags.x` — and left a window where a new writer could drop the defensive guard and crash. 2. The community_drama debuff no longer mutates G.codeBoost. Its applyFn was invoked from updateRates() on every tick (10 Hz), so the original `G.codeBoost *= 0.7` compounded: after ~100 ticks of the drama debuff, codeBoost was ~3e-16 instead of the intended 0.7. The fix targets G.codeRate instead, which is reset at the top of updateRates() and is therefore safe to multiplicatively reduce inside applyFn. AGENTS.md rule 1 explains the distinction between persistent multipliers and per-tick rate fields so future debuffs don't reintroduce the bug. The smoke test (`scripts/smoke.mjs`) runs game.js in a vm sandbox with a minimal DOM stub, no npm deps. It boots the engine, runs ticks, clicks, buys a building, fires every debuff, checks codeBoost stability, checks updateRates idempotency, and does a save/load round-trip. 30 assertions, ~0.1s on a dev machine. The static guardrails (`scripts/guardrails.sh`) grep for the patterns AGENTS.md forbids. Two rules (click power single-source, no Object.assign in loadGame) are marked PENDING because PR #55 is landing the fix for them — the workflow reports them but doesn't fail until #55 merges. Refs: #54 |