Skip to content

[codex] Keep long chronicle beats readable - #555

Merged
100yenadmin merged 2 commits into
mainfrom
codex/worldos-chronicle-latest-beat-scroll
Jun 2, 2026
Merged

[codex] Keep long chronicle beats readable#555
100yenadmin merged 2 commits into
mainfrom
codex/worldos-chronicle-latest-beat-scroll

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Jun 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Keep long completed Chronicle narration anchored at the start of the latest beat, so fresh players do not land mid-sentence after a large DM response.
  • Preserve the existing reader-respect behavior: manual scroll-up still opts out of auto-follow.
  • Keep pending/stuck DM feedback aligned to the live end, so the player still sees progress/status while the DM is composing.

Root Cause

The Chronicle auto-follow logic treated "latest" as the bottom of the scroll region. That works for short beats, but a long provider response can be taller than the Chronicle viewport, so pinning to the bottom hides the first line of the new DM reply.

User Impact

A fresh player should now see the beginning of the newest DM narration after a move instead of resuming the story mid-paragraph. This is viewer-only: the engine remains the sole campaign-state writer, and the GUI still only reads state and submits /move intents.

Validation

  • Browser-first local product proof on the scripted-provider Table surface: /move accepted, active player present, six actions enabled, private art present, console error count 0.
  • Long-reply DOM measurement: latestStartsNearLogTop=true after the scripted DM response.
  • python3 -m pytest viewer/tests/test_openworlds_static.py::OpenWorldsStaticRouteTests::test_openworlds_table_bounds_and_anchors_the_chronicle -q -> 1 passed
  • python3 -m pytest viewer/tests/test_openworlds_static.py -q -> 51 passed, 6 subtests passed

Notes

  • No private art or evidence bundle is committed.
  • This is product/readability progress, not a release verdict. Full built-app/RRI evidence remains separate.

Summary by CodeRabbit

  • Bug Fixes
    • Improved chronicle auto-scroll behavior to more intelligently track live updates—now scrolls to new content only when actively following the end or after submitting a move.
    • Enhanced scroll targeting to reliably display the latest narration beat.
    • Refined chronicle accessibility labels for better screen reader support.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@100yenadmin, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 56 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a00c068-dfcf-4b9a-be6d-680fc4be399d

📥 Commits

Reviewing files that changed from the base of the PR and between 87fe8df and d8367ac.

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

Walkthrough

The PR refines chronicle auto-scroll targeting by introducing dedicated refs for latest and pending narration beats, rewriting the auto-follow effect to scroll conditionally based on pending state, updating the scroll handler to detect programmatic scrolling, and adjusting the accessibility label and rendering structure to support precise scroll targeting.

Changes

Chronicle Auto-Scroll Refinement

Layer / File(s) Summary
Ref setup and chronicle rendering structure
viewer/openworlds/screen-table.jsx
Introduces latestBeatRef, pendingBeatRef, and programmaticScrollRef to track scroll targets. Updates the chronicle region accessibility label from describing the bottom position to stating the latest narration starts in view. Refactors log entry rendering to wrap each entry in a container and attach refs to the latest and pending beat containers.
Auto-scroll effect and scroll handler
viewer/openworlds/screen-table.jsx
Rewrites the auto-follow effect to scroll conditionally to the pending beat (to its end) or latest beat (to its start) using scrollIntoView, with fallback to scrollTop when needed. Updates the scroll handler to immediately re-enable stick-to-bottom and exit early when scroll was triggered programmatically.
Test validation for chronicle scroll behavior
viewer/tests/test_openworlds_static.py
Expands test assertions to verify ref variables, scrollIntoView block logic tied to pendingTarget, the programmaticScrollRef flag, and specific UI testids and aria-labels. Updates the effect dependency list from pending to pendingActive and pendingStuck.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • electricsheephq/WorldOS#343: Modifies viewer/openworlds/screen-table.jsx around pending/narrating (pendingActive / pendingStuck) behavior that the main PR's scroll-target logic depends on.
  • electricsheephq/WorldOS#402: Directly modifies the same chronicle auto-scroll and stick-to-bottom logic with similar beat-targeting updates and related test assertion changes.
  • electricsheephq/WorldOS#328: Introduces the DM-narrating pending affordance that the main PR now targets in its chronicle auto-scroll logic.

Poem

🐰 A rabbit hops through chronicles fine,
With refs that point to beats divine,
Now scrolling knows which beat to chase—
The pending first, the latest's place.
User or code, we tell apart,
A gentler scroll, a beating heart! 🎯

🚥 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: updating Chronicle auto-scroll behavior to keep long beats readable by anchoring at the start instead of the bottom.
Description check ✅ Passed The description includes a clear summary of changes, root cause analysis, user impact, and comprehensive validation. The required CLA and licensing section is missing.
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.

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


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

@100yenadmin

Copy link
Copy Markdown
Member Author

Current check classification: CI and CodeQL jobs failed before executing any steps (jobs have empty steps arrays and completed in 3-4s on head 87fe8df), matching the existing external runner/account-level failure lane. Local focused validation passed: python3 -m pytest viewer/tests/test_openworlds_static.py -q -> 51 passed, 6 subtests passed. CodeRabbit skipped because this PR is draft; no actionable review comments are currently posted.

@100yenadmin
100yenadmin marked this pull request as ready for review June 2, 2026 03:18

@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 852-860: The wrapper currently assigns latestBeatRef using i ===
renderedLog.length - 1 which can point to a LogEntry that renders null
(sanitized-away narration); change this to compute the index of the last visible
beat and only attach latestBeatRef/data-worldos-testid to that index: derive
lastVisibleIndex = renderedLog.findLastIndex(entry => /* same visibility check
used by LogEntry: e.g. not a narration that sanitizes to empty or otherwise
would return null */) and then use i === lastVisibleIndex when setting ref and
data-worldos-testid so auto-follow targets the last actually rendered LogEntry;
mirror the exact sanitization/visibility logic used inside LogEntry to keep
behavior consistent.
🪄 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: a0e0a561-0623-473d-b768-26967522d85b

📥 Commits

Reviewing files that changed from the base of the PR and between 0b937b8 and 87fe8df.

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

Comment thread viewer/openworlds/screen-table.jsx
@100yenadmin
100yenadmin merged commit 4cdf045 into main Jun 2, 2026
3 of 13 checks passed
@100yenadmin
100yenadmin deleted the codex/worldos-chronicle-latest-beat-scroll branch June 2, 2026 03:35
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