Skip to content

perf: optimize password transformation and reactive bindings#193

Merged
yacosta738 merged 2 commits into
mainfrom
perf/remember-password-transformation-3372935640135281481
Mar 11, 2026
Merged

perf: optimize password transformation and reactive bindings#193
yacosta738 merged 2 commits into
mainfrom
perf/remember-password-transformation-3372935640135281481

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

This PR implements a performance optimization in the Compose Multiplatform UI. By wrapping the PasswordVisualTransformation() instantiation in a remember block, we avoid unnecessary object allocations on every recomposition of the passwordTextField. Since TextFields recompose on every keystroke as the user types, this change reduces GC pressure and improves UI efficiency.

Benchmark results and optimization details have been documented in .agents/journal/bolt-journal.md.


PR created automatically by Jules for task 3372935640135281481 started by @yacosta738

…ield

- Wrap PasswordVisualTransformation instantiation in a remember block
- Avoid redundant object allocations on every keystroke during recomposition
- Update performance journal with optimization details

Co-authored-by: yacosta738 <33158051+yacosta738@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 11, 2026

📝 Walkthrough

Summary by CodeRabbit

  • Performance
    • Optimized password field rendering to improve typing responsiveness and overall UI stability, reducing memory pressure during user interaction.

Walkthrough

Optimizes runtime performance in Compose UI by memoizing PasswordVisualTransformation using a remember block bound to isVisible state in ChatComponents.kt, preventing object re-instantiation on every recomposition and reducing GC pressure during user interaction.

Changes

Cohort / File(s) Summary
Password Transformation Memoization
clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt
Wraps PasswordVisualTransformation() in a remember block tied to isVisible state to prevent reallocation on each recomposition during typing.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested labels

area:kotlin, risk:performance

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commit style with 'perf' prefix and clearly describes the optimization made to password transformation and reactive bindings.
Description check ✅ Passed The description explains the optimization purpose and benefits, though it lacks explicit documentation of testing and doesn't fully complete the template sections.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch perf/remember-password-transformation-3372935640135281481

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 11, 2026

Deploying corvus with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5db1a03
Status: ✅  Deploy successful!
Preview URL: https://199ea282.corvus-42x.pages.dev
Branch Preview URL: https://perf-remember-password-trans.corvus-42x.pages.dev

View logs

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 11, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 89% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3056 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 398 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 91% >= 0%
Repo History Min PRs Previous PRs in this repo 145 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-03-11 to 2026-03-11

@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yacosta738 yacosta738 marked this pull request as ready for review March 11, 2026 08:54
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt (1)

148-148: ⚠️ Potential issue | 🟡 Minor

Add @file:Suppress("FunctionNaming") or suppress the rule on ChatBubble.

The function correctly uses PascalCase per Compose conventions, but Detekt's default FunctionNaming rule doesn't account for @Composable functions. ChatWorkspace.kt in the same package already suppresses this rule. Either suppress at the file level or configure Detekt to exclude Composables.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt`
at line 148, Detekt flags the PascalCase name of the Compose function
ChatBubble; fix by suppressing the FunctionNaming rule—either add
`@file`:Suppress("FunctionNaming") at the top of this Kotlin file or annotate the
ChatBubble declaration with `@Suppress`("FunctionNaming"); you can mirror the
approach used in ChatWorkspace.kt to keep Compose naming conventions and avoid
changing the function name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.agents/journal/bolt-journal.md:
- Around line 9-12: The "Benchmark" section currently lists build-time
compilation numbers (the lines starting with "Baseline Compilation" and
"Post-Optimization Compilation"); update this to show a runtime measurement
relevant to the change (e.g., average recomposition latency, average allocations
per recomposition, or wall-clock UI interaction time before vs after
optimization) or remove the entire "Benchmark" subsection; ensure the section
heading "Benchmark" and the bullets "Baseline Compilation" / "Post-Optimization
Compilation" are replaced with accurate runtime metric names and values that
measure recomposition-time allocations or performance improvements introduced by
the UI optimization.
- Line 1: Replace the second-level heading at the top of the journal entry with
a top-level heading: change the line starting with "## 2025-05-22 - Compose - UI
Runtime Optimization" to use a single leading '#' so the heading becomes "#
2025-05-22 - Compose - UI Runtime Optimization" (this resolves the MD041
markdownlint warning).

---

Outside diff comments:
In
`@clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt`:
- Line 148: Detekt flags the PascalCase name of the Compose function ChatBubble;
fix by suppressing the FunctionNaming rule—either add
`@file`:Suppress("FunctionNaming") at the top of this Kotlin file or annotate the
ChatBubble declaration with `@Suppress`("FunctionNaming"); you can mirror the
approach used in ChatWorkspace.kt to keep Compose naming conventions and avoid
changing the function name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7f860d13-4a51-479b-acd4-29b0f0065dbf

📥 Commits

Reviewing files that changed from the base of the PR and between 2a07165 and 5db1a03.

📒 Files selected for processing (2)
  • .agents/journal/bolt-journal.md
  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: sonar
  • GitHub Check: pr-checks
  • GitHub Check: pr-checks
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (2)
**/*.kt

⚙️ CodeRabbit configuration file

**/*.kt: Enforce null safety (no !!), structured concurrency, and non-blocking suspend code.
Prefer idiomatic Kotlin (expression bodies, sealed types, value classes when justified).
Verify tests follow TDD intent and use backtick test names where applicable.

Files:

  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt
🧠 Learnings (1)
📚 Learning: 2026-02-21T09:07:52.298Z
Learnt from: yacosta738
Repo: dallay/corvus PR: 62
File: .agents/journal/sentinnel-journal.md:1-1
Timestamp: 2026-02-21T09:07:52.298Z
Learning: Branding guideline: The intentional brand name for the security-first agent in the dallay/corvus repository is 'Sentinnel' (with double n). Do not treat it as a typo of 'Sentinel'. Ensure all agent-related docs and journals under .agents/journal consistently use 'Sentinnel' with double n.

Applied to files:

  • .agents/journal/bolt-journal.md
🪛 GitHub Actions: Scan with Detekt
clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt

[warning] 148-148: detekt: Function names should match the pattern: [a-z][a-zA-Z0-9]* [FunctionNaming]. Command: detekt-cli --input "/home/runner/work/corvus/corvus" --report sarif:/home/runner/work/corvus/corvus/detekt.sarif.json

🪛 markdownlint-cli2 (0.21.0)
.agents/journal/bolt-journal.md

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🔇 Additional comments (1)
clients/composeApp/src/commonMain/kotlin/com/profiletailors/corvus/ui/chat/ChatComponents.kt (1)

76-88: Good use of remember around the password transformation.

This keeps the transformation instance stable across keystroke recompositions without changing field behavior.

@@ -0,0 +1,14 @@
## 2025-05-22 - Compose - UI Runtime Optimization
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Use a top-level heading for the new journal entry.

markdownlint is correct here: starting the file with ## trips MD041. Make this an H1.

📝 Proposed fix
-## 2025-05-22 - Compose - UI Runtime Optimization
+# 2025-05-22 - Compose - UI Runtime Optimization
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 2025-05-22 - Compose - UI Runtime Optimization
# 2025-05-22 - Compose - UI Runtime Optimization
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/journal/bolt-journal.md at line 1, Replace the second-level heading
at the top of the journal entry with a top-level heading: change the line
starting with "## 2025-05-22 - Compose - UI Runtime Optimization" to use a
single leading '#' so the heading becomes "# 2025-05-22 - Compose - UI Runtime
Optimization" (this resolves the MD041 markdownlint warning).

Comment on lines +9 to +12
**Benchmark:**
- Baseline Compilation: 58.8s (clean build)
- Post-Optimization Compilation: 73.6s (clean build, with daemon restart overhead)
- *Note:* Compilation time is not directly affected by this change as it's a runtime UI optimization. The primary benefit is at runtime during user interaction.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Replace the build-time numbers with a runtime measurement.

These lines measure clean compilation, but the change only affects recomposition-time allocations. Keeping this under Benchmark does not substantiate the optimization and may mislead reviewers; either add a runtime metric or remove the section.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/journal/bolt-journal.md around lines 9 - 12, The "Benchmark" section
currently lists build-time compilation numbers (the lines starting with
"Baseline Compilation" and "Post-Optimization Compilation"); update this to show
a runtime measurement relevant to the change (e.g., average recomposition
latency, average allocations per recomposition, or wall-clock UI interaction
time before vs after optimization) or remove the entire "Benchmark" subsection;
ensure the section heading "Benchmark" and the bullets "Baseline Compilation" /
"Post-Optimization Compilation" are replaced with accurate runtime metric names
and values that measure recomposition-time allocations or performance
improvements introduced by the UI optimization.

@sonarqubecloud
Copy link
Copy Markdown

@yacosta738 yacosta738 merged commit 88db9e5 into main Mar 11, 2026
19 of 20 checks passed
@yacosta738 yacosta738 deleted the perf/remember-password-transformation-3372935640135281481 branch March 11, 2026 09:20
@yacosta738 yacosta738 mentioned this pull request Mar 16, 2026
This was referenced Apr 19, 2026
This was referenced Apr 29, 2026
@dallay-bot dallay-bot Bot mentioned this pull request May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant