Skip to content

test: Increase disconnectTimeout to reduce test flakes - #26

Merged
kylecarbs merged 3 commits into
mainfrom
disctime
Jan 14, 2022
Merged

kylecarbs merged 3 commits into
mainfrom
disctime

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

WebRTC uses UDP, which means a network connection is never open or closed. It uses timeouts to determine connection state; on a slow CI runner, these timeouts could be reached. Increasing this timeout should reduce flakes, but is unlikely to remove this flake entirely.

WebRTC uses UDP, which means a network connection is never open or closed. It uses timeouts to determine connection state; on a slow CI runner, these timeouts could be reached. Increasing this timeout should reduce flakes, but is unlikely to remove this flake entirely.
@kylecarbs kylecarbs self-assigned this Jan 14, 2022
@codecov

codecov Bot commented Jan 14, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #26 (30ea590) into main (423611b) will increase coverage by 0.15%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #26      +/-   ##
==========================================
+ Coverage   71.31%   71.47%   +0.15%     
==========================================
  Files          37       37              
  Lines        1311     1311              
  Branches        7        7              
==========================================
+ Hits          935      937       +2     
+ Misses        302      300       -2     
  Partials       74       74              
Flag Coverage Δ
unittest-go-macos-latest 63.51% <ø> (?)
unittest-go-ubuntu-latest 71.44% <ø> (+0.08%) ⬆️
unittest-go-windows-latest 63.60% <ø> (?)
unittest-js 71.01% <ø> (ø)
Impacted Files Coverage Δ
peer/conn.go 76.14% <0.00%> (+0.30%) ⬆️
peer/channel.go 88.05% <0.00%> (+0.62%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 423611b...30ea590. Read the comment docs.

Comment thread peer/conn_test.go
)

const (
disconnectedTimeout = time.Millisecond * 200

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

thought (non-blocking): It's not clear to me why it would timeout at all given the connections are local 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When CPU is contended in CI... this flake occurred because it took >200ms to negotiate the connection (which is ridiculously slow execution)!

@bryphe-coder bryphe-coder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Glad this improves the reliability of the tests! Increasing timeouts alone always makes me nervous (because code always finds a way of running just slow enough to still hit the timeout...) but cleaning up the servers with sch.Close() seems like it will help, too

Thanks for investigating these flaky test runs!

@bryphe-coder

Copy link
Copy Markdown
Contributor

Also looks like one we could backport to cdr/m as well to improve the test reliability there 🎉

@kylecarbs
kylecarbs merged commit a461bc1 into main Jan 14, 2022
@kylecarbs
kylecarbs deleted the disctime branch January 14, 2022 16:12

Copy link
Copy Markdown
Collaborator

Pushed 80b93e0 addressing the actionable findings from the deep review with the smallest reasonable diff.

Resolved

  • P1 unbounded downloadFileText (C1) — bounded at the network boundary via BufferedSource.request(maxBytes + 1) + readByteString(maxBytes), closes the body, default cap 1 MiB. app/src/main/java/com/coder/android/data/repository/AgentChatRepository.kt.
  • P1 over-broad isPlanTextFile (C3) — dropped the bare fileName.contains("plan") substring branch, kept the safe mediaType and .md-extension paths.
  • P2 unbounded chatFileTextCache + mapLatest cancellation (C2/C4) — cache is now ConcurrentHashMap<UUID, Deferred<String>> populated on the appScope via computeIfAbsent { ... async { ... } }, so mapLatest cancellation no longer kills the underlying HTTP fetch and concurrent callers dedupe on fileId.
  • P2 pending-attachment matcher (C5) — captures the highest USER message id at send time as pendingSendAfterId and requires any attachment-only echo to be newer; historical attachment messages no longer clear the placeholder.
  • P2 main-thread base64 decode in plan flow (C6) — wrapped the inline-data branch in withContext(Dispatchers.Default).
  • P3 runCatching swallowed CancellationException — rethrown explicitly in both VM call sites.
  • P3 TalkBack drops attachment names for attachment-only USER rows — description builder now includes file/image names (or count) inside the merged-descendants surface.

Deferred (out of scope for the smallest safe diff)

  • P2 SecureDevManager policy gap on downloadFileText — flagged to policy owner before merging; needs a product call on whether chat-file text counts as DLP-restricted workspace data.
  • P3 RemoteTextFilePreview no retry affordance — UX follow-up, not in the bug's blast radius.
  • P3 main-thread base64 decode in FileAttachmentChip.decodeBase64Text — same Compose-thread pattern as the plan flow but the chip is already capped at 1 MiB inline and gated by viewport; will pair with the duplication-cleanup follow-up.
  • P3 MarkdownRender cacheKey collision on duplicate file names — small footgun; needs cacheKey = part.fileId?.toString() ?: name plumbed through TextFilePreview.
  • P3 / Nit FileHeader and decodeBase64Text duplication, hasFileAttachment non-adoption in retry/UserMessage, generic chip layout — consolidation pass best done in its own PR.
  • P4 InlineImageAttachment always renders an "Attachment" caption — cosmetic.

Validation:

  • JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 ANDROID_HOME=/home/coder/android-sdk ./gradlew test -PskipVpnAar passed.
  • ./gradlew assembleDebug -PskipVpnAar passed.

This follow-up was generated by Coder Agents.

jakehwll added a commit that referenced this pull request Sep 21, 2026
> 🤖 This PR was modified by Coder Agents on behalf of Jake Howell.

Replaces the three screenshots under `docs/images/admin/licenses/` with
Figma-exported previews in the same 896px style as #29455, reflecting
the current Licenses UI. The old `licenses-screen.png` predated the
Products / Add-ons license card (Coder Workspaces, Coder Agents, AI
Governance).

Image-only change; no docs text or paths were modified. Referenced from
`docs/admin/licensing/index.md` and `docs/tutorials/faqs.md`. Files are
40-60% smaller and no longer carry EXIF metadata.

| Old | New |
|---|---|
| <img width="448" alt="licenses-screen (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/licenses-screen.png"
/> | <img width="448" alt="licenses-screen (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/licenses-screen.png"
/> |
| <img width="448" alt="licenses-nolicense (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/licenses-nolicense.png"
/> | <img width="448" alt="licenses-nolicense (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/licenses-nolicense.png"
/> |
| <img width="448" alt="add-license-ui (old)"
src="https://raw.githubusercontent.com/coder/coder/53ad29512def2e562f41fc17509508896980605e/docs/images/admin/licenses/add-license-ui.png"
/> | <img width="448" alt="add-license-ui (new)"
src="https://raw.githubusercontent.com/coder/coder/1a18a0ee925d12cecfb1e2cee5e37b22602a3629/docs/images/admin/licenses/add-license-ui.png"
/> |

<details>
<summary>Verification</summary>

- Every visible label in the new images maps to a current string in
`site/src/pages/DeploymentSettingsPage/LicensesSettingsPage/`
(`LicenseCard.tsx`, `LicensesSettingsPageView.tsx`,
`AddNewLicensePageView.tsx`, `CoderWorkspacesProductCard.tsx`,
`CoderAgentsProductCard.tsx`).
- Mock license data only: license #26, 64/100 seats, valid August 27,
2024 to August 27, 2027. No license key, deployment ID, or email
visible.
- Dimensions 896x512 / 896x352 / 896x512, matching the
`docs/images/screenshots/` convention from #29455.

</details>
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.

3 participants