Skip to content

Keep empty Declare moves disabled - #557

Merged
100yenadmin merged 3 commits into
mainfrom
codex/worldos-disable-empty-declare
Jun 2, 2026
Merged

Keep empty Declare moves disabled#557
100yenadmin merged 3 commits into
mainfrom
codex/worldos-disable-empty-declare

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • disables the free-text Declare button until the player has typed move details, with disabled tooltip/ARIA labels covering each play-blocking reason
  • keeps the stuck-turn retry path and immediate palette actions unchanged
  • syncs visible OpenWorlds nav hashes with the screen the player is actually viewing, while preserving existing hash aliases
  • adds static coverage for the Declare disabled state and nav hash mappings

Verification

  • python3 -m pytest viewer/tests/test_openworlds_static.py::OpenWorldsStaticRouteTests::test_openworlds_table_action_buttons_select_declare_mode -q
  • python3 -m pytest viewer/tests/test_openworlds_static.py::OpenWorldsStaticRouteTests::test_openworlds_hash_aliases_match_primary_nav_labels -q
  • python3 -m pytest viewer/tests/test_openworlds_static.py -q
  • Browser live check on scripted OpenWorlds session: Check mode starts with empty input and disabled Declare; Continue still resolves and returns to actionable state.
  • Browser live check on scripted OpenWorlds session: primary nav clicks update the visible hash for Map, Party, Journal, Market, Worlds, Table, and Camp with images settled and no broken visible image loads.

Notes

  • Product-facing fix only; no engine authority change. GUI remains a reader plus /move submitter.
  • CI/CodeQL jobs are currently failing before test execution because GitHub Actions reports the account is locked due to a billing issue.

Licensing / CLA

  • I confirm this PR does not add confidential, private-art, credential, VM, or restricted material.
  • I confirm the changes are source changes authored for this repository and do not introduce third-party licensed content.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

ScreenTable's Declare flow now derives composerAction and trimmed draftText, computes explicit Declare gating/labels (declareNeedsDraft, declareDisabled, declareTitle, declareAriaLabel), and sendAction shows a "Type a move first" toast and focuses the input on empty submission. App centralizes hash routing via openWorlds helpers and a memoized navigate().

Changes

Routing and deep-linking

Layer / File(s) Summary
Routing helpers and navigate wiring
viewer/openworlds/app.jsx, viewer/tests/test_openworlds_static.py
Adds module-level valid-screen list, alias mapping, screen↔hash conversion, and openWorldsSyncHashForScreen. Adds memoized navigate(id, opts) in App that updates campMode, screen, and the URL hash; reworks auto-route handoffs and keyboard shortcuts to use navigate; updates hash-alias tests to assert new mappings and sync helper usage.

Declare Validation and State Refactoring

Layer / File(s) Summary
Composer derivation and Declare button wiring
viewer/openworlds/screen-table.jsx, viewer/tests/test_openworlds_static.py
Derive composerAction and draftText. Compute declareNeedsDraft, declareDisabled, declareTitle, and declareAriaLabel from action availability, pending/narrating/stuck states, app readiness, and draft presence. Wire BrassButton to use these computed props and select displayed label by pending state. Tests updated to assert declareNeedsDraft/declareDisabled and new title/ariaLabel props.
Input validation and empty-input feedback
viewer/openworlds/screen-table.jsx
sendAction validates trimmed input and, if empty, displays "Type a move first" toast, focuses the input via inputRef.current?.focus(), and exits early instead of silently returning.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped to tidy hash and shore,

I trimmed a draft and checked the door,
"Type a move!" I gently say,
Then focus home and clear the way,
A tiny rabbit, routing more.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: disabling the Declare button when it's empty, which matches the primary focus of the changeset across all three modified files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description comprehensively covers the changes, verification steps, and licensing/CLA requirements as specified in the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@viewer/openworlds/screen-table.jsx`:
- Around line 700-711: The tooltip/ARIA must reflect every disabled reason:
update the declareTitle and declareAriaLabel logic to branch on declareDisabled
reasons (use declareDisabled combined with specific flags) rather than only
pendingStuck/declareNeedsDraft; specifically, add cases for
!composerAction?.available (show a composing/narrating unavailable message using
composerMode.label), pendingActive (show a pending/composing… label), and
appStatusBlocksPlay (show an app-blocked message), while preserving the existing
pendingStuck and declareNeedsDraft messages and fallback to DECLARE_HINT;
reference declareDisabled, declareTitle, declareAriaLabel, declareNeedsDraft,
pendingStuck, pendingActive, appStatusBlocksPlay, composerAction, composerMode,
and DECLARE_HINT when making the changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8aedab8c-abbf-4e7e-871c-ad36b21a1748

📥 Commits

Reviewing files that changed from the base of the PR and between 9dd021b and 11a6088.

📒 Files selected for processing (2)
  • viewer/openworlds/screen-table.jsx
  • viewer/tests/test_openworlds_static.py

Comment thread viewer/openworlds/screen-table.jsx Outdated
@100yenadmin
100yenadmin merged commit 1057234 into main Jun 2, 2026
3 of 13 checks passed
@100yenadmin
100yenadmin deleted the codex/worldos-disable-empty-declare branch June 2, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant