Skip to content

Conversation

rohitpaulk
Copy link
Member

@rohitpaulk rohitpaulk commented Oct 17, 2025

Replace manual logstream management in AutofixResult component with a
new logstream-did-update modifier that handles subscription lifecycle
automatically. This simplifies the component by removing explicit setup,
teardown, and state syncing of Logstream instances.

Update the template to use the modifier for logstream updates and track
logstream content reactively. This ensures better separation of concerns
and reduces boilerplate.

Add logstream-did-update modifier that encapsulates subscribing and
unsubscribing to logstreams and invokes a callback on updates.

Overall, these changes improve code clarity, correctness, and maintainability
around logstream update handling.


Note

Extract a logstream-did-update modifier to manage logstream subscriptions and simplify AutofixResult to consume tracked content.

  • UI/AutofixResult:
    • Template (autofix-result.hbs): Replace manual lifecycle modifiers with {{logstream-did-update this.handleLogstreamDidUpdate @autofixRequest.logstreamId}}; render AnsiStream from tracked this.logstreamContent.
    • Component (autofix-result.ts): Remove manual Logstream management (subscribe/unsubscribe and element hooks); add handleLogstreamDidUpdate to set logstreamContent and reload the autofixRequest; drop injected store/actionCableConsumer usage.
  • Modifier:
    • Add app/modifiers/logstream-did-update.ts: encapsulates Logstream subscription lifecycle, cleans up on re-run/destroy, and invokes a callback on updates; registers in Glint registry.
  • Utils:
    • app/utils/logstream.ts: remove early isSubscribed guard in subscribeTask to allow re-subscription after cleanup.

Written by Cursor Bugbot for commit 06a96d1. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

Copy link

github-actions bot commented Oct 17, 2025

Test Results

673 tests  ±0   625 ✅ ±0   9m 19s ⏱️ -1s
  1 suites ±0    48 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 06a96d1. ± Comparison against base commit 63bce65.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Oct 17, 2025

Bundle Report

Changes will decrease total bundle size by 2.41kB (-0.01%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
client-array-push 38.61MB -2.41kB (-0.01%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/chunk.*.js -1.6kB 3.21MB -0.05%
assets/chunk.*.js -731 bytes 382.71kB -0.19%
assets/chunk.*.js -13 bytes 27.05kB -0.05%
assets/chunk.*.js -69 bytes 27.07kB -0.25%

Files in assets/chunk.*.js:

  • ./utils/logstream.ts → Total Size: 3.79kB
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Replace manual logstream management in AutofixResult component with a new `logstream-did-update` modifier that handles subscription lifecycle automatically. This simplifies the component by removing explicit setup, teardown, and state syncing of Logstream instances. Update the template to use the modifier for logstream updates and track logstream content reactively. This ensures better separation of concerns and reduces boilerplate. Add `logstream-did-update` modifier that encapsulates subscribing and unsubscribing to logstreams and invokes a callback on updates. Overall, these changes improve code clarity, correctness, and maintainability around logstream update handling.
Eliminate early return on isSubscribed in subscribeTask to allow resubscription logic to proceed. This change fixes an issue where the subscription could not be re-established once terminated, improving reliability of the log stream handling.
Register a destructor for the modifier to ensure the Logstream is properly unsubscribed when the modifier is destroyed. Replace ad-hoc unsubscribe logic in modify() with a dedicated cleanup function. Use a lambda callback to invoke the provided callback with the current logstream, removing unnecessary stored callback references and improving code clarity.
Remove the unused `action` import from the logstream-did-update modifier to clean up the code and avoid unnecessary dependencies.
Set the logstream property to undefined during cleanup to prevent potential memory leaks or stale references. Also, adjust the callback invocation in modify for clearer structure while keeping the same behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant