Skip to content

Conversation

Copy link

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 get_package_crash_rate function
  • 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

Added comprehensive test coverage for get_package_crash_rate() function with 6 test cases covering different scenarios:

  • Increase detected: High crash rate compared to previous version (increase=True)
  • No crashes today: New version has no crashes today (increase=False)
  • Few crashes: Only 2 crashes today, below threshold of 3 (increase=False)
  • New package: No old version data exists (increase=True)
  • Low difference: Crash rate similar between versions (increase=False)
  • Proposed excluded: All crashes from proposed repository with exclude_proposed=True (increase=False)

All tests pass successfully and validate the different conditions where the increase key varies between True and False.

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 self-assigned this Nov 28, 2025
Copilot AI and others added 6 commits November 28, 2025 16:43
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…type handling

Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
…ncoding

Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
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.

Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Copy link
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.

Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Copy link
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.

The oopses._insert() function is already doing other counter updates,
and those are the ones that are actually useful. The ones from
daisy.submit look more like legacy than anything else, so let's stop
incrementing them.
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from f0b609b to 6f5ffc6 Compare December 17, 2025 21:59


class TestPrune:
def test_get_package_crash_rate_increase_rate(self, datetime_now, cassandra_data):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@copilot

  • First, start a Cassandra test database from Docker with: docker run --name cassandra --network host --rm -d -e HEAP_NEWSIZE=10M -e MAX_HEAP_SIZE=200M docker.io/cassandra.
  • This file is testing only the get_package_crash_rate() function from the src/errors/cassie.py file.
  • You can add more sample data to the Cassandra database in file src/tests/conftest.py, in the cassandra_data fixture.
  • This is how to run the tests from the src folder: python3 -m pytest ./tests -k cassie. This command must not fail. Tests must keep passing.
  • Have a look at the existing test, and add more to cover additional situations. In particular, the increase key of the output dictionary must vary from True to False in many different cases.

Copy link
Author

Choose a reason for hiding this comment

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

Added 5 new test cases for get_package_crash_rate() covering different scenarios where increase varies between True and False:

  1. No crashes today (increase=False) - new version has no crashes today
  2. Few crashes (increase=False) - only 2 crashes today, below threshold of 3
  3. New package (increase=True) - no old version data exists
  4. Low difference (increase=False) - crash rate similar between versions (difference ≤ 1)
  5. All proposed (increase=False) - all today's crashes from proposed repo with exclude_proposed=True

All 6 tests (original + 5 new) pass successfully. Test data added to cassandra_data fixture in conftest.py. Also removed debug print statements from cassie.py. See commit 537f8ba.

Hyask and others added 7 commits December 19, 2025 12:37
This brings better precision on when crashes actually occur, and eases
a bit the testing of things, because the tests can now create crashes in
the past way more easily.
The goal here is to have the bare minimum working, and throw that at
Copilot to see how it goes.
… increase/no-increase scenarios

Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
@Hyask Hyask force-pushed the copilot/remove-pycassa-from-cassie branch from 537f8ba to 35b4cd2 Compare December 19, 2025 11:53
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