Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Make the overlay's presentation lifecycle and the font and caret measurement states explicit - #941

Merged
FuJacob merged 1 commit into
mainfrom
cleanup/presentation-2
Nov 23, 2026
Merged

FuJacob merged 1 commit into
mainfrom
cleanup/presentation-2

Conversation

@FuJacob

@FuJacob FuJacob commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

Replaces the loose flags, optionals and parallel collections that encoded state machines in the presentation layer with explicit types, so the legal states are the only representable ones. Observable behavior is unchanged.

  • Overlay presentation lifecycle. OverlayController tracked what is on screen and what is being held back from it in five fields (state, inlineSession, a show token, panelHeldForCapture, heldPresentationText) that every entry point reset by hand. They are now one pure value, OverlayPresentationLifecycle: a presentation (hidden / inline with its session / card) plus an optional hold (caret lag, or a pixel read that may have taken the panel down). Every show and hide retires the hold in one transition, an inline session exists only while an inline ghost is presented, and a late pixel read can land only if nothing was asked of the overlay since. state and heldPresentationText are derived from it, so the SuggestionOverlayControlling contract is the same.
  • Pixel caret request standing. PixelCaretLocator exposes one status(of:) (unknown / capturing / measured / failed) instead of two probes the controller combined, keeps "waiting on a capture" and "failed" as one entry per request, and carries the failure as a typed reason instead of a mutable string that the debug dump re-derived.
  • Typeface match progress. The calibrator's record dictionary, miss-count dictionary and the rule tying them together are one TypefaceProgress (unmatched(misses:) / matched(record)) with wantsMatch and advanced as its transitions.
  • Typeface evidence. Four flags become two enums: the family decision (pending, resolver's choice, switched once, undecidable) and the scaling sample (none, adopted, refined once).
  • Font registries. HostFontRegistry's two index maps, no-fonts set and trust-verdict map are one per-bundle state (untrusted / no fonts / indexed); HostBundledFontRegistry's names map and scanning set are one per-bundle scan state.

Tests: transition tests for the lifecycle value, the first tests that drive a real OverlayController through show, hold, advance and hide, status tests for the locator, and a miss-counting test for typeface progress. The existing calibrator typeface tests are repointed at TypefaceProgress.

Validation

  • swiftlint lint --strict --quiet: clean
  • xcodegen generate: committed project matches project.yml (only the new files are added)
  • python3 -m unittest discover -s scripts/tests: passed
  • xcodebuild build-for-testing then xcodebuild test-without-building (scheme Cotabby, Debug, macOS): Executed 3012 tests, with 37 tests skipped and 0 failures (0 unexpected) on the final commit. That is 30 more than main at the same point: the new lifecycle, controller, locator-status and typeface-progress tests.

Not verified by a live run: the pixel-capture hold needs Screen Recording and a host that exposes a union-run paragraph, so that path is covered by the pure lifecycle tests rather than through the real controller.

Linked issues

None

Risk / rollout notes

  • Cotabby.xcodeproj is regenerated for one new source file and two new test files.
  • No settings keys or on-disk formats change.
  • Two things were deliberately left as they are because changing them would alter behavior: the locator's failed-request set is still unbounded, and a carried-forward caret can still be cached for a request whose capture is in flight (the capture overwrites it when it lands).
  • TypefaceEvidence.verdict drops a branch that could not be reached: a switched family that still fits every long sample is already returned by the check above it.
  • ClickAwayMonitor (added in Share the overlay layer's capture, panel and palette code and remove its dead seams #934) gains the nonisolated deinit {} that the repo's other stored-property @MainActor classes carry. One is released every time the emoji picker or macro preview closes, so its deinit must not go through the back-deployed isolated-deinit shim that over-frees on macOS 15.
  • The new controller tests order a real (transparent, non-activating) panel on screen in the test host; they capture nothing and take it down in tearDown.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no actionable regression was found.

Summary

The PR replaces related flags and collections with explicit states for overlay presentation, caret measurements, and font matching.

  • The overlay keeps its display and any pending hold in one lifecycle.
  • Caret requests report whether a capture is pending, complete, or failed.
  • Typeface matching keeps each field’s misses and match in one progress state.
  • Typeface evidence tracks family choices and scaling samples as explicit steps.
  • Host font lookups keep each bundle’s trust and scan progress together.
  • Closing a picker or preview releases its click monitor without the isolated deinitializer path.

No actionable issues were found. macOS tests and live panel behavior were not run in this Linux environment.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Show[Show suggestion] --> Retire[Retire previous hold]
  Retire --> Caret{Caret ready?}
  Caret -->|No| Hold[Hold requested text]
  Caret -->|Yes| Present[Present inline text or card]
  Hold --> Result[Pixel read returns]
  Result --> Current{Ticket still current?}
  Current -->|Yes| Show
  Current -->|No| Ignore[Ignore old result]
  Hide[Hide overlay] --> Clear[Retire hold and hide panel]
Loading

Reviews (4) · Last reviewed commit: "Make the presentation layer's implicit s..." · Reviewed by Greptile

Copilot AI balanced review requested due to automatic review settings November 23, 2026 01:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • 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

@FuJacob
FuJacob force-pushed the cleanup/presentation-2 branch 2 times, most recently from c9fa568 to 2f1f2f1 Compare November 23, 2026 02:11
@FuJacob FuJacob closed this Nov 23, 2026
@FuJacob FuJacob reopened this Nov 23, 2026
@FuJacob
FuJacob force-pushed the cleanup/presentation-2 branch from 2f1f2f1 to 946e498 Compare November 23, 2026 03:19
@FuJacob
FuJacob merged commit 2378479 into main Nov 23, 2026
5 checks passed
@FuJacob
FuJacob deleted the cleanup/presentation-2 branch November 23, 2026 03:19
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.

2 participants