Skip to content

Conversation

@barna-isaac
Copy link
Contributor


Pull Request Check List

  • Unit Tests & Regression Tests Added (Optional)
  • Removed Unnecessary Logs/System.Outs/Comments/TODOs
  • Added enough Logging to monitor expected behaviour change
  • Security - Injection - everything run by an interpreter (SQL, OS...) is either validated or escaped
  • Security - Data Exposure - PII is not stored or sent unencrypted
  • Security - Data Exposure - Test any altered or created endpoints using swagger
  • Security - Access Control - Check authorisation on every new endpoint
  • Security - New dependency - configured sensibly not relying on defaults
  • Security - New dependency - Searched for any know vulnerabilities
  • Security - New dependency - Signed up team to mailing list
  • Security - New dependency - Added to dependency list
  • DB schema changes - postgres-rutherford-create-script updated
  • DB schema changes - upgrade script created matching create script
  • Updated Release Procedure & Documentation (& Considered Implications to Previous Versions)
  • Peer-Reviewed

@barna-isaac barna-isaac changed the base branch from main to hackathon/dnd-images November 28, 2025 17:30
@barna-isaac barna-isaac changed the base branch from hackathon/dnd-images to main November 28, 2025 17:36
@barna-isaac barna-isaac marked this pull request as draft November 28, 2025 17:37
@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 94.81481% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.94%. Comparing base (e375ca8) to head (2cbae10).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidator.java 95.95% 2 Missing and 2 partials ⚠️
...cam/cl/dtg/isaac/dto/DndValidationResponseDTO.java 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #738      +/-   ##
==========================================
+ Coverage   36.84%   37.94%   +1.09%     
==========================================
  Files         540      543       +3     
  Lines       23642    23775     +133     
  Branches     2825     2836      +11     
==========================================
+ Hits         8711     9021     +310     
+ Misses      14056    13864     -192     
- Partials      875      890      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

}

void assertError(final String message, final String status) {
assertEquals(Integer.parseInt(status), response.getStatus());

Check notice

Code scanning / CodeQL

Missing catch of NumberFormatException Note test

Potential uncaught 'java.lang.NumberFormatException'.

Copilot Autofix

AI 10 days ago

To fix this problem, we should wrap the call to Integer.parseInt(status) in a try-catch block for NumberFormatException within the assertError(final String message, final String status) method. The catch block should provide meaningful feedback if a bad status string is supplied. In order to not change existing functionality, the recommended approach is to fail the assertion with a clear message indicating that the provided status could not be parsed, optionally including the original exception as the cause. We use the existing JUnit assertion facilities (assertTrue, assertEquals) for this purpose and avoid any changes outside this method.

Suggested changeset 1
src/test/java/uk/ac/cam/cl/dtg/isaac/api/IsaacIntegrationTestWithREST.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/test/java/uk/ac/cam/cl/dtg/isaac/api/IsaacIntegrationTestWithREST.java b/src/test/java/uk/ac/cam/cl/dtg/isaac/api/IsaacIntegrationTestWithREST.java
--- a/src/test/java/uk/ac/cam/cl/dtg/isaac/api/IsaacIntegrationTestWithREST.java
+++ b/src/test/java/uk/ac/cam/cl/dtg/isaac/api/IsaacIntegrationTestWithREST.java
@@ -164,7 +164,11 @@
         }
 
         void assertError(final String message, final String status) {
-            assertEquals(Integer.parseInt(status), response.getStatus());
+            try {
+                assertEquals(Integer.parseInt(status), response.getStatus());
+            } catch (NumberFormatException e) {
+                throw new AssertionError("Provided status \"" + status + "\" is not a valid integer status code.", e);
+            }
             assertTrue(this.readEntityAsJsonUnchecked().getString("errorMessage").contains(message));
         }
 
EOF
@@ -164,7 +164,11 @@
}

void assertError(final String message, final String status) {
assertEquals(Integer.parseInt(status), response.getStatus());
try {
assertEquals(Integer.parseInt(status), response.getStatus());
} catch (NumberFormatException e) {
throw new AssertionError("Provided status \"" + status + "\" is not a valid integer status code.", e);
}
assertTrue(this.readEntityAsJsonUnchecked().getString("errorMessage").contains(message));
}

Copilot is powered by AI and may make mistakes. Always verify output.
.findFirst();
}

private class Rule {

Check notice

Code scanning / CodeQL

Inner class could be static Note

Rule should be made static, since the enclosing instance is not used.

Copilot Autofix

AI 1 day ago

To fix this issue, declare the Rule class as a private static class within BiRuleValidator<T, U>. Since the inner class does not use any instance members of the outer class, and its type parameters <T, U> are available in the enclosing generic class, you can parameterize Rule in the same way (i.e., private static class Rule rather than private class Rule). No other code changes are required, as Rule is only used privately within the methods of BiRuleValidator<T, U>. Add the static modifier to the Rule class declaration on line 301.

All changes are in the shown file and the fix is fully contained within the provided context.


Suggested changeset 1
src/main/java/uk/ac/cam/cl/dtg/isaac/quiz/ValidationUtils.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/main/java/uk/ac/cam/cl/dtg/isaac/quiz/ValidationUtils.java b/src/main/java/uk/ac/cam/cl/dtg/isaac/quiz/ValidationUtils.java
--- a/src/main/java/uk/ac/cam/cl/dtg/isaac/quiz/ValidationUtils.java
+++ b/src/main/java/uk/ac/cam/cl/dtg/isaac/quiz/ValidationUtils.java
@@ -298,7 +298,7 @@
                 .findFirst();
         }
 
-        private class Rule {
+        private static class Rule {
             public final String message;
             public final BiPredicate<T, U> predicate;
 
EOF
@@ -298,7 +298,7 @@
.findFirst();
}

private class Rule {
private static class Rule {
public final String message;
public final BiPredicate<T, U> predicate;

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
private Function<IsaacDndQuestion, String> logMessageOp;
private Consumer<IsaacDndQuestion> questionOp;

public T setTitle(final String title) {

Check notice

Code scanning / CodeQL

Useless parameter Note test

The parameter 'title' is never used.

Copilot Autofix

AI about 19 hours ago

The best fix is to remove the unused parameter title from the method setTitle in the TestCase class. This involves:

  • Modifying the method signature from public T setTitle(final String title) to public T setTitle().
  • Updating any invocations of setTitle that provide an argument, if present in the shown code (none are visible here, so only the method signature needs editing).
  • No other changes are needed since the parameter is never used within the method body, and removing it has no side effects on functionality.

Only the code within the snippet for src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java—specifically, the setTitle method at line 427—needs editing.

Suggested changeset 1
src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java b/src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java
--- a/src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java
+++ b/src/test/java/uk/ac/cam/cl/dtg/isaac/quiz/IsaacDndValidatorTest.java
@@ -424,7 +424,7 @@
         private Function<IsaacDndQuestion, String> logMessageOp;
         private Consumer<IsaacDndQuestion> questionOp;
 
-        public T setTitle(final String title) {
+        public T setTitle() {
             return self();
         }
 
EOF
@@ -424,7 +424,7 @@
private Function<IsaacDndQuestion, String> logMessageOp;
private Consumer<IsaacDndQuestion> questionOp;

public T setTitle(final String title) {
public T setTitle() {
return self();
}

Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
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.

2 participants