-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/290776 user aware validation #207
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
Open
paulc1983
wants to merge
19
commits into
main
Choose a base branch
from
feature/290776-user-aware-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5ef8822
initial commit (untested)
paulc1983 630cea5
unit tests fixed and passsing. e2e have failures
paulc1983 2fdc402
updated gitignore
paulc1983 a397d38
fixed home link
paulc1983 a583d82
Added user aware validation
paulc1983 a806a93
added window and urn to dev pipeline. eg http://localhost:8080/dev/qu…
paulc1983 608201a
extended dev pipeline to include pupil params eg http://localhost:808…
paulc1983 4520fa8
added removal reason
paulc1983 5894543
added vs code launch settings
paulc1983 92a2fd2
check in before new spec
paulc1983 c378476
scenarios 1 and 3 working. dev pipeline needs fixing
paulc1983 de47e25
moved moj warning above validation summary
paulc1983 d2b76ce
dev pipeline fix
paulc1983 be12509
added healthcheck for debug hooks
paulc1983 45df3b6
updated docs
paulc1983 0f0f9a7
changed wording to opens in new tab for gds
paulc1983 d22a8a5
removed duplicate tests files
paulc1983 ddaa2be
fix merge conflicts: align interface and viewmodel for ConflictErrorL…
paulc1983 cfea553
fixed warning in markup
paulc1983 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -507,3 +507,8 @@ docs/superpowers/ | |
| CLAUDE.md | ||
| .claude/ | ||
| /.playwright-mcp | ||
| .specify/ | ||
| .clinerules/ | ||
| .opencode/ | ||
| opencode.json | ||
| specs/ | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # VS Code Docker Compose debug override — targets the vscode-debug stage in the | ||
| # Dockerfile so the container includes vsdbg for .NET debugging. Add this to | ||
| # COMPOSE_FILE or reference explicitly when attaching VS Code's debugger. | ||
| # | ||
| # Usage via launch.json (automatic): | ||
| # The "Docker Compose: Debug Web" launch configuration in .vscode/launch.json | ||
| # merges this file automatically when starting the debug session. | ||
| # | ||
| # Usage via CLI (manual): | ||
| # docker compose -f docker-compose.yaml -f docker-compose.vscode.yml up -d web | ||
| services: | ||
| web: | ||
| build: | ||
| target: debug-runtime | ||
| ports: | ||
| - "8080:8080" | ||
| environment: | ||
| - ASPNETCORE_ENVIRONMENT=Development | ||
| - Dev__ToolsEnabled=true | ||
| healthcheck: | ||
| test: ["CMD", "dotnet", "--info"] | ||
| interval: 5s | ||
| timeout: 5s | ||
| retries: 10 | ||
| start_period: 30s |
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
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
10 changes: 10 additions & 0 deletions
10
src/DfE.CheckPerformanceData.Application/RequestSubmission/DuplicateCheckResult.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace DfE.CheckPerformanceData.Application.RequestSubmission; | ||
|
|
||
| public abstract record DuplicateCheckResult | ||
| { | ||
| public sealed record NoConflict : DuplicateCheckResult; | ||
|
|
||
| public sealed record SelfSubmitted(string ReferenceNumber, string ConflictingReasonType, string ConflictingRequestCategory, string ConflictingUserName) : DuplicateCheckResult; | ||
|
|
||
| public sealed record OtherSubmitted(string ReferenceNumber, string ConflictingReasonType, string ConflictingRequestCategory, string ConflictingUserName) : DuplicateCheckResult; | ||
| } |
31 changes: 29 additions & 2 deletions
31
src/DfE.CheckPerformanceData.Application/RequestSubmission/DuplicateRequestException.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,31 @@ | ||
| namespace DfE.CheckPerformanceData.Application.RequestSubmission; | ||
|
|
||
| public sealed class DuplicateRequestException() | ||
| : Exception("A request for this pupil already exists for this checking window."); | ||
| public enum ConflictType { SelfSubmitted, OtherSubmitted } | ||
|
|
||
| public sealed class DuplicateRequestException : Exception | ||
| { | ||
| public ConflictType ConflictType { get; } | ||
| public string ConflictingReasonType { get; } | ||
| public string ConflictingRequestCategory { get; } | ||
| public string ConflictingUserName { get; } | ||
| public bool ReasonsMatch { get; } | ||
|
|
||
| public DuplicateRequestException(ConflictType conflictType) | ||
| : base("A request for this pupil already exists for this checking window.") | ||
| { | ||
| ConflictType = conflictType; | ||
| ConflictingReasonType = string.Empty; | ||
| ConflictingRequestCategory = string.Empty; | ||
| ConflictingUserName = string.Empty; | ||
| } | ||
|
|
||
| public DuplicateRequestException(ConflictType conflictType, string conflictingReasonType, string conflictingRequestCategory, string conflictingUserName, bool reasonsMatch) | ||
| : base("A request for this pupil already exists for this checking window.") | ||
| { | ||
| ConflictType = conflictType; | ||
| ConflictingReasonType = conflictingReasonType; | ||
| ConflictingRequestCategory = conflictingRequestCategory; | ||
| ConflictingUserName = conflictingUserName; | ||
| ReasonsMatch = reasonsMatch; | ||
| } | ||
| } |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The serializable-transaction guard only sits on the fresh-insert path — but by the time we get here we've already returned early on the existingId != Guid.Empty (update) branch above. Bulk submission and any "save draft then submit" flow both reach UpsertAsync with an existing row, so they take ExecuteUpdateAsync and never hit this atomic check. That means the concurrent case the comment describes (two users submitting the same pupil) isn't actually protected for our main submission paths — it falls back to the earlier CheckForConflictAsync pre-check, which is exactly the TOCTOU window this was meant to close. I'd move the conflict check so it covers the update path too.