Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 28, 2025

  • Add missing model definitions to cassandra_schema.py (BucketVersionsCount, BugToCrashSignatures, SystemImages, UniqueUsers90Days, UserBinaryPackages, ErrorsByRelease)
  • Replace pycassa ColumnFamily calls with cassandra ORM queries in cassie.py
  • Remove pycassa imports and references (pool, NotFoundException, OrderedDict)
  • Add DoesNotExist exception handling to replace NotFoundException
  • Address all code review feedback (move imports to top, simplify sorting, improve type handling)
  • Fix get_as_dict methods to be classmethods with proper cls parameter
  • Fix type handling in get_package_new_buckets for Ascii/Text fields
  • Improve readability in record_bug_for_bucket
  • Fix dictionary-style access to use dot notation for ORM models
  • Create example scripts for all 27 migrated functions
  • Add setup_cassandra() initialization to all example scripts
  • Add comprehensive tests for all cassie.py functions with specific value assertions
  • Verified syntax and security checks pass

Summary

Successfully migrated all 30+ functions in cassie.py from the deprecated pycassa library to the modern cassandra-driver ORM. All pycassa references have been removed and replaced with equivalent ORM queries. Added comprehensive example scripts demonstrating usage of each migrated function, with proper Cassandra connection initialization.

Test Coverage - Complete

Added comprehensive test coverage for all functions in cassie.py. Each function's tests are added in separate commits following the improved pattern with specific value assertions based on actual test data (not just type checks):

Core Functions:

  • get_package_crash_rate - 6 test cases covering different increase/no-increase scenarios
  • bucket_exists - 2 test cases for existing and non-existing buckets
  • get_crashes_for_bucket - 2 test cases for existing and non-existing buckets
  • get_metadata_for_bucket - 2 test cases for existing and non-existing buckets
  • get_metadata_for_buckets - 2 test cases for multiple buckets and empty list
  • get_versions_for_bucket - 2 test cases for existing and non-existing buckets

Bug Tracking:

  • record_bug_for_bucket & get_signatures_for_bug - 2 test cases with mock for staging mode

Crash Data:

  • get_crash - 2 test cases for existing and non-existing crashes
  • get_package_for_bucket - 2 test cases for existing and non-existing buckets
  • get_source_package_for_bucket - 2 test cases with specific assertions
  • get_problem_for_hash - 2 test cases for existing and non-existing hashes

System Information:

  • get_system_image_versions - 2 test cases for existing and non-existing image types

Retrace Information:

  • get_traceback_for_bucket - 2 test cases checking actual traceback values
  • get_stacktrace_for_bucket - 2 test cases validating thread_stacktrace content
  • get_retrace_failure_for_bucket - 2 test cases with failed-retrace test data

User Data:

  • get_user_crashes - 2 test cases for existing user and non-existent user
  • get_binary_packages_for_user - 2 test cases for existing and non-existing users

Statistics:

  • get_package_new_buckets - 2 test cases for new bucket tracking
  • get_oopses_by_day - 2 test cases checking UUID lists and counts
  • get_oopses_by_release - 2 test cases verifying release-specific OOPS
  • get_total_buckets_by_day - 2 test cases verifying date ranges and tuple structure
  • get_bucket_counts - 2 test cases verifying bucket count tuples
  • get_retracer_count - 2 test cases checking retrace statistics dictionaries
  • get_retracer_counts - 1 test case verifying (date, stats) tuple generator
  • get_retracer_means - 1 test case verifying (date, release_arch_dict) tuples
  • get_crash_count - 2 test cases checking (date, count) tuples with and without release filter
  • get_average_crashes - 2 test cases verifying (timestamp, average) tuples
  • get_average_instances - 2 test cases checking (timestamp, average) generator output

All tests pass successfully and validate the ORM migration works correctly. Tests verify actual values, data structures, and counts returned by functions based on test data, not just types.

Original prompt

This section details on the original issue you should resolve

<issue_title>Get rid of pycassa</issue_title>
<issue_description>Context:

  • Have a look at src/errors/cassie.py. It's importing pycassa, which is an old Python module that I want to get rid of.
  • The new API uses an ORM-like mechanism provided by the cassandra module.
  • You can find the cassandra module here: https://github.com/apache/cassandra-python-driver
  • You can find already defined models in src/errortracker/cassandra_schema.py.

Tasks:

  • Add any missing model found in src/errors/cassie.py to src/errortracker/cassandra_schema.py.
  • Replace all the calls to pycassa in src/errors/cassie.py by queries using the models in src/errortracker/cassandra_schema.py.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Remove pycassa and integrate cassandra module Migrate cassie.py from deprecated pycassa to cassandra-driver ORM Nov 28, 2025
Copilot AI requested a review from Hyask November 28, 2025 16:55
@Hyask
Copy link
Collaborator

Hyask commented Nov 28, 2025

@copilot * In a dedicated folder, please generate one tiny Python script per function you modified.

  • Each script should be a minimal example of how to call each function, with arbitrary input data.
  • Do that in a new separate commit.

Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot * In a dedicated folder, please generate one tiny Python script per function you modified.

  • Each script should be a minimal example of how to call each function, with arbitrary input data.
    *...

Created 27 example scripts (one per modified function) in examples/cassie_functions/ directory with a comprehensive README. Each script demonstrates minimal usage with arbitrary input data. See commit c281c5c.

@Hyask
Copy link
Collaborator

Hyask commented Nov 28, 2025

@copilot Please add a call to setup_cassandra() (found in src/errortracker/cassandra.py) at the beginning of each script for easier use.

Copy link
Contributor Author

Copilot AI commented Nov 28, 2025

@copilot Please add a call to setup_cassandra() (found in src/errortracker/cassandra.py) at the beginning of each script for easier use.

Added setup_cassandra() call at the beginning of all 27 example scripts. Each script now imports and calls the function to initialize the Cassandra connection before using any cassie functions. Updated README to document this. See commit 49a4dd0.

@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from f0b609b to 6f5ffc6 Compare December 17, 2025 21:59
Copilot AI requested a review from Hyask December 17, 2025 22:45
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from 537f8ba to 35b4cd2 Compare December 19, 2025 11:53
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch 3 times, most recently from 55a6b07 to 82b799b Compare January 20, 2026 16:49
Hyask and others added 17 commits January 23, 2026 18:15
Writing this commit is what actually enabled the previous one with
all the 'cassie' fixes. Obviously Copilot couldn't catch all of those
mistakes or wrong API usage.
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from 5715a7e to 5ec4495 Compare January 23, 2026 17:15
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from 0e8b731 to 3a84012 Compare January 23, 2026 17:31
@Hyask Hyask marked this pull request as ready for review January 23, 2026 17:37
@Hyask Hyask merged commit 0a2345c into main Jan 26, 2026
8 checks passed
@Hyask
Copy link
Collaborator

Hyask commented Jan 26, 2026

Couple of stats:
23 files changed, 1398 insertions(+), 548 deletions(-)
821 changes are only in the tests folder, meaning 1125 changes to relevant code.

By commit count:
34 copilot-swe-agent[bot]
31 Florent 'Skia' Jacquet
So that's very much a shared work, and Copilot had to be corrected an insane number of time, but that's more or less expected for such work.

@utkarsh2102 utkarsh2102 deleted the copilot/remove-pycassa-from-cassie branch January 31, 2026 16:10
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.

Get rid of pycassa

2 participants