Skip to content

refactor: telemetry, state, and settings handling #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 12, 2025
Merged

Conversation

chaynabors
Copy link
Member

@chaynabors chaynabors commented May 9, 2025

  1. Async Channel Architecture - Replaced global state and mutex locks with a dedicated worker thread and message passing for non-blocking telemetry operations

  2. Dependency Injection - Eliminated global singletons in favor of explicit dependencies for better testability, lifetime, and lifecycle management

  3. Error Handling Improvements - Significantly improved error types and reduced error type sizes dramatically. This reduces the size of Result returned from almost every function in the codebase.

  4. Database type: Greatly simplify local DB interaction and improve consistency across the codebase.


I've tested the fuck out of this but it's not enough. Will bug bash with the team.

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 16.75%. Comparing base (1bf0f12) to head (a25fe55).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1757   +/-   ##
=======================================
  Coverage   16.75%   16.75%           
=======================================
  Files         213      213           
  Lines       20704    20704           
  Branches      871      871           
=======================================
  Hits         3468     3468           
  Misses      17236    17236           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chaynabors chaynabors changed the title chat persistence refactor: telemetry, state, and settings handling May 10, 2025
@chaynabors chaynabors marked this pull request as ready for review May 10, 2025 06:32
@chaynabors chaynabors requested a review from a team May 10, 2025 06:32

#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum OAuthFlow {
DeviceCode,
// This must remain backwards compatible
#[serde(rename = "PKCE")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this what was causing the different auth state while trying to login across the q and qchat binaries?


#[ignore = "not in ci"]
#[tokio::test]
async fn logout_test() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove these tests? Useful for debugging

ALTER TABLE state RENAME TO state_old;
CREATE TABLE state (
key TEXT PRIMARY KEY,
value BLOB
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we making the state table store BLOB's? Is this really required?

some discussion on this - https://sqlite-users.sqlite.narkive.com/sBgPvXrZ/using-text-vs-blob

@chaynabors chaynabors merged commit e1b92fc into main May 12, 2025
16 of 21 checks passed
@chaynabors chaynabors deleted the chat-persistence branch May 12, 2025 17:29
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.

6 participants