Repository navigation
feat(auth): persist environment credentials and rename drops - #13
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Credential scoping, legacy token restoration, and event-file validation issues remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds event-file and encrypted environment credential persistence, updates event status handling, and renames DNF terminology to Drops.
Changes:
- Persists and restores event files and credentials.
- Updates environment-specific authentication behavior.
- Renames importer, formatter, and model terminology.
- Adds and updates focused tests.
File summaries
| File | Summary |
|---|---|
ost-uploader/TimesJsonFormatter.cs |
Updates status formatting for Drop terminology. |
ost-uploader/TimesImporter.cs |
Renames imported DNF fields to Drop fields. |
ost-uploader/SecureCredentialStore.cs |
Stores encrypted credentials. |
ost-uploader/MainWindow.xaml.cs |
Handles event restoration, credentials, and environment UI. |
ost-uploader/MainWindow.xaml |
Updates the application UI. |
ost-uploader/EventFilePreferenceStore.cs |
Persists the last event file. |
ost-uploader.Tests/TimesJsonFormatterTests.cs |
Tests updated status formatting. |
ost-uploader.Tests/TimesImporterTests.cs |
Tests renamed importer fields. |
ost-uploader.Tests/SecureCredentialStoreTests.cs |
Tests credential persistence. |
ost-uploader.Tests/EventFileLoaderTests.cs |
Tests event-file loading and persistence. |
Review details
Suppressed comments (6)
ost-uploader/MainWindow.xaml.cs:369
baseUrlhere is the full event-group endpoint (for example,https://www.opensplittime.org/api/v1/event_groups/42), andGetCredentialFilePathhashes that entire value. As a result, a production login saved for one event cannot be restored when the user opens a different production event, even though the authentication environment is the same; this conflicts with persisting environment-specific credentials. Use a normalized auth/environment key (such asGetAuthBaseUrl(baseUrl)) consistently for both save and lookup while retaining the full endpoint for API calls.
if (!_credentialStore.TryGetSavedCredentials(baseUrl, out var email, out var password, out var saved))
ost-uploader/MainWindow.xaml.cs:635
- This replaces the previous
TryGetValidTokenrestoration path with a credentials-only lookup. Existing installations have an unexpired token incredentials.binwithout email/password, so that token is now ignored on upgrade and the user is forced to log in again. Preserve a valid token-only fallback or migrate the legacy file when loading saved credentials.
RestoreSavedCredentialsForSite(_apiBaseUrl);
ost-uploader/MainWindow.xaml.cs:606
- This populates the selector with whatever
EventFileLoaderreturns, including a staging-only list: the loader currently treatsopenSplitTime.productionas optional even though the event-file contract requires production and only makes staging optional. That lets an invalid event file enable authentication without a production site. Reject files without production (while allowing optional staging) before adding these UI entries.
var item = new ComboBoxItem { Content = s.Title, Tag = s };
ost-uploader/MainWindow.xaml.cs:344
- This is reset automatically on every environment switch, so logging in to the new site with the box left unchecked reaches the existing global
Clear()path and deletes every hashed credential file, including the other environment's saved login. That defeats the new per-environment persistence; make clearing scoped to the selected environment or distinguish an explicit user opt-out from this automatic reset.
saveToken_CheckBox.IsChecked = false;
RestoreSavedCredentialsForSite(newUrl);
ost-uploader/SecureCredentialStore.cs:164
Clear()now deletes every hashed credential file.MainWindowcalls this when the user logs into one environment with “Save credentials” unchecked, so opting out for production also erases the saved staging credentials (and vice versa), contrary to keeping environments separate. Clear only the credential file for the current site, or provide a scoped clear operation.
var prefix = Path.GetFileNameWithoutExtension(_filePath) + "-";
if (directory != null)
{
foreach (var path in Directory.EnumerateFiles(directory, prefix + "*" + Path.GetExtension(_filePath)))
File.Delete(path);
ost-uploader/TimesImporter.cs:46
- The rename is incomplete for the bundled UltraTracker samples:
ost-uploader/resources/Aid00Times.csv,Aid01Times.csv, andAid05Times.csvstill exposednfType,dnfStationheaders, while the updated tests and model useDropType,DropStation. Update those shipped sample exports as well so users do not continue seeing the old terminology.
DropType = fields[5],
DropStation = fields[6],
- Files reviewed: 10/10 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: rleikis <10184069+rleikis@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Persist event files and environment-specific credentials across sessions while updating DNF terminology to Drops.
Changes
Testing