Skip to content

fix(settings): keep no earlier opening's anchor on a Settings opened again (#1949) - #2182

Merged
devswha merged 1 commit into
mainfrom
fix/settings-history-stale-anchor
Oct 28, 2026
Merged

devswha merged 1 commit into
mainfrom
fix/settings-history-stale-anchor

Conversation

@devswha

@devswha devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Change

Closes #1949.

What was wrong. When Settings opens from a phone sheet (the command palette), it takes over the sheet's entry. It then puts a lost mark (ovis:settings-base-lost) and the sheet's id (ovis:settings-anchor) on its entries, so its closing can be told from the entry the sheet opened over. Those marks stayed in the history after Settings closed. A preview opened over Settings copies them (outsideSettings). A later opening that started from such an entry copied them again onto its own entries, because every Settings entry copies its base's state.

So, on a phone: A → B → palette → Settings → a file preview → Settings closes under the preview → Settings opens again from the preview (a sheet inside it, Phone & devices → Sign out → Cancel) → a jump through the browser's history menu past the preview onto B. The second opening's entries held the first opening's anchor, B carries that sheet's id, and the jump counted as Settings closing (settingsSteppedOff() true). The address bar then kept the current pane instead of going to B's.

Fix. A new opening drops the lost mark and the anchor from its base entry when it marks that entry with its own id (reconcile() in src/lib/settingsHistory.ts). An opening that takes over a sheet's entry itself writes fresh ones right after, as before. Those marks are only ever read from Settings entries, so removing them from a pane's or a preview's entry changes nothing else.

This is the issue's first proposed fix ("clear the anchor and the mark ... or scope them to one opening"), applied where an opening begins. That covers every entry a later opening could start from, rather than only the entry an opening closes onto. No HTTP or WebSocket contract changes, no server change.

Validation

  • New test in settingsHistory.test.ts, "does not carry an earlier opening's anchor into Settings opened again over the same entries". It follows the path above and ends with go(-5) onto B. It fails on main (settingsSteppedOff() came back [false, true]) and passes with the fix. It still fails on main without the inner sheet step, because the marks come from the preview's copy. No fixed sleeps.
  • bun test src/lib/settingsHistory.test.ts: 38 pass. bun test src/lib: 2462 pass, 0 fail.
  • bun run check fast: green at the head commit.
  • Browser regressions on demo fixtures: settings-pages-demo-regression, deep-link-demo-regression and hide-pc-demo-regression (390 and 1440, including the phone palette path) pass.

Reviews

  • omo-native-code-reviewer: PASS, no HIGH or MEDIUM. It checked Forward onto older entries, the sheet-step rebuild, reloads, sheets inside Settings, previews and the existing closing cases, and confirmed the new test fails only on the old code. Three LOW notes: the code comment's wording (fixed), the inner sheet step not being needed to reproduce (kept, since it is the issue's path), and outsideSettings still copying the marks onto a preview's entry (older behaviour, harmless now that an opening drops them).
  • Codex (gpt-6.1-sol, xhigh): APPROVE.

…again (#1949)

A Settings opening copies its base entry's state into its entries. When an earlier opening took over a phone sheet's entry, its lost mark and anchor travelled on with that state (a preview opened over Settings copies them), so a later opening began from that entry carried them, and a Back-menu jump past its base onto the entry the sheet had opened over counted as Settings closing. A new opening now drops them from its base.
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between d58b851 and 6a24b29.

Files selected for processing: 3
  • changelog.d/settings-history-stale-anchor.md
  • src/lib/settingsHistory.test.ts
  • src/lib/settingsHistory.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • On phones, navigating back through browser history from Settings reopened over a preview now lands on the correct pane, without treating the navigation as closing Settings.

When Settings opens again, its new base state no longer carries inherited lost-opening or anchor markers. A regression test covers navigating back past a preview after reopening Settings.

Changes: Settings history

Layer / File(s) Summary
Reset markers on new opening
src/lib/settingsHistory.ts, src/lib/settingsHistory.test.ts, changelog.d/settings-history-stale-anchor.md
A new Settings opening omits inherited LOST_KEY and ANCHOR_KEY markers. The regression test checks that backing past a preview does not report Settings as closing and preserves navigation marker "b". The changelog describes the phone browser-history scenario.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • devswha/ovis#2023: This PR changes the same Settings history marker flow by clearing stale markers when a new Settings opening begins.
  • devswha/ovis#1947: This PR introduced the lost-opening and anchor markers that this change resets.
Merge Risk: Minimal · up to 6a24b

The change addresses the reported history-navigation issue. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: Settings reopened from a history entry no longer keeps an anchor from an earlier opening. It uses the conventional fix(settings) prefix and states the behavior. It doe…
Description check Passed The description follows the template. It has a Change section that explains the problem (stale ovis:settings-base-lost and ovis:settings-anchor marks copied into later entries), the resulting wrong cl…
Linked Issues check Passed Issue #1949 requires stale Settings marks and anchors to stop misclassifying a multi-entry history jump after Settings reopens. reconcile() removes LOST_KEY and ANCHOR_KEY from the base entry at…
Out of Scope Changes check Passed The changes are limited to the Settings history fix, its regression test, and a related changelog entry. These changes directly support issue #1949. No unrelated product behavior or server, HTTP, or W…
Full details: Title check

Explanation

The title names the main change: Settings reopened from a history entry no longer keeps an anchor from an earlier opening. It uses the conventional fix(settings) prefix and states the behavior. It does not cover the test or the changelog entry, which is expected. The 82-character length is slightly long but acceptable.

Full details: Description check

Explanation

The description follows the template. It has a Change section that explains the problem (stale ovis:settings-base-lost and ovis:settings-anchor marks copied into later entries), the resulting wrong classification of a history jump as Settings closing, and the fix in reconcile(). It links the issue (Closes #1949). The Validation section lists the new test, unit test counts, the check run, browser regressions, and reviews. It has no HTTP/WS contract statement is present, and it does state no contract or server change, so the template's contract-test note is addressed.

Full details: Linked Issues check

Explanation

Issue #1949 requires stale Settings marks and anchors to stop misclassifying a multi-entry history jump after Settings reopens. reconcile() removes LOST_KEY and ANCHOR_KEY from the base entry at each new opening, then assigns a new BASE_KEY. The sheet takeover path writes fresh marks afterward. The added regression test reopens Settings from a preview, nests a sheet, performs go(-5), and verifies that history lands on B without settingsSteppedOff().

Full details: Out of Scope Changes check

Explanation

The changes are limited to the Settings history fix, its regression test, and a related changelog entry. These changes directly support issue #1949. No unrelated product behavior or server, HTTP, or WebSocket changes are shown.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

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

@devswha

devswha commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Merging 6a24b29: omo-native-code-reviewer and Codex both pass this head, and the regression and four history-jump variants fail on main. The LOW notes go to a follow-up issue. The required checks are green, and CodeRabbit did not review this head.

@devswha
devswha merged commit d308baa into main Oct 28, 2026
11 checks passed
@devswha
devswha deleted the fix/settings-history-stale-anchor branch October 28, 2026 05:21
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.

Settings history: a stale anchor can survive a closed Settings opened from a phone sheet

1 participant