<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Grindr Engineering - Medium]]></title>
        <description><![CDATA[Grindr Engineering - Medium]]></description>
        <link>https://medium.com/grindr-engineering?source=rss----812be62c41f4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Grindr Engineering - Medium</title>
            <link>https://medium.com/grindr-engineering?source=rss----812be62c41f4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 04:04:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/grindr-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I taught Claude to write Maestro tests (so I don’t have to)]]></title>
            <link>https://medium.com/grindr-engineering/how-i-taught-claude-to-write-maestro-tests-so-i-dont-have-to-3beca28a399c?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/3beca28a399c</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[maestros]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[qa]]></category>
            <dc:creator><![CDATA[Sergio Castrillon]]></dc:creator>
            <pubDate>Mon, 11 May 2026 19:51:03 GMT</pubDate>
            <atom:updated>2026-05-11T19:51:02.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BbpZtjcagOYWVPt2KP5VGQ.gif" /></figure><p>There’s a type of Mobile development work that doesn’t feel like engineering. A new feature ships. QA wants E2E coverage. You open the maestro/ folder, stare at an existing test for reference, copy the structure, swap out element IDs, run it, watch it fail because a timeout is too short, bump the timeout, run it again. Repeat until it passes. Submit the PR.</p><p>It’s not hard. It’s just slow and mechanical — exactly the kind of work AI should be handling.</p><p>The problem was: every time I tried to get Claude to generate a Maestro test, it would produce something that <em>looked</em> right but was wrong in subtle ways. Wrong selectors. Wrong timeout values. Missing post-login interruption handling.</p><p>So I stopped asking Claude to write Maestro tests directly. I built a skill that teaches it how to do it right — and before you ask: yes, Maestro MCP exists, and no, it wasn’t enough. More on that later.</p><h3>The Setup</h3><p>The skill — /create-maestro-test — works in two modes. You can describe what you want in plain English:</p><p>/create-maestro-test &quot;Test navigating to inbox and opening the first conversation&quot;</p><p>Or you can invoke it with no arguments and it walks you through a questionnaire: feature, action, test type (main flow vs. reusable subflow), user type, clean state, recording, build flavor.</p><p>Once it has what it needs, it doesn’t just write YAML from scratch. It reads your existing tests first — 2 or 3 similar ones — learns your element IDs, your timeout patterns, your label conventions, and builds from those. The output ends up looking like it belongs in your codebase because it actually learned from your codebase.</p><h3>Building a Test From Scratch, No Prior Knowledge Needed</h3><p>One of the most powerful aspects of the skill is that you don’t need to know anything about the existing test infrastructure to get started. The questionnaire handles all of it.</p><p>You answer: what feature, what action, which user type, clean state or not. The skill then does the heavy lifting — it loads the shared user credentials, reads the timeout constants, searches the codebase for similar existing tests, extracts the relevant element IDs from them, and assembles a complete test that already follows your project’s conventions.</p><p>For a brand new screen with no prior tests to reference, it still works. It falls back to the Compose and XML naming conventions documented in its guides, marks any uncertain IDs with # TODO: Verify element ID, and gives you a scaffold that&#39;s already 80% right. The remaining 20% is confirming that the IDs actually exist in the app — something that takes minutes with Layout Inspector.</p><p>The questionnaire isn’t just a UX improvement. It’s what makes the skill usable by anyone on the team, regardless of how much they know about Maestro or the existing test suite.</p><h3>The Thing That Surprised Me Most</h3><p>Before building this skill, I assumed the hard part would be getting Claude to write valid YAML. It wasn’t.</p><p>The hard part was teaching it how to <em>find the right UI components to test</em>. Specifically, how to distinguish between XML elements and Compose components, and how to know which selector to use for each.</p><p>Maestro uses id: as the universal selector for both XML resource IDs and Compose test tags — but there&#39;s a critical distinction in <em>how</em> you tag Compose components. If a developer uses Modifier.testTag(&quot;ProfileCard&quot;), Maestro will not find it. The element simply doesn&#39;t appear. We kept getting &quot;Element not found&quot; errors and couldn&#39;t figure out why — the Layout Inspector clearly showed the component.</p><p>The fix: developers need to use Modifier.testTagAsId(&quot;ProfileCard&quot;) instead. Once tagged with testTagAsId, it&#39;s reachable in Maestro via id: &#39;ProfileCard&#39; — the same selector you&#39;d use for an XML view. The naming convention is the only visual cue that tells you which you&#39;re dealing with:</p><ul><li><strong>XML</strong> → snake_case (e.g., inbox_conversation_container)</li><li><strong>Compose</strong> → PascalCase (e.g., ProfileCard, SendMessageButton)</li></ul><p>Once that distinction was clear and documented in the skill’s guides, the component-finding problem was effectively solved. The skill now searches the codebase for testTagAsId usages when targeting Compose screens, and falls back to the Layout Inspector instructions when nothing is found. That&#39;s the kind of thing that takes an hour to debug the first time and two seconds to fix once you know — and now nobody on the team has to rediscover it.</p><h3>The Auto-Fix Loop</h3><p>When a generated test fails, the skill doesn’t just report the error — it categorizes it and applies a targeted fix before retrying. There are three failure types it handles automatically:</p><p><strong>Timeout / Element Not Found</strong> — The element exists but Maestro can’t find it in time or with the current selector. The skill increases the timeout to 50s, tries an alternative selector (checking whether an XML id should be a Compose testTagAsId or vice versa), and adds an extra wait before the failing step.</p><p><strong>Element Not Tappable</strong> — The element is visible but can’t be interacted with, usually due to an overlay or an animation still in progress. The skill adds an extendedWaitUntil before the tap, tries tapping by visible text as a fallback, and checks for anything blocking the element.</p><p><strong>Selector Ambiguity</strong> — Multiple elements match the selector. The skill adds index: 0 to target the first match and narrows the selector where possible.</p><p>It retries up to three times, each attempt applying a different fix strategy. After each retry it tells you what changed and why. If all three attempts fail, it hands you the full Maestro output with a clear explanation of the failure category — so you know exactly where to look, not just that something broke.</p><p>Most first-run failures fall into one of those three buckets. The auto-fix resolves the majority without any manual intervention.</p><h3>In Practice</h3><p>Here’s what the inbox test from this post’s intro looks like now:</p><p>/create-maestro-test &quot;Navigate to inbox and open a conversation&quot;</p><p>Total time from prompt to passing test: under 5 minutes, most of which is the emulator booting.</p><h3>Why Not Maestro MCP?</h3><p>The skill was built before Maestro MCP was available. When MCP did arrive, the reason to keep the skill became clear immediately.</p><p>MCP gives Claude knowledge of Maestro. It doesn’t give Claude knowledge of <em>your app</em>. It doesn’t know which element IDs your project uses, how your timeout constants are defined, or what your post-login interruption flow expects. Without that codebase-specific context, the output looks plausible but fails at runtime in exactly the ways described above — wrong selectors, mismatched timeouts, missing interruption handling.</p><p>The skill bridges that gap. It reads your codebase before generating anything, and that’s the difference between output that looks right and output that actually runs.</p><h3>The Takeaway</h3><p>Building this skill forced us to understand Maestro more deeply than we ever would have by just writing tests manually. The testTagAsId vs testTag distinction, the auto-fix categories, the selector priority rules — none of these would have ended up documented if we hadn&#39;t had to teach them to an AI precisely enough to generate correct output.</p><p>That’s the underrated benefit of this kind of work. You don’t just get automation. You get clarity about what you actually know — and a permanent, shareable record of it.</p><p>The questionnaire-driven approach also changed how we think about test authorship. It’s no longer a task that requires deep knowledge of the test infrastructure. Anyone who knows what they want to test can produce a valid, passing Maestro test in minutes. That’s the real unlock — not the YAML generation, but the democratization of E2E test coverage across the team.</p><p><em>This post was originally published on the Grindr Engineering Blog. To learn more about what our teams are building — or to join us — visit the Grindr Blog and our Careers page.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3beca28a399c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/how-i-taught-claude-to-write-maestro-tests-so-i-dont-have-to-3beca28a399c">How I taught Claude to write Maestro tests (so I don’t have to)</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Couldn’t See Its Print Statements Without Xcode — Here’s How We Fixed It]]></title>
            <link>https://medium.com/grindr-engineering/claude-couldnt-see-its-print-statements-without-xcode-here-s-how-we-fixed-it-0ac4e842a6b2?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/0ac4e842a6b2</guid>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[swift]]></category>
            <category><![CDATA[xcode]]></category>
            <dc:creator><![CDATA[Max Roche]]></dc:creator>
            <pubDate>Wed, 15 Apr 2026 13:46:55 GMT</pubDate>
            <atom:updated>2026-04-15T13:46:53.862Z</atom:updated>
            <content:encoded><![CDATA[<p>Serious question: If you couldn’t use print statements, would you be able to debug anything?</p><h3>Problem</h3><p>This is exactly the issue we ran into with Claude. When running our iOS app from the terminal using xcodebuild, Claude couldn’t see its own print statements.<em> </em>Without access to logs, it become almost impossible for Claude to autonomously iterate and debug issues.</p><h3>Why It Matters</h3><p>For many developers, debugging starts with print statements. If you’re anything like me, your code looks a lot like this:</p><pre>func sendRequest() async {<br>  print(&quot;Testing: Here 1&quot;)<br>  do {<br>    let response: Response = await webService.sendRequest(...)<br>    print(&quot;Testing: here 2 - got response&quot;)<br>  } catch {<br>    print(&quot;Testing: here 3 - got error \(error)&quot;)<br>  }<br>}</pre><p>This works because, historically, we ran our apps through Xcode and inspected logs in the console pane. However, our iOS team at Grindr is operating CLI first, meaning it’s rare for us to even open Xcode anymore. Which brings us to the core issue:</p><p><em>How can Claude debug or validate its work if it cannot see its own print statements?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*RvbquDO_b21XSHrQ" /></figure><h3>Why Can’t Claude see print statements?</h3><p>The iOS simulator runs as a separate process. When we use the print statement it writes to that process&#39; standard out. However, Claude also runs as a separate process. Basically, the app logs to Process A but Claude is in Process B. To solve this, we needed to log to a destination that both Claude and the running Simulator have access to. We explored a number of ideas, including a local Websocket server, Console.app, and logging to a local file.</p><h3>Solution</h3><p>Ultimately, we went with the last option — <strong>logging to a local file and streaming it with tail</strong>. Here is how we did it.</p><h4>Deciding Where To Log</h4><p>When we run the app on a simulator, the OS will give our app a folder that lives on our laptop. Therefore, we can use the FileManager API on iOS to write to a file, and we know this file will live somewhere in ~/Library/Developer/... on our mac (more on this below):</p><p>// GrindrLogger.swift func log() { let logFile = FileManager.default .urls(for: .cachesDirectory, in: .userDomainMask)[0] .appendingPathComponent(&quot;grindr-debug.log&quot;) // Pick a unique file name let fileHandle = try FileHandle(forWritingTo: logFile) try fileHandle.seekToEnd() try fileHandle.write(contentsOf: (message + &quot;\n&quot;).data(using: .utf8)!) }</p><p>Figuring out where our app lives on the file system</p><p>Since the simulator filesystem is just a folder on our laptop, any process can access these files. The simulator will log to a specific file, and we just need to figure out two things:</p><ol><li>What is the simulator ID?</li><li>What is the app container ID?<br>Once we have these, we know our log file will be at the following path: ~/Library/Developer/CoreSimulator/Devices/&lt;SIMULATOR-ID&gt;/data/Containers/Data/Application/&lt;APP-UUID&gt;/Library/Caches/&lt;my-log-file&gt;</li></ol><h4>Getting the simulator ID</h4><p>Getting the simulator ID should be pretty easy. A command such as xcrun simctl list devices | grep &quot;(Booted)&quot; should get you the right simulator if you have a simple setup.</p><h4><em>Getting the App UDID</em></h4><p>Apple will assign each app a UUID, which is a folder for the app to store its files. To get the UDID, you can run the following command xcrun simctl get_app_container &lt;SIMULATOR-UDID&gt; &lt;BUNDLE-ID&gt; data.</p><p>Finally, how do we stream the file?</p><p>This is the simple part, now that you have the file path for your logs, you can just call tail -f &lt;path-to-log-file&gt; and this will print the new lines as they are appended.</p><p>Putting it all together</p><p>The TL;DR is that you can:</p><ul><li>Write some swift code using FileManager to write to hard-coded file</li><li>Use xcrun simctl to discover your simulator id</li><li>Use xcodebuild to run the app</li><li>Use xcrun simctl get_app_container to figure out the app ID and file path the OS assigned to your app instance</li><li>Stream that file with tail -f</li></ul><p>At Grindr, we built lightweight wrappers around the xcodebuild, xcrun, and other xcode CLI commands.</p><h3>Conclusion</h3><p>Hopefully this helps you become more autonomous with Claude and other coding agents! Giving Claude access to its own print/log statements has allowed us to automate several other tasks such as telemetry, error logging, …etc.</p><p>Please leave a comment if you solved this problem in another cool way! Happy coding 😀</p><p><em>This post was originally published on the </em><a href="https://www.grindr.com/blog/claude-couldnt-see-its-print-statements-without-xcode---heres-how-we-fixed-it"><em>Grindr Engineering Blog</em></a><em>. To learn more about what our teams are building — or to join us — visit the </em><a href="https://www.grindr.com/blog"><em>Grindr Blog</em></a><em> and our </em><a href="https://www.grindr.com/careers/jobs"><em>Careers page</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ac4e842a6b2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/claude-couldnt-see-its-print-statements-without-xcode-here-s-how-we-fixed-it-0ac4e842a6b2">Claude Couldn’t See Its Print Statements Without Xcode — Here’s How We Fixed It</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How a Local AI Review Skill Is Reducing PR Round-Trips at Grindr]]></title>
            <link>https://medium.com/grindr-engineering/how-a-local-ai-review-skill-is-reducing-pr-round-trips-at-grindr-cfe2ec22aebd?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/cfe2ec22aebd</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Ricardo Marin]]></dc:creator>
            <pubDate>Wed, 08 Apr 2026 00:04:45 GMT</pubDate>
            <atom:updated>2026-04-08T00:04:45.172Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BbpZtjcagOYWVPt2KP5VGQ.gif" /></figure><p>There was a ritual that preceded every PR submission.</p><p>Write the code. Run the tests. Review the diff one final time. Convince yourself it holds up. Submit. Then wait (sometimes for hours) only to receive a comment like “missed a null check” or “this breaks our MVI pattern” in return.</p><p>The feedback was never wrong. It was simply late. And every round-trip through review compounds the friction: context switching for the reviewer, rebasing, re-requesting, the entire cycle repeating.</p><p>Then we introduced the grindr-code-review skill.</p><h3>What It Actually Is</h3><p>Before pushing and opening a PR, you can trigger an AI-powered code review locally inside Claude Code (or Firebender). It reads your diff, loads the relevant architecture documentation, and returns structured feedback; covering the same categories a senior engineer would address in a thorough review.</p><p>This is not a linter. It is not a formatting checker. It understands our MVI patterns, our Kotest standards, Compose recomposition issues, and potential memory leaks. It cross-references our actual internal documentation when forming its analysis.</p><p>The feedback is structured exactly as a human review would be: critical issues, warnings, minor suggestions, and a section acknowledging what was done well.</p><p>The first notable moment was when it identified a missing LaunchedEffect key that would have produced a recomposition loop. That is precisely the kind of issue that is easy to overlook during self-review and non-trivial to spot in a diff. A reviewer would have caught it eventually; but now it surfaces before the PR is ever opened.</p><h3>How to Use It</h3><p>The skill responds to natural language; simply typing “review my changes”, “code review”, or “review this code” in the chat is sufficient for it to infer the intent. That is the primary invocation path for most engineers.</p><p>You can also invoke it explicitly with arguments when you need to target a specific scenario. There are four modes, each addressing a common point in the development workflow:</p><p><strong>Default — review staged changes:</strong></p><p>/grindr-code-review</p><p>This is the standard invocation. Stage your changes, run the skill, review the output.</p><p><strong>WIP review — review unstaged changes:</strong></p><p>/grindr-code-review --unstaged</p><p>Useful for mid-development sanity checks. No staging required.</p><p><strong>Full PR prep — review the entire branch against master:</strong></p><p>/grindr-code-review --branch feature/your-branch-name</p><p>Run this immediately before opening the PR. It evaluates the complete branch diff, not just the current working state.</p><p><strong>Focused review — review specific files:</strong></p><p>/grindr-code-review --files app/src/main/kotlin/ProfileViewModel.kt</p><p>When a particular file contains the complexity you want examined, this directs the review accordingly.</p><h3>What It Checks</h3><p>The review covers five categories:</p><p><strong>Code Quality</strong>: Kotlin conventions, null safety, naming, and anything likely to introduce ambiguity for the next engineer reading the code.</p><p><strong>Performance</strong>: Memory leaks, Compose recomposition triggers, and patterns that could silently degrade runtime behavior.</p><p><strong>Architecture</strong>: MVI patterns and Clean Architecture layer boundaries. It recognizes that the domain layer has no business importing Android classes and will flag violations accordingly.</p><p><strong>Testing</strong>: Kotest standards, BaseSpec usage (BaseSpec is our internal base class that wraps Kotest&#39;s BehaviorSpec — always extend it instead of BehaviorSpec directly), and Turbine for Flow testing. It identifies when tests use runBlocking in contexts where it is inappropriate.</p><p><strong>Bugs</strong>: Logic errors, unhandled edge cases, and the class of issue that does not surface in tests but manifests in production.</p><h3>What the Output Looks Like</h3><p>The review opens with a summary table: files reviewed, issue counts broken down by severity, an overall assessment, an estimated remediation time, and a risk level. The format is intentional — it gives you the signal you need to decide whether to fix now or ship and follow up.</p><p>Below is representative output from a real review session.</p><h3>🎯 Review: FeatureViewModel — ⚠️ Needs Changes</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tWYE6tzjD3hfaoqHy6GAbg.png" /></figure><h3>🚀 Quick Wins</h3><p><strong>Fix these first — each takes &lt; 5 minutes:</strong></p><ol><li>FeatureUseCase.kt:12 — Unused import → Remove line</li><li>ItemListScreen.kt:15 — Wildcard import io.mockk.* → Replace with explicit imports</li><li>DataRepository.kt:89 — Magic number 300 → Extract to named constant TIMEOUT_MS</li></ol><h3>🚨 Critical Issues (Must Fix)</h3><h3>FeatureViewModel.kt:45 🚨</h3><p><strong>Issue</strong>: Using runBlocking in ViewModel<br><strong>Impact</strong>: Blocks the UI thread on every call, causing ANRs and visible freezes</p><p><strong>Solution</strong>:</p><pre>// ❌ Current — blocks UI thread<br>fun loadData() = runBlocking { repository.getData() }<br><br>// ✅ Fixed — non-blocking coroutine scope<br>fun loadData() = launchInIo {<br>    repository.getData()<br>        .onSuccess { updateState { copy(data = it) } }<br>        .onFailure { updateState { copy(error = it.message) } }<br>}</pre><p><strong>Reference</strong>: docs/architecture/mvi-pattern.md — &quot;Extension Functions for Coroutines&quot;</p><h3>DataRepository.kt:123 🚨</h3><p><strong>Issue</strong>: Activity context retained in Repository<br><strong>Impact</strong>: Memory leak — Repository outlives Activity; GC cannot reclaim Activity</p><p><strong>Solution</strong>:</p><pre>// ❌ Current — retains Activity reference<br>class DataRepository(private val context: Activity)<br><br>// ✅ Fixed — use Application context<br>class DataRepository(private val context: Context) // inject applicationContext via Hilt</pre><p><strong>Reference</strong>: docs/memoryLeak-guidelines.md</p><h3>⚠️ Warnings (Should Fix)</h3><h3>ItemListScreen.kt:78 ⚠️</h3><p><strong>Issue</strong>: Unstable lambda causes unnecessary recompositions<br><strong>Impact</strong>: Every state change recomposes all list items — degrades performance with large lists</p><p><strong>Solution</strong>:</p><pre>// ❌ Current — lambda recreated on every recomposition<br>items(items) { item -&gt;<br>    ItemRow(onClick = { viewModel.handleEvent(Events.OnItemClick(item)) })<br>}<br><br>// ✅ Fixed — stable callback via eventEmitter<br>items(items, key = { it.id }) { item -&gt;<br>    ItemRow(onClick = { eventEmitter.handleEvent(Events.OnItemClick(item)) })<br>}</pre><p><strong>Reference</strong>: docs/composable-guidelines.md</p><h3>✅ Positive Observations</h3><ul><li>Proper MVI sealed interface hierarchy — state class is correctly marked @Stable</li><li>Comprehensive test coverage with Given/When/Then structure throughout</li><li>Correct use of launchInIo / launchInMain in all other ViewModels</li></ul><h3>Where Human Review Still Wins</h3><p>This is a pre-review tool. It does not replace human code review.</p><p>It will not catch everything. It has no awareness of product context, the rationale behind a decision made six months ago, or the subtle implications of a change in a shared module that multiple teams depend on. That judgment belongs to your teammates.</p><p>What it does is front-load the mechanical feedback; the pattern violations, the clear issues, the comments that would otherwise read “per our standards, this should be X.” Reducing that category of feedback allows the actual review conversation to concentrate on what genuinely requires human judgment: design decisions, tradeoffs, product implications, the things that only come from knowing the codebase and the people who depend on it.</p><h3>The Takeaway</h3><p>Run a code review before you open the PR. It takes under a minute and will surface issues you missed.</p><p>Your reviewers will still find things. That is the purpose of code review. But when the first round of feedback is “looks good, just these two items” rather than six threads of back-and-forth, everyone’s time is more effectively spent.</p><p>The code does not get worse. The review simply gets faster.</p><p><em>This post was originally published on the Grindr Engineering Blog. To learn more about what our teams are building — or to join us — visit the </em><a href="https://www.grindr.com/blog"><em>Grindr Blog</em></a><em> and our </em><a href="https://www.grindr.com/careers/jobs"><em>Careers page</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfe2ec22aebd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/how-a-local-ai-review-skill-is-reducing-pr-round-trips-at-grindr-cfe2ec22aebd">How a Local AI Review Skill Is Reducing PR Round-Trips at Grindr</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Stopped Writing Simple View Components]]></title>
            <link>https://medium.com/grindr-engineering/why-i-stopped-writing-simple-view-components-99a4f970ad1f?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/99a4f970ad1f</guid>
            <dc:creator><![CDATA[Noah Nelson]]></dc:creator>
            <pubDate>Thu, 26 Mar 2026 18:05:15 GMT</pubDate>
            <atom:updated>2026-03-27T18:28:26.172Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gWupYHyCZff2dO2rYPhLOw.png" /></figure><p>There’s a category of Android work I used to dread — not because it was hard, but because it wasn’t interesting. New screen comes in from design. You open Figma, map out the layout, write the composable, get the spacing roughly right, submit the PR, and get back a comment that the padding on the card is 12dp not 16dp.</p><p>Rinse, repeat.</p><p>It wasn’t challenging work. It was transcription. And transcription is exactly the kind of thing I shouldn’t be spending engineering time on. The real cost isn’t the time — it’s that every pass through that loop is a chance for something to drift from what the designer actually intended.</p><h3>Something Changed</h3><p>A few months ago I connected Claude to the Figma MCP server. The setup is literally two commands:</p><p><strong>Step 1 — Enable the MCP server in Figma Desktop:</strong><br>Open Figma Desktop → Preferences → Enable Dev Mode MCP Server. That’s it. Figma starts exposing a local MCP endpoint at <a href="http://127.0.0.1:3845/sse.">http://127.0.0.1:3845/sse</a></p><p><strong>Step 2 — Register it with Claude Code:</strong></p><p>claude mcp add --transport sse figma <a href="http://127.0.0.1:3845/sse">http://127.0.0.1:3845/sse</a></p><p>That’s the whole setup. From that point on, Claude isn’t looking at a screenshot of your design. It’s reading the actual file. Component names, layout structure, spacing tokens, design variables — all of it. Because of the Figma MCP, Claude has direct access to the same source of truth the designer was working from.</p><p>The first time I handed it a Figma URL and said “implement this,” I expected the usual output: something close but wrong in a dozen small ways. Instead it came back with composables that used our actual design system components, correct token values, and a structure that matched what the designer built.</p><p>I haven’t manually transcribed a simple view since.</p><h3>What My Workflow Looks Like Now</h3><p>Hey Claude! Can you build a composable for the bottom sheet based on this Figma design? <a href="https://www.examplefigmalink/">https://www.examplefigmalink</a> <br>A few notes: Use our existing [BottomSheetComponentName] as a reference for structure and styling - Hook it up to [ViewModelName] and use the existing state exposed there. Let me know if anything in the design is unclear or missing.</p><p>Designer adds a frame to Figma. I drop the URL into Claude with some context about where it fits in the feature — what ViewModel it should talk to, what state it needs to react to. Through the Figma MCP, Claude reads the file and maps components to what already exists in our codebase, generating a first pass that’s already grounded in the real design.</p><p>That first pass isn’t production-ready. But it’s not supposed to be. It’s a scaffold that’s already aligned with the design and already using the right components. My job shifts from writing the view to reviewing, shaping it and the architecture behind it — which is where my time should be going anyway.</p><h3>The Time It Actually Saves</h3><p>Here’s what the before and after looks like on a representative simple screen — say, a new settings row, a profile card, or a content carousel:</p><p><strong>Before:</strong></p><ul><li>Open Figma, inspect spacing, colors, component names manually: ~15 min</li><li>Write the composable from scratch: ~45 min</li><li>Submit PR, get back pixel-level feedback, iterate: ~30 min</li><li>Total: <strong>~90 minutes</strong> of mostly mechanical work</li></ul><p><strong>After:</strong></p><ul><li>Drop Figma URL into Claude with a sentence of context: ~1 min</li><li>Review and shape the generated scaffold: ~5–10 min</li><li>Submit PR: ~2 min</li><li>Total: <strong>~10–15 minutes</strong></li></ul><p>That’s an 80–90% reduction on the transcription work — and the output is more accurate to spec because Claude is reading the actual Figma tokens, not my approximation of them. Across a feature with five or six new screens, that’s a full day of engineering time back.</p><p>And the gains aren’t linear. The more complex the screen, the more surface area there is for manual transcription errors. A screen with ten components, each with specific spacing, colors, and states, used to be a multi-hour exercise. Now it’s a scaffold in minutes.</p><h3>What This Actually Unlocks</h3><p>The code generation is the obvious win. But the more interesting unlock is what happens to collaboration.</p><p>Design and engineering have always worked toward the same goal — they just rarely worked from the same context. Designers live in Figma. Engineers live in the IDE. Everything in between is translation: screenshots, redlines, Slack threads, tickets with attached PNGs. The Figma MCP collapses that gap. When Claude can read the design file directly, both sides are finally referencing the same source of truth at the same time.</p><p>And that opens up workflows that weren’t really possible before. Take something as routine as ticket creation: instead of an engineer manually pulling a Figma frame, screenshotting it, writing up a description, and linking the file — Claude can do that whole loop. Point it at a Figma board, and it can read the frames, generate a ticket description grounded in the actual design, attach the relevant screenshots, and drop in the Figma link. What used to take 10 minutes of context-switching is now a prompt.</p><p>That’s just one example. The broader point is that once Claude has eyes on the design file, a lot of work that lived in the seams between tools just disappears.</p><h3>What It Isn’t</h3><p>It’s not magic. Poorly structured Figma files produce noisy output. Complex stateful logic still needs to be thought through carefully. And a designer still needs to review what ships.</p><p>But for the straightforward stuff — a new card, a settings row, a simple screen — the grind is just gone. And freeing up that headspace, consistently, over months, adds up to something real.</p><p>I’m not sure I’d go back even if I could.</p><h3>The Loop Isn’t Closed Yet</h3><p>That said, the handoff still starts with a human. A designer leaves a comment in Figma, and an engineer has to notice it, open a ticket, grab the link, and prompt Claude to start working. We’ve removed a lot of steps, but we haven’t removed the initiation.</p><p>That’s the gap we’re still trying to close, and there are two specific things we’re looking at:</p><p><strong>End-to-end automation:</strong> The goal is for a design comment in Figma to set off the entire downstream flow. A ticket gets created, a branch is spun up, the MCP link is attached, and Claude begins the implementation. No one has to manually start the process. All the pieces are already there. The challenge now is stitching them together into one continuous loop.</p><p><strong>Remote MCP:</strong> Right now the Figma MCP server runs locally, which means Figma Desktop has to be open on someone’s machine for any of this to work. Moving it to a cloud-hosted MCP would make the integration asynchronous and no longer tied to a specific machine. That is a necessary step toward the more autonomous, always-on workflow we are aiming for.</p><p>We’re not there yet. But the direction is clear.</p><p><em>This post was originally published on the Grindr Engineering Blog. To learn more about what our teams are building — or to join us — visit the </em><a href="https://www.grindr.com/blog"><em>Grindr Blog</em></a><em> and our </em><a href="https://www.grindr.com/careers/jobs"><em>Careers page</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99a4f970ad1f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/why-i-stopped-writing-simple-view-components-99a4f970ad1f">Why I Stopped Writing Simple View Components</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Claude Can’t See Xcode Previews — Here’s How We Fixed It]]></title>
            <link>https://medium.com/grindr-engineering/claude-cant-see-xcode-previews-here-s-how-we-fixed-it-d241d3e90d08?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/d241d3e90d08</guid>
            <dc:creator><![CDATA[Max Roche]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 16:24:12 GMT</pubDate>
            <atom:updated>2026-03-17T16:24:11.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>Problem</h3><p>Claude cannot see Xcode Previews, so it ends up building SwiftUI components completely blind.</p><h3>Why This Matters</h3><p>When Xcode Previews were introduced, they changed how we build UI. Instead of recompiling the app, launching a simulator, navigating to a screen, and waiting just to validate a spacing tweak, developers could iterate instantly. That feedback loop saved hours of wasted time.</p><p>Although Apple is pushing Xcode to be more agentic and they just released <a href="https://developer.apple.com/documentation/xcode/giving-agentic-coding-tools-access-to-xcode">Xcode MCP Tools</a> our workflow at Grindr is increasingly CLI-first. Many of our iOS engineers can go an entire week without opening Xcode. Therefore, we want to build solutions that prioritize agents and CLI-first coding practices instead of forcing our developers to open Xcode.</p><p>So we came back to the original question:</p><p><em>How can we give Claude access to “Previews” without ever opening Xcode?</em></p><h3>Solution</h3><p>We wanted to emulate the preview experience for Claude. This meant our requirements were:</p><ol><li><em>Very quick builds:</em> One of Preview’s greatest benefits is hot reloading, allowing developers to iterate on views extremely quickly</li><li><em>No Navigation: </em>We want only our view/component to show up. There is no need to navigate around the app to find your component</li></ol><p>The idea we came up with was to build an app target on the fly based on the View’s import statements. So a view such as this:</p><pre>import GrindrComponents <br>import GrindrImages <br>import SwiftUI <br><br>struct MyComponent: View {   <br>  var body: some View {     <br>    VStack {       <br>      Text(&quot;Component Title&quot;)       <br>      GrindrImage(.placeholder)    <br>    }   <br>  } <br>}</pre><p>has two internal dependencies GrindrComponents and GrindrImages. It has one external dependency SwiftUI. Therefore, we should be able to build a new app target with those 3 dependencies, put our view in the ContentView, and then display it in a simulator. This should give us our two requirements:</p><ul><li><em>Very quick builds</em>: Building a bare minimum app with only the required dependencies will give us far quicker builds than our monolithic app would</li><li><em>No need to navigate</em>: Since our view will be the thing in ContentView, there is no need to navigate around the app to find our component</li></ul><p>Here is what we built. We added a new cli script called `preview &lt;path-to-file&gt;`. The CLI script does the following:</p><ul><li>Locates our file</li><li>Grabs all the imports</li><li>Uses Xcodegen to build a target on the fly</li><li>Renames your view’s struct to match the template’s entry point via regex and drops it into the<br>template project</li><li>Launches the app on a simulator</li></ul><p>All the developer has to do is type ./grind preview /components/MyComponent.swift or ask Claude to &quot;show a preview for that view we are building&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*TVUEFEVXN_00etff" /></figure><h3>Compromises</h3><p>You might be wondering, “but what if my View requires a ViewModel or observable object?”. This is one of the tradeoffs we made for our preview command. Instead of relying on a concrete observable object (like a ViewModel), we’ve updated our documentation to rely more on protocols that describe the observable object. This means we do not have to chase down the entire dependency chain. Everything the view needs is defined in this one file.</p><p>This also is in line with another one of our core philosophies, that not every view needs an observable object or a ViewModel. Often times, the less publishing and observability you can add, the more predictable your components will be. A view that simply accepts data via init is a lot easier to reason about, test, …etc.</p><h3>Next Steps</h3><p>There are several next steps one could take now that you have a hacky preview. You can have Claude use idb or other mcp’s to take screenshots and interact with the simulator. In a follow-up blog post, we will describe some of the approaches and skills we’ve created to work with this preview command.</p><p><em>This post was originally published on the Grindr Engineering Blog. To learn more about what our teams are building — or to join us — visit the </em><a href="https://www.grindr.com/blog"><em>Grindr Blog</em></a><em> and our </em><a href="https://www.grindr.com/careers/jobs"><em>Careers page</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d241d3e90d08" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/claude-cant-see-xcode-previews-here-s-how-we-fixed-it-d241d3e90d08">Claude Can’t See Xcode Previews — Here’s How We Fixed It</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How AI Tools Made Our Grindr Engineering Team More Productive]]></title>
            <link>https://medium.com/grindr-engineering/how-ai-tools-made-our-grindr-engineering-team-more-productive-0744d0f60794?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/0744d0f60794</guid>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Pushkar]]></dc:creator>
            <pubDate>Thu, 05 Mar 2026 19:25:51 GMT</pubDate>
            <atom:updated>2026-03-05T19:25:50.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ln_FLQ-GLT1Ti8jhHBkbtQ.jpeg" /></figure><p>Since mid-2025, Grindr’s Product Engineering team has been on an aggressive journey to embed AI into every layer of how we build software. Six months in, the data is in — and it’s striking. Here’s what we learned.</p><h3>The Headline: ~1.5x Productivity Gain, Across the Board</h3><p>In January 2026, we surveyed 50 of our 65 engineers to understand how AI tools like Claude Code, Cursor, and Firebender are changing the way they work. The results paint a clear picture:</p><ul><li><strong>92% of engineers</strong> believe their productivity has increased by 1.5x or more</li><li><strong>58% believe they’re operating at 2–3x</strong> their pre-AI output</li><li><strong>94% are running 1–5 AI agents in parallel</strong> during a typical development session</li><li><strong>64% use at least one agent for most of their working time</strong></li></ul><p>These aren’t aspirational targets — they’re self-reported numbers from engineers in the trenches, shipping real features every week.</p><h3>What’s Actually Changed for Engineers</h3><p>When we asked engineers to describe the single most valuable shift AI has brought to their work, five themes emerged clearly:</p><p><strong>Speed and throughput.</strong> Task completion time has dropped by nearly 50% for many engineers. Faster iteration cycles mean we can test more ideas, ship more often, and recover from mistakes more quickly.</p><p><strong>Parallelization.</strong> Instead of working through tasks one at a time, engineers are delegating work to agents and focusing their attention on higher-order architecture and design decisions. Context switching — one of engineering’s biggest hidden costs — is down significantly.</p><p><strong>Automation of the mundane.</strong> Boilerplate code, unit test generation, code cleanup, small one-off tasks — AI handles these now. Engineers are freed up for the complex, judgment-intensive work that actually requires a human.</p><p><strong>Faster debugging and code comprehension.</strong> AI can analyze a codebase, surface relevant files, and identify root causes faster than any manual search. This is especially valuable for engineers onboarding to unfamiliar systems.</p><p><strong>Greater confidence and reach.</strong> Engineers are taking on projects they would have previously considered out of scope. AI acts as a force multiplier for individual capability — letting people move with confidence in areas where they might have previously hesitated.</p><h3>Data Beyond the Survey</h3><p>The self-reported data is compelling, but we also have hard numbers from our tooling:</p><p><strong>Cursor AI alone is responsible for ~30% of the code we write.</strong> That’s a substantial share, and it reflects just how deeply integrated AI-assisted coding has become in our day-to-day workflow.</p><p>Our GitHub data corroborates this: there’s been a dramatic increase in the volume of code changes across all platforms. Engineers are making larger, more confident commits — a signal that they feel supported rather than stretched.</p><h3>Where We’re Still Limited</h3><p>Honest assessment matters as much as the wins. Our engineers called out real friction points:</p><ul><li><strong>60%</strong> feel limited by their ability to context switch effectively between multiple agents</li><li><strong>42%</strong> want to add more agents but are still building the muscle for managing them</li><li><strong>28%</strong> are hitting hardware constraints — not enough screen space or compute to run the workflows they want</li><li><strong>20%</strong> don’t yet fully trust agents to auto-deploy without human review</li></ul><p>These aren’t blockers — they’re a roadmap.</p><h3>What We’re Going After Next</h3><p>When we asked engineers what would take AI usage to the next level, four priorities emerged:</p><p><strong>Standardization and shared practices.</strong> Teams have developed their own approaches organically, but we need clearer guidelines and documented patterns so agents can navigate our codebase more reliably — and so we’re not duplicating effort across teams.</p><p><strong>Training, demos, and dedicated experimentation time.</strong> The AI space is moving fast. Engineers want structured time to learn, experiment, and share what’s working. Workshops, a training budget, and regular knowledge-sharing sessions are at the top of the wish list.</p><p><strong>More autonomous agents.</strong> The next frontier is fully agentic automation — bug fixing, SDK updates, UI-to-code generation, and enhanced code review handled end-to-end by agents. We’re early here, but that’s the direction.</p><p><strong>Better tooling and integrations.</strong> Engineers want access to more models (Gemini, Grok Code), stronger MCP connectivity with tools like Figma and GitHub, and a faster path to getting new integrations approved and deployed.</p><h3>Key Takeaways</h3><p>The shift is real and measurable. AI has fundamentally changed the volume and velocity of code our team produces. Lines of code and PR counts are imperfect proxies — but the confidence engineers feel taking on larger, more complex changes is a meaningful signal.</p><p>The next challenge isn’t adoption. It’s intentionality. As we scale up agent usage, we need to be more rigorous about code review, quality gates, and the processes that keep our codebase healthy even as output accelerates.</p><p>We’re just getting started. <a href="https://www.grindr.com/careers">Come join us</a>!</p><p><em>This post summarizes findings from our January 2026 AI Usage Report, based on a survey of 50 Product Engineering team members. Data from Cursor and GitHub internal tooling was also included.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0744d0f60794" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/how-ai-tools-made-our-grindr-engineering-team-more-productive-0744d0f60794">How AI Tools Made Our Grindr Engineering Team More Productive</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Automated Memory Leak Debugging from Hours to Minutes with AI]]></title>
            <link>https://medium.com/grindr-engineering/how-we-automated-memory-leak-debugging-from-hours-to-minutes-with-ai-87a64a5a0384?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/87a64a5a0384</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[memory-leak]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Ricardo Marin]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 22:08:37 GMT</pubDate>
            <atom:updated>2026-02-10T22:08:35.721Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pacNM2CwfoDicaqr4JfvjQ.png" /></figure><p>Memory leak debugging in Android follows a predictable pattern: LeakCanary detects the leak, an engineer spends 2–4 hours analyzing traces and implementing fixes, and the cycle repeats. At Grindr, with multiple teams shipping features across a large-scale app serving nearly 15 million monthly users, we actively prioritize memory management. However, like any complex Android application, memory leaks could emerge as new features are added.</p><p>The insight that changed our approach: memory leaks aren’t creative problems requiring human ingenuity; they’re pattern-matching problems. Activity lifecycle issues, Fragment view binding retention, ViewModel coroutine leaks; these follow predictable patterns with established solutions.</p><p>Pattern-matching is exactly what AI excels at. So we built an automated system that reads LeakCanary traces, classifies leak types, and applies fixes automatically. The result: significantly faster resolution times and a more manageable memory leak workflow.</p><h3>Why Android Memory Leak Automation Changes Everything</h3><p>The traditional memory leak workflow has a fundamental inefficiency: every leak requires the same analytical process, even when the pattern is identical to one you fixed last week.</p><p><strong>The Manual Process:</strong></p><ol><li>LeakCanary detects leak and generates trace</li><li>Engineer reads 200+ line stack trace</li><li>Identify leak pattern (Activity? Fragment? ViewModel?)</li><li>Search codebase for relevant files</li><li>Implement fix (onDestroy cleanup, binding nullification, etc.)</li><li>Rebuild, deploy, test, verify</li><li>Repeat for the next leak</li></ol><p><strong>Time cost:</strong> 2–4 hours per leak<br><strong>Problem:</strong> Steps 2–5 are pure pattern-matching; perfect for automation</p><h3>The Architecture: Building an AI Debugging Agent</h3><p>Instead of manually debugging each leak, we built a custom AI workflow that handles the entire resolution cycle.</p><p>We implemented this as a custom command (/GrindrFixMemoryLeak) in <a href="https://firebender.com/">Firebender</a>, an AI coding assistant for Android Studio. The command is defined in a structured text file that outlines the step-by-step workflow. This approach works with AI coding tools that support custom command definitions through configuration files; whether that&#39;s markdown files (.md), rule files (.cursorrules, .mdc), or similar structured formats that different AI assistants use to define reusable workflows.</p><h3>The Four-Step Automation Workflow</h3><p><strong>1. Automated Trace Extraction</strong></p><p>The agent executes ADB commands to pull LeakCanary logs:</p><pre>adb logcat -d -s LeakCanary | grep -E &quot;(┬───|GC Root|Leaking: YES)&quot; -A 20 -B 5</pre><p>This command filters logcat output for LeakCanary traces, capturing 20 lines after (-A 20) and 5 lines before (-B 5) each match to preserve the full leak context.</p><p><strong>2. Pattern Classification</strong></p><p>AI analyzes traces and classifies by pattern:</p><ul><li><strong>Activity leaks</strong> — Lifecycle cleanup issues</li><li><strong>Fragment leaks</strong> — View binding retention</li><li><strong>ViewModel leaks</strong> — Coroutine cancellation missing</li><li><strong>Singleton leaks</strong> — Context retention in long-lived objects</li><li><strong>Third-party leaks</strong> — Library-specific issues</li></ul><p>Each pattern receives a confidence score (HIGH/MEDIUM/LOW) that determines automation level.</p><p><strong>3. Automated Fix Application</strong></p><p>For high-confidence patterns, the agent edits files directly:</p><pre>// ❌ BEFORE: Fragment leak pattern<br>class ProfileFragment : Fragment() {<br>    private var binding: ProfileBinding? = null<br>    override fun onDestroyView() {<br>        super.onDestroyView()<br>        // binding not cleared → leak!<br>    }<br>}<br>// ✅ AFTER: AI-applied fix<br>class ProfileFragment : Fragment() {<br>    private var binding: ProfileBinding? = null<br>    override fun onDestroyView() {<br>        super.onDestroyView()<br>        binding = null  // ← AI added this line<br>    }<br>}</pre><p><strong>4. Build-Deploy-Verify Cycle</strong></p><p>The agent automatically:</p><ol><li>Clears previous LeakCanary traces</li><li>Rebuilds the application with Gradle</li><li>Deploys to connected device</li><li>Prompts engineer to reproduce the scenario</li><li>Re-checks for new leaks</li><li>Reports success or identifies remaining issues</li></ol><h3>Under the Hood: How the AI Reads LeakCanary Traces</h3><p>The core challenge is teaching the AI to parse unstructured LeakCanary output. Here’s what a typical trace looks like:</p><pre>┬───<br>│ GC Root: System class<br>├─ android.view.inputmethod.InputMethodManager class<br>│    Leaking: NO (a system class)<br>│    ↓ static InputMethodManager.sInstance<br>├─ android.view.inputmethod.InputMethodManager instance<br>│    Leaking: NO (InputMethodManager is a singleton)<br>│    ↓ InputMethodManager.mNextServedView<br>├─ androidx.appcompat.widget.AppCompatEditText instance<br>│    Leaking: YES (View.mContext references a destroyed activity)<br>│    ↓ AppCompatEditText.mContext<br>╰→ com.grindr.android.ProfileActivity instance<br>     Leaking: YES (Activity#mDestroyed is true)</pre><p>Our AI agent extracts three key signals:</p><ol><li><strong>The leak root</strong>: What object is holding the reference? (InputMethodManager.mNextServedView)</li><li><strong>The leaked object</strong>: What shouldn’t still exist? (ProfileActivity)</li><li><strong>The leak path</strong>: How are they connected? (mContext reference)</li></ol><p>With this structured data, the agent classifies the pattern: “Activity leaked through View reference retained by system singleton”; a HIGH confidence pattern with a known fix (ensure views don’t outlive Activity lifecycle).</p><h3>Common Fix Patterns Applied Automatically</h3><p><strong>Fragment View Binding Leak:</strong></p><pre>override fun onDestroyView() {<br>    super.onDestroyView()<br>    _binding = null  // Added automatically<br>}</pre><p><strong>Activity Context in Singletons:</strong></p><pre>// Before:<br>Fresco.initialize(context, config)<br>// After:<br>Fresco.initialize(context.applicationContext, config)</pre><p><strong>ViewModel Coroutine Cleanup:</strong></p><pre>override fun onCleared() {     super.onCleared()     viewModelScope.cancel()  // Added automatically }</pre><h3>Pattern Classification &amp; Confidence Scoring</h3><p>Not every leak should be fixed autonomously. Our decision framework balances automation speed with safety:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DlyZnavOyWFLJOkFbS_6vg.png" /></figure><p><strong>HIGH confidence</strong> — Standard lifecycle patterns with proven fixes. Applied automatically without approval.</p><p><strong>MEDIUM confidence</strong> — Common patterns but may have architectural implications. Applied with engineer notification.</p><p><strong>LOW confidence</strong> — Unusual patterns, third-party library issues, or fixes requiring &gt;50 lines of code. Requires explicit approval.</p><p>This tiered approach ensures routine leaks resolve instantly while complex cases get expert review.</p><h3>The Impact: Transforming Memory Leak Resolution</h3><p>Since deploying this automation, the workflow transformation has been significant:</p><h3>The Change in Practice</h3><p><strong>Manual debugging</strong> meant each memory leak required:</p><ul><li>Reading and interpreting LeakCanary traces</li><li>Searching through the codebase for relevant files</li><li>Analyzing the leak pattern and determining the fix</li><li>Implementing the solution</li><li>Testing and verification</li><li><strong>Time investment:</strong> Hours per leak</li></ul><p><strong>Automated resolution</strong> now handles:</p><ul><li>Immediate trace extraction and analysis</li><li>Pattern classification with confidence scoring</li><li>Automated fix application for high-confidence patterns</li><li>Build and deployment verification</li><li><strong>Time investment:</strong> Minutes for routine leaks</li></ul><h3>Real Benefits</h3><p><strong>Faster resolution cycles</strong> — What previously took hours of manual debugging now completes in minutes for pattern-based leaks, allowing engineers to maintain focus on feature development.</p><p><strong>Consistent fix quality</strong> — The confidence-based approach ensures standard patterns receive proven solutions, reducing the variability in fix quality that comes with manual implementation.</p><p><strong>Reduced context switching</strong> — Engineers no longer need to drop feature work to spend hours debugging memory leaks. High-confidence patterns resolve automatically with minimal intervention required.</p><h3>Common Patterns Successfully Resolved</h3><p>Based on documented fixes in our codebase, the automation effectively handles these recurring Android memory leak patterns:</p><p><strong>Context Retention in Long-Lived Objects</strong></p><ul><li>Library initialization with Activity context instead of Application context (e.g., Fresco, image loaders)</li><li>Singleton components holding Activity/Fragment references</li><li>Third-party SDKs retaining lifecycle-bound contexts</li></ul><p><strong>Observer and Callback Patterns</strong></p><ul><li>observeForever without proper removal in ViewHolders and Fragments</li><li>Strong callback references in managers and delegates (fixed using WeakReference)</li><li>Permission delegates holding strong references to Activities</li></ul><p><strong>ViewModel and Repository Patterns</strong></p><ul><li>Singletons retaining ViewModel state through function references</li><li>Flow subscriptions managed outside ViewModel scope</li><li>Lambda captures leaking view or context references</li></ul><p><strong>Compose Integration</strong></p><ul><li>AndroidView composables lacking DisposableEffect cleanup</li><li>Native ad views not properly detached from parent ViewGroups</li><li>View references retained after composition exits</li></ul><p><strong>Fragment and Activity Lifecycle</strong></p><ul><li>Direct Fragment references preventing garbage collection (fixed using Provider&lt;Fragment&gt;)</li><li>Dialog references not cleared in onDestroy</li><li>View binding not nullified in onDestroyView</li></ul><h3>How We Use It: Continuous Memory Management</h3><p>The /GrindrFixMemoryLeak command has become a standard part of our development workflow. When LeakCanary detects a leak during feature development or testing, engineers invoke the command and let the AI handle the routine analysis and fixing. For minimal context switching, the command can be run as a background agent in Firebender, allowing engineers to continue working on features while the leak analysis and fixing happens asynchronously.</p><h3>Integration with Development Workflow</h3><p><strong>During Feature Development</strong></p><ul><li>Engineers run debug builds with LeakCanary enabled</li><li>When leaks are detected, invoke /GrindrFixMemoryLeak</li><li>High-confidence patterns resolve automatically</li><li>Engineers review and approve low-confidence cases</li></ul><p><strong>Continuous Refinement Through Documentation</strong></p><ul><li>The more leaks we resolve and document, the more knowledge the command has to reference</li><li>Each documented pattern becomes a reference for future similar leaks</li><li>Our internal documentation of common patterns and solutions directly improves the command’s effectiveness</li><li>The AI agent references this accumulated knowledge to classify and fix new leaks more accurately</li></ul><h3>What Makes It Effective</h3><p>The key to success isn’t just the automation; it’s the structured approach to leak classification and the confidence-based decision framework. By explicitly defining what patterns we trust the AI to fix autonomously versus which require human review, we maintain code quality while eliminating repetitive debugging work.</p><h3>Key Learnings</h3><p>After months of automated memory leak resolution, these principles have proven critical:</p><p><strong>1. Pattern-based leaks are automatable</strong></p><p>Most common Android memory leaks (Activity lifecycle, Fragment binding, ViewModel coroutines) follow predictable patterns with established solutions. These are perfect candidates for AI automation.</p><p><strong>2. Confidence-based automation is critical</strong></p><p>Not all leaks should be fixed autonomously. Complex cases, third-party library issues, and architectural changes require human review. The confidence scoring system prevents the AI from making risky changes.</p><p><strong>3. End-to-end verification is essential</strong></p><p>Automated fixes must be validated through full build and test cycles. Without verification, you’re trading manual debugging for manual rollback of bad fixes.</p><p><strong>4. Structured prompts enable AI effectiveness</strong></p><p>Success comes from encoding your debugging process systematically into the command prompt, not from hoping the AI “figures it out.” Be explicit about steps, decision points, and confidence thresholds.</p><p><strong>5. Time savings compound quickly</strong></p><p>Saving 2–4 hours per leak seems modest until you realize you’re fixing 10+ leaks per month. That’s 20–40 hours monthly; half an engineer’s time recovered for feature development.</p><h3>Beyond Memory Leaks: Expanding AI Agent Usage</h3><p>Memory leak automation demonstrated the value of AI agents for pattern-based development tasks. We’ve since expanded to other repetitive workflows:</p><p><strong>Currently in Production:</strong></p><ul><li><strong>Unit test generation</strong> — Automated Kotest test creation from class signatures</li><li><strong>PR description generation</strong> — Structured pull request documentation based on code changes</li></ul><p><strong>Exploring Next:</strong></p><ul><li><strong>Code review assistance</strong> — Automated validation of architecture patterns and best practices</li><li><strong>Composable optimization analysis</strong> — Identifying unstable composables to prevent unnecessary recompositions</li></ul><p>The pattern is consistent: identify repetitive tasks that follow established rules, encode those rules systematically, and let AI agents handle the routine work while engineers focus on complex problem-solving and feature development.</p><h3>Conclusion</h3><p>The traditional approach to memory leak debugging; manual trace analysis, manual fix implementation, manual verification; is fundamentally inefficient for pattern-based problems.</p><p>By automating the routine parts (trace extraction, pattern classification, fix application, verification) and escalating complex cases for human review (confidence-based decision framework), we significantly improved our leak resolution workflow and reduced the time engineers spend on repetitive debugging tasks.</p><p>The shift required changing how we think about AI tools. Instead of “smart autocomplete,” we built a specialized debugging agent with a structured workflow, clear decision points, and end-to-end automation from detection to verification.</p><p>The result: engineers spend less time debugging memory leaks and more time building features. Our crash-free rate improved. And when LeakCanary does catch a leak, routine patterns now resolve in minutes instead of hours.</p><p>That’s the difference between treating AI as a productivity booster and treating it as a specialized tool for automating entire classes of problems. One makes you type faster. The other eliminates the problem entirely.</p><h3>Resources</h3><p><strong>Tools we used:</strong></p><ul><li><a href="https://firebender.com/">Firebender</a> — AI coding assistant for Android Studio (<a href="https://plugins.jetbrains.com/plugin/25224-firebender">Plugin</a>)</li><li><a href="https://square.github.io/leakcanary/">LeakCanary</a> — Memory leak detection library by Square</li><li>ADB (Android Debug Bridge) — For trace extraction and deployment</li></ul><p>This post was originally published on the Grindr Engineering Blog. To learn more about what our teams are building — or to join us — visit the <a href="https://www.grindr.com/blog">Grindr Blog</a> and our <a href="https://www.grindr.com/careers/jobs">Careers page</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87a64a5a0384" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/how-we-automated-memory-leak-debugging-from-hours-to-minutes-with-ai-87a64a5a0384">How We Automated Memory Leak Debugging from Hours to Minutes with AI</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Message Routing Using Hazelcast]]></title>
            <link>https://medium.com/grindr-engineering/message-routing-using-hazelcast-558abaa91fba?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/558abaa91fba</guid>
            <category><![CDATA[messaging]]></category>
            <category><![CDATA[hazelcast]]></category>
            <dc:creator><![CDATA[Stephen Samuel]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 19:42:49 GMT</pubDate>
            <atom:updated>2025-08-28T19:42:33.692Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ELrtXfhPAq4J9lnd" /></figure><p>One of the biggest projects we’ve undertaken, probably since Grindr was founded, is a complete rebuild of our chat system. For an application like Grindr, a robust chat system is essential as it is core to how our users interact with each other. Every day, millions of chats are sent through Grindr, facilitating connections, conversations, and community-building among our users. Ensuring that these interactions happen seamlessly and reliably is our top priority, which is why we’ve invested significant resources into this overhaul, and I am excited to share more about the updates we have made.</p><p>Like most chat systems, messages are sent and received using websockets. When the app starts up, a websocket session is opened, authenticated, and kept alive while the app is open. Each time a message is sent, the recipient receives their copy of the message over their websocket connection.</p><p>Also like most modern services, our chat platform is deployed into a container based environment. This means we’re running multiple pods for each service. Imagine we have some service that is handling the websockets I just mentioned — call this the “websocket-service.” When the app starts up, and a websocket connection is established, one of the running websocket-service pods is selected to handle that connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bWKZUeb9JMe9Lzp_" /></figure><p>You can see here that there are three websocket-service pods running. Sam’s phone has an open websocket to pod 1, and Jeff’s phone has an open connection to pod 3. Persisting a sent message is trivial — the pod with the connection can perform any message checks, sanitization and logic required — and then send a response back to the sender</p><h3>Message Routing</h3><p>However, one of the challenges becomes how to route messages from the pod that is handling the sent message to the pod that has a connection open for the recipient.</p><p>When user Sam sends a message to user Jeff, the sender’s websocket frame is delivered to the pod that user Sam is connected to (pod1). However the recipient’s websocket frame must originate from pod3, since that’s the pod that Jeff’s phone is connected to. Further complicating matters are the fact that users may have multiple devices operating at the same time (i.e Jeff could have connections to pod3 and pod2 and both need to receive the message), and the fact that these pods are ephemeral and should support rolling deployments.</p><p>A simplistic approach involves putting all outgoing messages onto a single pub/sub channel (e.g. a Kafka topic) and having all pods subscribe to all events, skipping messages for consumers not connected to their pod. But that approach won’t scale horizontally, limiting your message throughput to the maximum number of messages each single pod can handle. Other alternatives we considered include <a href="https://akka.io/">Akka</a> and a <a href="https://redis.io/docs/interact/pubsub/">Redis pub/sub</a> channel per pod.</p><h3>Hazelcast</h3><p>The solution employed at Grindr is to create a <a href="http://hazelcast.com/">Hazelcast</a> <a href="https://docs.hazelcast.org/docs/3.0/manual/html/ch02s04.html">distributed topic</a> per pod as part of the pod’s initialization logic. Each pod consumes only from the single topic created for it, but any pod can publish a message to any topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7ak-VWrrJmlIcr6U" /></figure><p>As you can see in the above diagram, we have three topics and three pods. Each pod subscribes to the topic they own, and in this example, pod2 is broadcasting messages to each of the other two topics. The idea is that when a pod receives an incoming message from a websocket, it publishes to each of the topics that have an open connection for the recipient.</p><p>The next part of the design is determining a way for the pod handling a message to know which topics to broadcast to. In order to ensure that the system scales as we add more users and more messages we need to only publish to the topics that are handling that recipient. As mentioned earlier, we can’t simply broadcast to every pod’s topic otherwise we’d be back to the simplistic approach that would be limited by the throughput of any single pod.</p><p>We solve this by using a Hazelcast <a href="https://docs.hazelcast.com/hazelcast/5.3/data-structures/map">distributed map</a>, which is a shared data structure which any client can add a mapping to.</p><p>When a user connects to a pod, this map is updated with a mapping between the user’s id (unique per user) and the pod-id (generated on pod startup). So now, when a message is received from Sam that is intended to be sent to user Jeff, we look in the map for any pod-id’s associated with Jeff. With this list of Jeff’s pod-ids, we can publish outbound messages to only the topic for each of those pods.</p><p>When a user disconnects (shuts the app down, or the network goes away), the mapping is removed. So this map is a semi-real time association of which users are online.</p><h3>Wrap up</h3><p>What makes Hazelcast very useful here is that it provides both parts of the solution in a single service. We could store the distributed map using a redis cluster for instance, by having the user-id be the key, and the value be a <a href="https://redis.io/docs/data-types/sets/">Redis set</a> of pod-ids. And instead of a distributed topic per pod, we could have a RabbitMQ queue or an S3 queue per pod. But hazelcast brings it all together in a single solution, with a very easy to use Java API.</p><p>This new system is designed to support the massive volume of messages exchanged daily, providing a faster, more reliable, and secure experience for our users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=558abaa91fba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/message-routing-using-hazelcast-558abaa91fba">Message Routing Using Hazelcast</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[@ViewConfigurable — A better way to build SwiftUI components]]></title>
            <link>https://medium.com/grindr-engineering/tl-dr-swiftui-makes-customizing-views-feel-effortless-until-you-build-your-own-reusable-4a3a0cd0e288?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/4a3a0cd0e288</guid>
            <dc:creator><![CDATA[Max Roche]]></dc:creator>
            <pubDate>Tue, 29 Jul 2025 16:12:59 GMT</pubDate>
            <atom:updated>2025-08-11T16:49:10.338Z</atom:updated>
            <content:encoded><![CDATA[<h3>@ViewConfigurable — A better way to build SwiftUI components</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fa3m0ETBX0hX3wMvlz3wew.jpeg" /></figure><p><em>TL;DR: SwiftUI makes customizing views feel effortless — until you build your own reusable components. Here’s how we built a macro to fix that. Try it out with SPM: </em><a href="https://github.com/grindrllc/view-configurable">https://github.com/grindrllc/view-configurable</a></p><p>We’ve all been there before.</p><p>You create a nice simple View for your team to use. Perhaps something like this:</p><pre>public struct GrindrButton: some View {<br>  private let title: String<br>  private let onAction: () -&gt; Void<br><br>  public init(title: String, onAction: @escaping () -&gt; Void) { <br>    self.title = title<br>    self.onAction = onAction<br>  }<br><br>  public var body: some View { ... }<br><br>}</pre><p>Everything is going great and people are adopting this awesome new component 🎉. Then, along come some requests:</p><ul><li>“Can I change the text color of the button?”</li><li>“Can I change the button background color?”</li><li>“Product wants this to have a corner radius of 5, not 8”</li><li>“Hey font needs to be bold. Thx. Have it ready by tomorrow”</li><li>… and on and on</li></ul><p>Now that nice pretty component is starting to look like this</p><pre>public struct GrindrButton: some View {<br>  private let title: String<br>  private let backgroundColor: Color<br>  private let textColor: Color<br>  private let font: Font<br>  private let cornerRadius: CGFloat<br>  private let depressAnimation: Animation = .default<br>  private let onAction: () -&gt; Void<br><br>  public init(title: String, <br>       backgroundColor: Color = .yellow,<br>       textColor: Color = .black,<br>       font: Font = .body,<br>       cornerRadius: CGFloat = 5,<br>       depressAnimation: Animation = .default<br>       // ... more configurations<br>       onAction: @escaping () -&gt; Void) {<br>       self.title = title<br>       self.backgroundColor = backgroundColor<br>       self.textColor = textColor<br>       self.font = font<br>       /// ...etc<br>  }<br><br>  public var body: some View { ... }<br>}</pre><p>Everyone who uses `GrindrButton` now needs to:</p><ol><li>Make sure all initializer params are in order</li><li>Worry about which of these params they actually need</li><li>When they click into this file, it’s a mile long!</li></ol><h3>Native SwiftUI components are super flexible. Why don’t they have this issue?</h3><p>At Grindr, we are building out our components in SwiftUI and this was a constant pain-point. To solve it, we asked ourselves “Why are Apple’s components so much cleaner and easier to use?” For example, Apple does not make you hand in the <em>font, color, size, etc</em> into the initializer. That would look like this:</p><pre>var body: some View {<br>  Text(&quot;Hello World&quot;, foregroundColor: .black, font: .body, style: .italic, ...)<br>}</pre><p>Instead, they took a different approach. At a high level, SwiftUI components have a separation between what is <em>required (data)</em> and what is <em>optional (customization</em>s). Let’s look at a few examples:</p><p><em>Text:</em></p><ul><li><em>Required: </em>String</li><li><em>Customizations</em>: font, color, font-weight, …etc</li></ul><pre>// A string (ie - &quot;Hello&quot;) is required<br>Text(&quot;Hello&quot;) <br>  // Everything below is an optional customization<br>  .font(.body)<br>  .fontWeight(.bold)<br>  .foregroundStyle(.green)</pre><p><em>TextField:</em></p><ul><li><em>Required: </em>String, Binding&lt;String&gt;</li><li><em>Customizations</em>: style, color, …etc</li></ul><pre>// &quot;Hello&quot; and $text are required<br>TextField(&quot;Hello&quot;, text: $text)<br>  // Everything below is an optional customization<br>  .textFieldStyle(.roundedBorder)<br>  .foregroundStyle(Color.blue)<br>  // ...etc</pre><h3>Why can’t we have this?</h3><p>Then we asked ourselves, “why can’t we have this?” Turns out, we can! We just have to write a ton of boilerplate code whenever we want to add another customization. Here is what our initial solution looked like:</p><pre>public struct GrindrButton: View {<br>  private let title: String<br>  private let onAction: () -&gt; Void<br>  // customizations<br>  private var textColor: Color = .blue<br>  private var font: Font = .body<br><br>  public init(title: String, onAction: @escaping () -&gt; Void) {<br>    self.title = title<br>    self.onAction = onAction<br>  }<br>  <br>  var body: some View { // ... }<br>}<br><br>public extension GrindrButton {<br>  func textColor(_ color: Color) -&gt; Self {<br>    var mutableSelf = self<br>    mutableSelf.textColor = color<br>    return mutableSelf<br>  }<br><br>  func titleFont(_ font: Font) -&gt; Self {<br>    var mutableSelf = self<br>    mutableSelf.font = font<br>    return mutableSelf<br>  }<br>}</pre><p>All of a sudden, we had a SwiftUI-like syntax for our custom components! Consumers of our button could write code that looked like this</p><pre>var body: some View {<br>  GrindrButton(title: &quot;Click Me&quot;, onAction: {})<br>    .textColor(.blue)<br>    .titleFont(.callout)<br>}</pre><h3>What’s the catch?</h3><p>Well whenever we wanted to add a customization, we need to add a private variable and create a new extension function with the weird mutableSelf syntax. We wondered — can this be automated?</p><p><em>Macros to the rescue 🦸</em></p><p>We wrote a macro called @ViewConfigurable to automate this. Here is how it works:</p><pre>@ViewConfigurable // Step 1 - apply macro to view<br>public struct GrindrButton: some View {<br>  // required<br>  private let title: String<br>  private let onAction: () -&gt; Void<br><br>  // configurable<br>  private var config = ViewConfiguration() // Step 2 - add this var<br>  public struct ViewConfiguration { // Step 3 - declare your ViewConfiguration struct<br>    var titleColor: Color = .black<br>    var buttonBackgroundColor: Color = .yellow<br>    var titleFont: Font = .body<br>    // ..etc<br>  }<br>  <br>  public init(title: String, onAction: @escaping () -&gt; Void) { ... }<br>  public var body: some View {<br>    // Step 4 - Use the &quot;config&quot; var for customizations<br>    Button(action: onAction) {<br>      Text(title)<br>        .font(config.titleFont)<br>        .foregroundStyle(config.titleColor)<br>    }<br>    .background(config.buttonBackgroundColor)<br>  }<br>}</pre><p>The macro will automatically generate those extension functions based variable names it sees in ViewConfiguration. It follows these simple steps:</p><ol><li>Creates an extension of your view type with the proper scope (public, internal, private)</li><li>Inspects the ViewConfiguration struct</li><li>For each variable in the structure (i.e. var titleColor: Color)</li><li>Creates a function in the extension, using the variable name. For example, var titleColor: Color would create func titleColor(_ value: Color) -&gt; Self</li></ol><p>So, for the component above, a consumer could use it like this:</p><pre>GrindrButton(&quot;Click Me&quot;, onAction: {})<br>  .titleColor(.blue)<br>  .buttonBackgroundColor(.red)<br>  .titleFont(.callout)<br><br>// or they could just stick with the defaults 👇<br>GrindrButton(&quot;Click Me&quot;, onAction: {})</pre><h3>How has it worked so far?</h3><p>It’s a new way of thinking about component building, but it’s been very helpful for us as a team! Having concise views makes it easier to read and reason about. Also, having small initializers makes it far easier to add components to your view — and then you can customize it just like you would any other SwiftUI view.</p><h3>How can I use this?</h3><p>We created a public git repo for this project: <a href="https://github.com/grindrllc/view-configurable">https://github.com/grindrllc/view-configurable</a> . Paste this link into SPM to start using the @ViewConfigurable macro!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a3a0cd0e288" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/tl-dr-swiftui-makes-customizing-views-feel-effortless-until-you-build-your-own-reusable-4a3a0cd0e288">@ViewConfigurable — A better way to build SwiftUI components</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Grindr Uses HOT (Heap only Tuple) Updates]]></title>
            <link>https://medium.com/grindr-engineering/how-grindr-uses-hot-heap-only-tuple-updates-a3a47c6e65e8?source=rss----812be62c41f4---4</link>
            <guid isPermaLink="false">https://medium.com/p/a3a47c6e65e8</guid>
            <dc:creator><![CDATA[Stephen Samuel]]></dc:creator>
            <pubDate>Tue, 30 Apr 2024 15:57:16 GMT</pubDate>
            <atom:updated>2024-04-30T15:46:57.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P0L8DfyL9I4Fq1JF" /></figure><p>With a staggering 13 million monthly active users, Grindr pulsates with a constant stream of chats, images, and even videos between our global user base. As the number of users has grown throughout the years, so has the need to update the tech infrastructure of the app to keep it running while scaling for product updates and releases. In 2021, I spearheaded the <a href="https://medium.com/grindr-engineering/from-java-to-kotlin-migrating-microservices-at-grindr-7956a89f60b8">implementation of our standardized service stack</a> at Grindr, a pivotal move that involved integrating Postgres to fortify our data engineering capabilities. Since we recently completed our full migration to Postgres in 2023 (read about that and other accomplishments <a href="https://medium.com/grindr-engineering/grindr-backend-tech-a-2023-recap-and-glimpse-into-our-2024-roadmap-47fcf8aadea8">here</a>!) I thought it would be insightful to talk a bit more about some of the mechanisms that support making this our database system of choice.</p><p>There are many articles on the internet about how Postgres uses <a href="https://www.postgresql.org/docs/current/mvcc-intro.html">multiversion concurrency control</a> to allow multiple transactions to concurrently access rows (tuples in postgres parlance) without requiring locks. One of the points mentioned as a drawback is how an update results in a new row being written and the old row being marked for deletion. This is often cited as a performance drawback.</p><p>However, that’s not the whole story. While true, there is a technique that can mitigate part (or sometimes most) of the impact. This technique is known as heap-only-tuple (HOT) updates.</p><h3>Page Layout</h3><p>In postgres a table (heap) or an index is stored as an array of <a href="https://www.postgresql.org/docs/current/storage-page-layout.html">pages</a> of a fixed size (8kb by default). Each page contains items — rows in the case of table and index entries in the case of indices.</p><p>In a table page, each row has a page number and an offset in that page. <a href="https://postgresql.org/docs/current/ddl-system-columns.html#DDL-SYSTEM-COLUMNS-CTID">Postgres calls this</a> the ctid. Here is an example of data on disk, with the first column being the ctid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/0*q35qj_5p7ADbLdi_" /></figure><p>It’s always possible to fetch the ctid for a given row by referencing the special column ctid in your query. For example, select ctid, * from peoplewould return the rows in the graphic above.</p><p>An index page consists of entries that map values to a ctid. Therefore, to find rows quickly for a given value, postgres can search the index, find the containing pages and offsets and load only those pages. That’s the basic premise of why indices are fast.</p><p><em>Note that when a row that an index points to is fetched, the entire page is loaded into memory. This is an important point for what follows.</em></p><h3>Regular (Non HOT) Updates</h3><p>Remember that when we update a row, a new row is written. Postgres marks the old row as deleted and adds in the new row. (It keeps track of which row is the current version using an xmax hidden column but that’s out of scope for this blog).</p><p>Consider updating a row by changing the city from Chicago to Austin. The previous row was on page 0, but the new row has been written to page 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/0*nrD-nzAPGHvVASFd" /></figure><p>This is the key part — since the new row has changed, all indices pointing to this row have to also be updated. If we have an index on name, that means postgres has to update that index as well as writing the actual row. If we have a table with many columns and many indices we may suffer from multiple IO operations for a single changed row.</p><h3>HOT Updates</h3><p>Do you recall that we said earlier, that when loading a page that an index points to, we load the entire page into memory? This opens up an interesting idea. If we could write the new row in the same page as the original, and have a pointer from the old row to the new row, then the index wouldn’t need to change if the indexed value did not change either. This is because postgres would be loading both the original row and the new row in the same IO page load operation. Then once in memory, it could simply find the old row and follow the pointer to the new row.</p><p>This is the basic idea behind a Heap-Only-Tuple update — so called because only the heap (table) tuples (rows) are updated, and the indices are left intact. This can massively reduce the amount of IO operations required if non-indexed fields are updated.</p><p>So if we return to the previous example — updating Chicago to Austin — and instead wrote the new row to the same page, we could simply add a pointer to the new offset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/0*OV21wTImw4jgkt4r" /></figure><p>Now the index, which still points to (0, 2) can be left untouched.</p><p><em>Note that if any indexed value changes, then all indexes must be updated, not just the indexes which contain changed values.</em></p><h3>Tuning HOT updates</h3><p>In order for postgres to be able to write updated rows alongside the original rows, there needs to be space in the page. If our page is entirely full then postgres would have no choice but to write to a new page.</p><p>Therefore, we should instruct postgres to leave some space in a page before starting a new page if we are designing a schema to deliberately take advantage of HOT updates. This is called the table <em>fill factor</em>, and can be set at any time (once applied, newly created pages will have this value set).</p><p>We can set the fill factor using the following SQL:</p><pre>ALTER TABLE foo SET (fillfactor = 75);</pre><p>There is of course a trade off. The lower the fill factor the more space will be available for new rows, but the overall size of your table will increase. The right values will vary depending on how frequently you expect your rows to change and how often you want vacuuming to kick in.</p><h3>Examining the Data</h3><p>Postgres provides a way to see tuple states and if HOT updates are being applied by querying the pg_stat_user_tables table.</p><p>Let’s create a table, define an index and add some data:</p><pre>CREATE TABLE characters (<br>id BIGSERIAL PRIMARY KEY,<br>name TEXT NOT NULL,<br>title TEXT NOT NULL<br>);<br><br>CREATE INDEX ON characters(name);<br>INSERT INTO characters (&quot;name&quot;, &quot;title&quot;)<br>VALUES (&#39;Picard&#39;, &#39;Captain&#39;),<br>(&#39;Riker&#39;, &#39;Commander&#39;);</pre><p>Now if we query pg_stat_user_tables` we will see that n_live_tup is set to 2 and n_dead_tup is set to 0.</p><pre>SELECT *<br>FROM pg_stat_user_tables<br>WHERE relname = &#39;characters&#39;;</pre><p>This is as expected because we insert two rows, and have not deleted nor updated any. Now, let’s give Picard a less formal name.</p><pre>UPDATE characters<br>SET name=&#39;Jean Luc&#39;<br>WHERE name = &#39;Picard&#39;;</pre><p>If we now query pg_stat_user_tables again, we will see that n_dead_tup is now 1 (the original row was marked as deleted), n_live_tup is still 2 (because we have two visible rows still), and n_tup_upd is 1 (because we updated 1 row).</p><p>The column n_tup_hot_upd is 0 because this update required us to update the indexed value.</p><p>Now, let’s give Riker a promotion.</p><pre>UPDATE characters<br>SET title=&#39;Captain&#39;<br>WHERE name = &#39;Riker&#39;;</pre><p>Querying pg_stat_user_tables a final time, we will see that n_dead_tup is now 2 (two rows have been marked as deleted), n_live_tup is still 2 (still two visible rows), n_tup_upd is 2 (because we have now updated 2 rows), and finally n_tup_hot_upd is 1 because this update required no index changes.</p><h3>Wrap-Up</h3><p>As a practical example of where we use HOT updates at Grindr, they are used extensively in our next-generation chat-platform. For example, we have a table that contains metadata for each conversation between two profiles. In this table we store sender, recipient, last_timestamp and unread_message_count among other fields.</p><p>Each time a message is sent, the unread_message_count is incremented, and each time a conversation is viewed, it is reset to zero. This is a lot of write activity as conversations are happening constantly. By not indexing last_timestamp and unread_message_count, we never have to update the indexes. Therefore, once a conversation row is created, the indexes are locked in.</p><p>This gives us super fast inserts, whilst still allowing us to query tens of billions of rows to bring back a given user’s inbox.</p><p>Reminder — we are hiring! If you are interested in working with a team of brilliant Data Engineers in our Chicago office, check out our open roles <a href="https://www.grindr.com/careers/jobs">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3a47c6e65e8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/grindr-engineering/how-grindr-uses-hot-heap-only-tuple-updates-a3a47c6e65e8">How Grindr Uses HOT (Heap only Tuple) Updates</a> was originally published in <a href="https://medium.com/grindr-engineering">Grindr Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>