Skip to content

test: fix the two tests that only failed on Linux - #537

Merged
whes1015 merged 2 commits into
mainfrom
fix/linux-only-test-failures
Aug 18, 2026
Merged

test: fix the two tests that only failed on Linux#537
whes1015 merged 2 commits into
mainfrom
fix/linux-only-test-failures

Conversation

@whes1015

Copy link
Copy Markdown
Member

Both passed on every laptop and failed on every runner, which is the shape of bug the pre-push gate cannot see: it runs CI's command list on this machine, not on CI's machine.

script lends the colouriser a pty so the "is this a terminal" branch can be exercised at all, and its argument order is reversed between the platforms this repository builds on: BSD takes the typescript file first and the command after it, util-linux wants the command behind -c and the file last. Written for BSD only, it turned into a failure with no message on Linux.

The mesh window test slept 150 ms and then asserted. _add writes fire-and-forget and only adopts a message once the insert answers, so both halves of what the test checks land after the packet is handed over — a fixed delay is a guess about how fast the machine is. It waits for the store now. The tail of a 320-message burst was arriving after the test had closed the database, which reported as This database has already been closed thirteen times and then a length mismatch.

tool/commit.sh stops claiming "this is what CI will do" and names the platform it actually checked.

這個 PR 做了什麼

相關 issue

  • closes #

怎麼驗

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
    —— commit 訊息就是更新日誌,格式見 commit.md
  • 一個 commit 一件事(這條 gate 驗不了,靠自己和 review)
  • mise exec -- flutter analyzemise exec -- flutter test 通過
  • 新的使用者可見字串都走 AppLocalizations,沒有寫死
  • 有 UI 變更的話:用的是 AppSpacing / AppRadius / AppMotion
    深色模式看過,文字對比度可接受

Both passed on every laptop and failed on every runner, which is the shape of
bug the pre-push gate cannot see: it runs CI's command list on this machine,
not on CI's machine.

`script` lends the colouriser a pty so the "is this a terminal" branch can be
exercised at all, and its argument order is reversed between the platforms this
repository builds on: BSD takes the typescript file first and the command after
it, util-linux wants the command behind `-c` and the file last. Written for BSD
only, it turned into a failure with no message on Linux.

The mesh window test slept 150 ms and then asserted. `_add` writes
fire-and-forget and only adopts a message once the insert answers, so both
halves of what the test checks land after the packet is handed over — a fixed
delay is a guess about how fast the machine is. It waits for the store now.
The tail of a 320-message burst was arriving after the test had closed the
database, which reported as `This database has already been closed` thirteen
times and then a length mismatch.

`tool/commit.sh` stops claiming "this is what CI will do" and names the
platform it actually checked.
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s).

Comment on lines 81 to 83
test('keeps the newest messages first', () async {
final (controller, service, _) = await makeController();
for (var i = 0; i < 10; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

bug · critical
在 'keeps the newest messages first' 測試案例中,store 被解構為 _,導致後續呼叫 drained(store, ...) 時會出現編譯錯誤(Undefined name 'store')。

Suggestion:

Suggested change
test('keeps the newest messages first', () async {
final (controller, service, _) = await makeController();
for (var i = 0; i < 10; i++) {
test('keeps the newest messages first', () async {
final (controller, service, store) = await makeController();
for (var i = 0; i < 10; i++) {

@whes1015
whes1015 merged commit 7157f72 into main Aug 18, 2026
5 of 6 checks passed
@whes1015
whes1015 deleted the fix/linux-only-test-failures branch August 18, 2026 08:49
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