Skip to content

76 irvcomparisonaudit #130

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 12 commits into from
Jun 23, 2024
Merged

76 irvcomparisonaudit #130

merged 12 commits into from
Jun 23, 2024

Conversation

michelleblom
Copy link
Member

There is only a couple of IRVComparisonAudit tests currently that looks at initialisation. More will be added in a later card.

…re necessary, and updated the Assertion tests. Still need extra tests for new Assertion functionality and the functionality in IRVComparisonAudit.
…e-auditing and the fact that the removal/recording methods are designed to be called multiple times for a specific CVRAuditInfo (if the CVR appears multiple times in the sample). Adapted commenting to make this clear.
…ting ballots. Added missed check of excess removal of two vote overstatements from assertion totals.
…s of discrepancies will result in an exception.
…tabase.

Changed name of assumed_context in assertion to assertion_assumed_continuing.

Added some initial tests of IRVComparisonAudit construction.
@michelleblom michelleblom linked an issue Jun 21, 2024 that may be closed by this pull request
Added annotations to BigDecimals in Assertion to have the same precision and scale as those in ComparisonAudit. Updated corla.sql in the test resources with the new database schema.
Copy link
Member

@vteague vteague left a comment

Choose a reason for hiding this comment

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

This is terrific, thanks for thinking so carefully through all the special cases.
I found 2 typos and wrote a couple of questions.

@Override
protected void recalculateSamplesToAudit() {
if(assertions == null){
// We have not associated assertions with this audit yet. When an IRVComparisonAudit
// constructed, we call the base class constructor first. The ComparisonAudit constructor
Copy link
Member

Choose a reason for hiding this comment

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

is constructed

@Override
public int initialSamplesToAudit() {
return 0;
Copy link
Member

Choose a reason for hiding this comment

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

This is indeed never used, and the comment in the base class is pretty brief, but my reading of it is that you're meant to be able to call it at any time, and get the initial sample estimate (when there have been no errors). I don't think this is quite what your method would do if there already were errors - I think it'd return the same thing as getOptimisticSamplesToAudit().

If we didn't override it, we'd just get computeOptimisticSamplesToAudit(0,0,0,0) (i.e. with zero discrepancies everywhere) - it's not clear to me that that's not fine, but it's possible I'm confused.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added method to Assertion class to compute initial samples to audit and then called this in the IRVComparisonAudit method.

// and the flag for indicating that a sample size recalculation is needed, *if* we did
// record a discrepancy against at least one of this audit's assertions.
if(recorded) {
super.removeDiscrepancy(theRecord, theType);
Copy link
Member

Choose a reason for hiding this comment

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

Is this meant to be 'remove'? I think I would have expected it to be 'record', but I could be confused.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

* Test the re-auditing of a ballot where a prior discrepancy is recorded against the
* associated CVR (a two vote overstatement). The existing discrepancies associated with the
* 'n' copies of the CVR in the sample are removed, but removeDiscrepancy() is called n+1 times
* in error. The n+1'th call the removeDiscrepancy should throw an exception.
Copy link
Member

Choose a reason for hiding this comment

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

The n+1'th call to

Copy link
Member

Choose a reason for hiding this comment

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

and 4 times below.

@@ -238,7 +241,7 @@ public void testNENEstimatedVaryingSamples(Integer auditedSamples, BigDecimal ri
* there, the value matching the ID key is retrieved and the associated discrepancy type
* incremented. If it is not there, then the discrepancy counts are not changed.
*/
@Test(expectedExceptions = {RuntimeException.class})
@Test
public void testNENRecordNoMatch1(){
Copy link
Member

Choose a reason for hiding this comment

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

These could be refactored into one big parameterized test.

Copy link
Member

Choose a reason for hiding this comment

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

Same comment for NEBAssertionsTests.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be a bit of a pain to do this, particularly as the expected outcomes/contexts are different enough for each case. However, there was an opportunity for abstracting out some common code across a subset of these record/remove tests (ie. checking of discrepancy counts).

@vteague vteague merged commit a84cd3e into main Jun 23, 2024
1 check passed
@vteague vteague deleted the 76-irvcomparisonaudit branch June 23, 2024 11:13
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.

IRVComparisonAudit
2 participants