Skip to content

Make the macOS CI leg say something - #2

Merged
samartomar merged 2 commits into
mainfrom
macos-ci
Aug 31, 2026
Merged

Make the macOS CI leg say something#2
samartomar merged 2 commits into
mainfrom
macos-ci

Conversation

@samartomar

Copy link
Copy Markdown
Owner

The macOS leg has been red since it was added, so a new break on that platform looks exactly like the old ones — which is the same as having no leg. This is four fixes and no behaviour change; flow/ is untouched.

Only one of the four was really about macOS:

test_lite.test_full_mode_still_tracks_it drives full-mode target lookup, which resolves through classify into inject.py and binds user32 at import. One of the six Win32 mechanisms the workflow comment already names — it was just missing the guard the others carry.
test_main ×2 not a platform problem. launch() patches sys.platform to "win32", and sys.platform is not Flow's variable — on a real Mac the stdlib reads it too. shutil.which takes its Windows branch into _winapi, which is None, and the traceback ends on a line no part of Flow wrote.
test_pill font advance measures a font only installed on Windows. _load_fonts returns early elsewhere, so Tk substitutes and the test measured the substitute — 10 against 7.

The test_main pair is patched at available() rather than by skipping: that call is where shutil.which came from, it has nothing to do with what the class asserts, and resolving CLIs probes subprocesses so the tests get faster too.

The font check now skips on the substitution rather than on the platform — the question is whether the face resolved, and a Windows machine missing the file deserves the same answer.

Wanted before #1, which adds macOS window fixes and a native macOS decoder and needs that leg to mean something.

…en saying

The macOS leg has been red since it was added, so a new break on that platform
has looked exactly like the old ones - which is the same as having no leg. Four
failures, and only one of them was really about macOS.

`test_full_mode_still_tracks_it` drives the full-mode target lookup, which
resolves through `classify` into `inject.py`, which binds user32 at import. That
is one of the six Win32 mechanisms the workflow comment already names; it was
simply missing the guard the others carry.

The two `TestAHotkeysBlockIsInertWhereNothingIsRegistered` cases were the
interesting ones, and not a platform problem at all. `launch()` patches
`sys.platform` to "win32" - and `sys.platform` is not Flow's variable. On a real
macOS runner the *stdlib* reads it too: `shutil.which` takes its Windows branch
and calls into `_winapi`, which is None, and the traceback ends on a line no
part of Flow wrote. `available()` is patched out instead, which is where that
call came from and which has nothing to do with what the class asserts. It is
faster too - resolving CLIs probes subprocesses.

The font advance is a property of a font only installed on Windows. `_load_fonts`
registers the bundled Plex weights through GDI and returns early everywhere else,
so Tk substitutes and the test measured the substitute - 10 against 7. Skipped on
the substitution rather than on the platform, because the question is whether the
face resolved, and a Windows machine missing the file deserves the same answer.

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

chatgpt-codex-connector Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T04:32:09.101715Z 164dcf8 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 164dcf8d6f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/test_main.py Outdated
# raised from a line no part of Flow wrote. Which agent CLI happens to be
# installed has nothing to do with what this class asserts.
with mock.patch.object(sys, "platform", platform), \
mock.patch.object(mod, "available", return_value=[]), \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Patch the remaining CLI lookup in this launch helper

On macOS, the two tests that use this helper's default platform="win32" still fail: after available() returns, main() calls the separately imported unverified(), which traverses detected()resolve()shutil.which(). Because sys.platform is still spoofed to win32, that call reaches the unavailable _winapi.NeedCurrentDirectoryForExePath just as available() did. Patch unverified() as well (or patch the resolver beneath both calls), otherwise this change does not make the macOS CI leg green.

Useful? React with 👍 / 👎.

Comment thread tests/test_pill.py
Comment on lines +120 to +122
if f.actual("family") != ui.FONT_TRACE[0]:
self.skipTest(f"{ui.FONT_TRACE[0]} not installed; "
f"Tk substituted {f.actual('family')!r}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail when the bundled font stops loading on Windows

When _load_fonts() regresses on Windows—for example, a font filename or GDI registration call changes—Tk substitutes another family and this new branch marks the test skipped, so the only test covering both bundled-font resolution and the hardcoded LABEL_ADV silently disappears. Since the font files are repository assets and the product relies on their metrics, substitution should only be skipped on unsupported platforms; on Windows it should fail so a broken font-loading path cannot ship unnoticed.

Useful? React with 👍 / 👎.

The first attempt patched `available()` and CI found the other road: `main`
reaches the same `shutil.which` through `unverified()` as well, so half the
failure survived. `resolve` is the single choke point - the only `shutil.which`
in the module, and what every lookup goes through - so it is stubbed there and
neither caller matters.

Proved without the runner this time. With `shutil.which` rigged to raise the
exact AttributeError a Mac raises when `sys.platform` has been patched to
"win32", all five cases pass, which is the same thing the macOS leg is about to
say more slowly.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@samartomar
samartomar merged commit 6b645a8 into main Aug 31, 2026
3 checks passed
@samartomar
samartomar deleted the macos-ci branch August 31, 2026 04:34
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