Skip to content

fix(kin): standing-rules drafts survive closing Settings, Escape and a dropped host connection - #1107

Merged
GLDRoger merged 3 commits into
kinfrom
train-19-1129/step-6
Nov 29, 2026
Merged

GLDRoger merged 3 commits into
kinfrom
train-19-1129/step-6

Conversation

@GLDRoger

Copy link
Copy Markdown
Owner

On web, the owner's unsaved standing rules were lost without asking in three ways: closing Settings with the X, pressing Escape and then Cancel, and any drop in the host connection, which unmounted Settings. A walk in a real client also found smaller faults: a frozen "Kin checked … just now", generic Cancel/Confirm buttons on the leave question, "these" after withdrawing every rule, the owner named in the third person about their own change, Save below the fold, and phone status lines that a screen reader never hears.

What changed

  • Settings' modal can ask before it closes. AppRouteModal takes an optional close guard from the page inside it (useAppRouteModalCloseGuard). With no guard it closes exactly as before. The rules page registers one while it holds a draft, so the X, Escape and a backdrop press ask "Discard what you typed?" with Keep editing and Discard. Keep editing leaves Settings open with the draft and the caret. Switching Settings page, a link, Back or reload asks the same question with the same buttons.
  • Settings stays open while the host is offline. It stays mounted for the same company from the host's last answer. Save then says it couldn't save and keeps the text, and it saves once the host is back. Check-ins, Sections and Deals used to look up a connected host themselves and went blank offline. They now take Settings' company, like the other pages.
  • Lines that tell the truth. "Kin checked … ago" and "Changed … by …" follow the minute clock. The owner's own change reads "by you", and the name stays when Kin can't tell. After withdrawing every rule, the page says the agents follow no standing rules.
  • Save stays in view. The status and Save row sits at the foot of Settings' scroller, so Save is reachable at 1280×800 even with the current rules showing above the editor.
  • Phone. The status line and the too-large line are announced when they appear (VoiceOver gets an announcement, TalkBack a live region). The too-large line is styled as an error. The save-failure banner already announced itself.

Not changed: a non-owner landing on Profile still keeps ?settings=rules in the address. Settings' permissions read "not allowed" until the session is known, so rewriting the address there would also send the owner's own link to Profile while the page loads.

Tests

Browser tests cover the close button and Escape, route changes, the offline Settings, a page going blank offline, the clock and "by you", and Save at 1280×800. Shared tests cover "by you" and the empty-rulebook line. Each test failed before its fix. Checked as part of train 19's one check at the tip.

People-change: none

🤖 Generated with Claude Code

GLDRoger and others added 3 commits November 30, 2026 02:16
… dropped host

On web, closing Settings with the X, or Escape then Cancel, closed it without
asking and lost the owner's unsaved rules, and any blip in the host connection
unmounted Settings and lost them too.

- Settings' modal takes an optional close guard from the page inside it. The
  rules page registers one while it holds a draft, so the X, Escape and a
  backdrop press ask "Discard what you typed?" (Keep editing / Discard);
  Keep editing leaves Settings open with the draft and the caret. Page
  switches, links and Back ask the same question with the same words.
- Settings stays mounted for the same company while its host is offline.
  Check-ins, Sections and Deals now take Settings' company instead of a
  connected-only lookup, so they no longer go blank offline.
- "Kin checked … ago" and "Changed … by …" move on with the minute clock,
  the owner's own change reads "by you", and withdrawing every rule says the
  agents follow no standing rules.
- Save stays in view at the foot of Settings however tall the page.
- Phone: the status, the too-large line (now styled as an error) are said
  aloud when they appear.

People-change: none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… T3's route modal

The close guard added 53 lines to T3's AppRouteModal.tsx, each a future merge
conflict with upstream. It now lives in apps/web/src/kin/KinRouteModalGuard.tsx:
the context, the page's useKinModalCloseGuard, the guard ref and the ask-then-
close logic. AppRouteModal keeps an import, one hook call and three one-line call
sites (5 added lines). With no page guarding, every close is upstream's own.

People-change: none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
People-change: none

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T22:29:11.796219Z 20d4ad2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@GLDRoger
GLDRoger merged commit a263758 into kin Nov 29, 2026
16 of 17 checks passed
@github-actions

Copy link
Copy Markdown

This PR changes the test suite by +6 test cases (browser +6, unit 0, server 0).

New browser test files: apps/web/src/kin/KinSettingsOffline.browser.test.tsx.
Each browser test file costs CI seconds of module loading before its first test runs; a unit test costs milliseconds.

Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant