Skip to content

Conversation

@BoySanic
Copy link
Contributor

No description provided.

Copy link
Member

@DutChen18 DutChen18 left a comment

Choose a reason for hiding this comment

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

All the validation routes should be examined for race conditions and extra error conditions.

We should also think about how the validator communicates invalid results. Maybe we require the validator to process results in order of submission (this seems like a good requirement anyways to get a consistent canonical result), and say that all results before submitted before the last valid result are invalid, and all results submitted after are not needed.

@BoySanic BoySanic force-pushed the validation-server branch 3 times, most recently from 2823c25 to a358ee8 Compare May 17, 2025 17:09
@BoySanic BoySanic marked this pull request as ready for review May 17, 2025 17:12
@BoySanic BoySanic force-pushed the validation-server branch from f22bb0d to fcec3cb Compare May 19, 2025 01:00
@BoySanic BoySanic linked an issue May 19, 2025 that may be closed by this pull request
@BoySanic BoySanic removed a link to an issue May 19, 2025
@BoySanic BoySanic force-pushed the validation-server branch 3 times, most recently from bf05d47 to 70ba46b Compare May 23, 2025 17:09
Copy link
Member

@DutChen18 DutChen18 left a comment

Choose a reason for hiding this comment

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

A few more things:

  1. There is still a race condition in validate_submit that will take more than just a transaction to solve.
  2. I've been thinking a bit about how validators would solve the challenge of generating unique numbers for match ids. It's not that hard, they could just pick increasing numbers. But if we ever decide to store the match ids in the database, that will be a breaking change for validators because they now also have to worry about picking match ids that are consistent with those already in the db.
    Maybe there's a better way: What if the match ids are the id of the assignment (or maybe result) with the first submitted result in that group. This gives groups a canonical match id that will always be the same even if recomputed. It also gives a fancy way of querying for "canonical assignments": SELECT * FROM assignments WHERE match_id = id, even in invalid groups.
  3. We need to consider what assignments the validator must resend when a task is run through the validator for a second time. Does it only send assignments that were never sent before? Does it resend all Submitted and Inconclusive assignments? What about if the task is run through the validator again when it already has a canonical result id, does the validator need to resend Valid and Invalid assignments as well? Right now it would, because the match ids are not stored in the database. With my suggestion for generating match ids, it wouldn't, even if the match ids are not stored in the database.

@BoySanic BoySanic force-pushed the validation-server branch from 16d8fba to 91cdc59 Compare August 5, 2025 05:41
Maybe fully implemented?

Implement a few suggestions

Implement fixes

Fix from rebasing, cargo fmt and clippy

Move sqlx dependent stuff into a feature

Refactoring, fixes

Add invalid state

Update names, fix logic in validate_fetch

Fix query

refactor and fix

Renaming

More progress

Endpoints seem to work now

Fix to work with latest master

Add additional error state

Rename errors

Rename error

Implement new error handling

Cargo clippy/fmt

Partial refactor - just for dutchen to work on api stuff

Finish major refactor

Remove old code

Implement dutchen fixes where still applicable

Fix problems post-rebase

Major refactor - again

Commments and small formatting touch-ups

Rename enum states for clarity

Small adjustmnets

Refactor some more...

Re-add bounds check for additional_assignments_needed

Fix bounds check

Update gitignore, move validate_fetch_request to its own request

Remove unneeded error states

Refactor

Fix sqlx prepare after rebase

Fix formatting
@DutChen18
Copy link
Member

There are still some things left to do:

  1. Fix the race condition in validate_submit
  2. Make validate_submit a privileged route, we can optionally defer this until there is a proper permissions system.
  3. Testing.

@DutChen18
Copy link
Member

  1. Update select.rs with new columns

@DutChen18
Copy link
Member

Did 4

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.

3 participants