feat(dogfood): add counter block fixture#99
Conversation
📝 WalkthroughWalkthroughThis PR adds two independent shell features: a backtick-toggled performance HUD overlay displaying frame timing metrics, and a DOGFOOD counter demo block fixture for the docs preview guide with bounded state, intent-driven mutations, and multi-mode rendering. Includes keybinding fixes, documentation, and comprehensive tests. ChangesPerformance HUD Shell Feature
Counter Demo Block Feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
examples/docs/app.ts (1)
785-817: 💤 Low valueConsider extending base keymap instead of duplicating bindings.
blocksPreviewGuidePaneKeysduplicates the guide navigation bindings fromguidePaneKeys. IfcreateKeyMapsupports composition or merging, consider extending the base keymap to reduce duplication and ensure consistency when the base bindings change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@examples/docs/app.ts` around lines 785 - 817, blocksPreviewGuidePaneKeys duplicates the guide navigation bindings already defined in guidePaneKeys; instead of copying bindings, compose or merge from the base keymap by reusing guidePaneKeys (or the createKeyMap composition API) and then add the counter fixture group—locate createKeyMap, guidePaneKeys and blocksPreviewGuidePaneKeys and change blocksPreviewGuidePaneKeys to extend/merge guidePaneKeys (or call guidePaneKeys.group(...) / use the library's .extend/.merge helper) so guide navigation stays in one place and duplication is removed; apply the same approach to similar maps like blocksPreviewPaneKeys/componentsPageKeys if applicable.packages/bijou-tui/src/app-frame.test.ts (1)
1060-1073: ⚡ Quick winExpand Perf HUD toggle coverage to non-workspace layers.
This validates the workspace path, but the feature also adds dedicated backtick routing for palette/help/settings/notification-center/page-modal/quit-confirm. Consider a small parameterized test to assert toggle behavior in each routed layer.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/bijou-tui/src/app-frame.test.ts` around lines 1060 - 1073, Add a parameterized test around the existing backtick toggle spec to exercise non-workspace routed layers (palette, help, settings, notification-center, page-modal, quit-confirm): reuse createFramedApp and makePage to build the app, call runScript with a backtick key targeted at each routed layer, and assert model.perfHudOpen flips and the top frame surface (frames.at(-1) via surfaceToString with testCtx.style) contains/removes "Perf HUD" accordingly; implement this by iterating a list of layer identifiers and running the same open/close assertions used in the current test so each routed layer is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@examples/docs/app.ts`:
- Around line 785-817: blocksPreviewGuidePaneKeys duplicates the guide
navigation bindings already defined in guidePaneKeys; instead of copying
bindings, compose or merge from the base keymap by reusing guidePaneKeys (or the
createKeyMap composition API) and then add the counter fixture group—locate
createKeyMap, guidePaneKeys and blocksPreviewGuidePaneKeys and change
blocksPreviewGuidePaneKeys to extend/merge guidePaneKeys (or call
guidePaneKeys.group(...) / use the library's .extend/.merge helper) so guide
navigation stays in one place and duplication is removed; apply the same
approach to similar maps like blocksPreviewPaneKeys/componentsPageKeys if
applicable.
In `@packages/bijou-tui/src/app-frame.test.ts`:
- Around line 1060-1073: Add a parameterized test around the existing backtick
toggle spec to exercise non-workspace routed layers (palette, help, settings,
notification-center, page-modal, quit-confirm): reuse createFramedApp and
makePage to build the app, call runScript with a backtick key targeted at each
routed layer, and assert model.perfHudOpen flips and the top frame surface
(frames.at(-1) via surfaceToString with testCtx.style) contains/removes "Perf
HUD" accordingly; implement this by iterating a list of layer identifiers and
running the same open/close assertions used in the current test so each routed
layer is covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2dd322af-70a5-41b4-8819-c92dfef63d57
📒 Files selected for processing (17)
docs/CHANGELOG.mdexamples/docs/app.tsexamples/docs/counter-block-demo.tsexamples/docs/stories.tspackages/bijou-tui/GUIDE.mdpackages/bijou-tui/README.mdpackages/bijou-tui/src/app-frame-actions.tspackages/bijou-tui/src/app-frame-types.tspackages/bijou-tui/src/app-frame-utils.tspackages/bijou-tui/src/app-frame.test.tspackages/bijou-tui/src/app-frame.tspackages/bijou-tui/src/keybindings.test.tspackages/bijou-tui/src/keybindings.tspackages/bijou-tui/src/layout-preset.test.tsscripts/docs-preview.test.tstests/cycles/DX-031/counter-block-demo.test.tstests/cycles/DX-031/dogfood-blocks-section.test.ts
|
Closing as superseded by the already-merged DOGFOOD counter/block-preview work on current main. The CounterDemoBlock fixture, perf HUD toggle, counter key routing, and DF-068 regression coverage now exist on origin/main, while this branch is stale/conflicting and would regress newer block preview/localization changes. |
Summary
Adds a canonical non-shipping
CounterDemoBlockfixture that can be executed from DOGFOOD and Storybook. The fixture proves the visible Block loop end to end: rendered controls emit intent commands, model/business logic applies bounded counter updates, and the next render reflects the new state.This also adds a shell-owned AppFrame perf HUD toggle on backtick using the existing
perfOverlaySurface()component.What changed
examples/docs/counter-block-demo.tswith a bounded0..10counter fixture block.fixture-counter-block.-,+, and=in the Blocks preview.+key parsing in the TUI keybinding parser.Non-goals
CounterDemoBlocka shipping standard block.Validation
npm test -- --run tests/cycles/DX-031/counter-block-demo.test.tsnpm test -- --run tests/cycles/DX-031/dogfood-blocks-section.test.ts scripts/docs-preview.test.tsnpm run typecheck:testnpm run docs:inventorygit diff --checknpm run lintnpm run typecheck:testnpm test(300files,3417tests)npm run verify:interactive-examplesSummary by CodeRabbit
New Features
).Bug Fixes
Documentation
Tests