Skip to content

Commit 1c309e8

Browse files
authored
Merge pull request #29 from Jalen-Stephens/8-service-implement-analyzeservice-core-logic
2 parents d73ae54 + 4494a10 commit 1c309e8

18 files changed

Lines changed: 1178 additions & 284 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ build/
3636
.env
3737
env.local.sh
3838
env.pooler.sh
39+
40+
### Output.json ###
41+
output.json

citations.md

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,4 +1342,125 @@ Assisted in debugging Supabase object deletion behavior, identifying incorrect u
13421342
> Portions of this commit or configuration were generated with assistance from OpenAI ChatGPT (GPT-5) on October 23, 2025. All AI-generated content was reviewed, verified, and finalized by the development team.
13431343
13441344
---
1345-
> Portions of this test suite were generated with assistance from OpenAI ChatGPT (GPT-5) on October 22, 2025. All AI-generated content was reviewed, verified, and finalized by the development team.
1345+
1346+
### **Commit / Ticket Reference**
1347+
1348+
* **Commit:** `feat(service): implement core AnalyzeService pipeline and persistence refs #8`
1349+
* **Ticket:** `#8 — Implement AnalyzeService core logic (pipeline + persistence)`
1350+
* **Date:** October 23, 2025
1351+
* **Team Member:** Jalen Stephens
1352+
1353+
---
1354+
1355+
### **AI Tool Information**
1356+
1357+
* **Tool Used:** OpenAI ChatGPT (GPT-5)
1358+
* **Access Method:** ChatGPT Web (.edu academic access)
1359+
* **Configuration:** Default model settings
1360+
* **Cost:** $0 (no paid API calls)
1361+
1362+
---
1363+
1364+
### **Purpose of AI Assistance**
1365+
1366+
AI was used to design and scaffold the new service-layer architecture for image analysis, including defining DTO contracts, repository/entity structure, and wiring the persistence + storage + C2PA pipeline according to the acceptance criteria. It assisted in identifying missing dependencies, shaping RLS-safe flows, and adapting the code to Spring Boot 3 / Jakarta conventions.
1367+
1368+
---
1369+
1370+
### **Prompts / Interaction Summary**
1371+
1372+
* Asked for analysis service design and persistence flow.
1373+
* Requested DTO refinements to align with controller contracts.
1374+
* Generated `AnalysisReport` entity and repository.
1375+
* Updated `AnalyzeService` to implement PENDING → COMPLETED/FAILED lifecycle.
1376+
* Fixed missing JPA imports and Clock bean wiring for successful application startup.
1377+
* Added error handling (`MissingStoragePathException`) and JSON error persistence.
1378+
1379+
---
1380+
1381+
### **Resulting Artifacts**
1382+
1383+
* `AnalyzeService` (full pipeline logic)
1384+
* `AnalysisReport` JPA entity
1385+
* `AnalysisReportRepository`
1386+
* DTO updates (`AnalyzeStartResponse`, `AnalyzeManifestResponse`, `AnalyzeConfidenceResponse`, etc.)
1387+
* `MissingStoragePathException`
1388+
* Supporting changes to `pom.xml` and application configuration
1389+
1390+
---
1391+
1392+
### **Verification**
1393+
1394+
The implementation was validated through:
1395+
1396+
* Successful project compilation after adding JPA + Clock bean
1397+
* Service-layer unit test updates
1398+
* Manual run ensuring Spring context loads with new beans and dependencies in place
1399+
* Verified DTO compatibility with upcoming controller integration
1400+
1401+
---
1402+
1403+
### **Attribution Statement**
1404+
1405+
> Portions of this commit or configuration were generated with assistance from OpenAI ChatGPT (GPT-5) on October 23, 2025. All AI-generated content was reviewed, verified, and finalized by the development team.
1406+
1407+
---
1408+
1409+
### **Commit / Ticket Reference**
1410+
1411+
* **Commit:** `chore(pmd): enable HTML reporting and add comprehensive AnalyzeService unit tests (refs #8)`
1412+
* **Ticket:** `#8 — Implement AnalyzeService core logic`
1413+
* **Date:** October 23, 2025
1414+
* **Team Member:** Jalen Stephens
1415+
1416+
---
1417+
1418+
### **AI Tool Information**
1419+
1420+
* **Tool Used:** OpenAI ChatGPT (GPT-5)
1421+
* **Access Method:** ChatGPT Web (.edu academic access)
1422+
* **Configuration:** Default model settings
1423+
* **Cost:** $0 (no paid API calls)
1424+
1425+
---
1426+
1427+
### **Purpose of AI Assistance**
1428+
1429+
Assisted with configuring the JaCoCo and PMD reporting outputs, improving test coverage structure for `AnalyzeService`, and advising on best practices for service-level mocking and repository stubbing in unit tests.
1430+
1431+
---
1432+
1433+
### **Prompts / Interaction Summary**
1434+
1435+
* Requested help enabling HTML PMD reporting and linking it into the Maven lifecycle.
1436+
* Asked for fixes to existing PMD violations and updated formatting.
1437+
* Asked for new unit tests and integration test coverage for `AnalyzeService`.
1438+
* Follow-up prompts clarified stubbing behavior and ownership enforcement flow.
1439+
1440+
---
1441+
1442+
### **Resulting Artifacts**
1443+
1444+
* Updated `pom.xml` with PMD HTML report configuration
1445+
* New or updated test classes:
1446+
1447+
* `AnalyzeServiceTest`
1448+
* `AnalyzeServiceC2paIntegrationTest`
1449+
* Minor fixes to `C2paToolInvokerUnitTest`
1450+
* Cleanup of code paths that PMD flagged (unused imports, missing braces, etc.)
1451+
1452+
---
1453+
1454+
### **Verification**
1455+
1456+
* Ran `mvn clean test` to ensure all unit tests pass
1457+
* Confirmed JaCoCo instrumentation runs and PMD passes verification
1458+
* Manual review of generated `/target/pmd.html` output to validate HTML reporting
1459+
1460+
---
1461+
1462+
### **Attribution Statement**
1463+
1464+
> Portions of this commit or configuration were generated with assistance from OpenAI ChatGPT (GPT-5) on October 23, 2025. All AI-generated content was reviewed, verified, and finalized by the development team.
1465+
1466+
---

pom.xml

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
<java.version>17</java.version>
2323
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2424

25-
<!-- C2PA tool download configuration -->
26-
<c2pa.version>v0.23.4</c2pa.version>
27-
<c2pa.unpack.dir>${project.basedir}/tools/c2patool</c2pa.unpack.dir>
28-
<c2pa.unpack.archive>${c2pa.unpack.dir}/c2patool.zip</c2pa.unpack.archive>
25+
<!-- C2PA tool download configuration -->
26+
<c2pa.version>v0.23.4</c2pa.version>
27+
<c2pa.unpack.dir>${project.basedir}/tools/c2patool</c2pa.unpack.dir>
28+
<c2pa.unpack.archive>${c2pa.unpack.dir}/c2patool.zip</c2pa.unpack.archive>
2929
</properties>
3030

3131
<dependencyManagement>
@@ -90,18 +90,18 @@
9090
<exclusion>
9191
<groupId>org.mockito</groupId>
9292
<artifactId>mockito-core</artifactId>
93-
</exclusion>
93+
</exclusion>
9494
</exclusions>
9595
</dependency>
9696

97-
<!-- API tests (optional but nice for iteration 1) -->
97+
<!-- API tests -->
9898
<dependency>
9999
<groupId>io.rest-assured</groupId>
100100
<artifactId>rest-assured</artifactId>
101101
<scope>test</scope>
102102
</dependency>
103103

104-
<!-- Swagger/OpenAPI UI (optional but helpful for README) -->
104+
<!-- Swagger/OpenAPI UI -->
105105
<dependency>
106106
<groupId>org.springdoc</groupId>
107107
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
@@ -115,20 +115,18 @@
115115
<scope>runtime</scope>
116116
</dependency>
117117

118-
<!-- Spring Data (choose one; JDBC is simpler to start) -->
118+
<!-- Spring Data JDBC (you’re also using JPA below; both can coexist) -->
119119
<dependency>
120120
<groupId>org.springframework.boot</groupId>
121121
<artifactId>spring-boot-starter-data-jdbc</artifactId>
122122
</dependency>
123123

124-
<!-- Flyway core (PG17-aware) -->
124+
<!-- Flyway -->
125125
<dependency>
126126
<groupId>org.flywaydb</groupId>
127127
<artifactId>flyway-core</artifactId>
128128
<version>11.14.1</version>
129129
</dependency>
130-
131-
<!-- PostgreSQL database support module -->
132130
<dependency>
133131
<groupId>org.flywaydb</groupId>
134132
<artifactId>flyway-database-postgresql</artifactId>
@@ -146,33 +144,38 @@
146144
<version>4.12.0</version>
147145
<scope>test</scope>
148146
</dependency>
147+
149148
<!-- Metadata Extractor library -->
150149
<dependency>
151-
<groupId>com.drewnoakes</groupId>
152-
<artifactId>metadata-extractor</artifactId>
153-
<version>2.18.0</version>
150+
<groupId>com.drewnoakes</groupId>
151+
<artifactId>metadata-extractor</artifactId>
152+
<version>2.18.0</version>
154153
</dependency>
155-
154+
156155
<dependency>
157-
<groupId>com.fasterxml.jackson.core</groupId>
158-
<artifactId>jackson-databind</artifactId>
159-
<version>2.17.1</version>
156+
<groupId>com.fasterxml.jackson.core</groupId>
157+
<artifactId>jackson-databind</artifactId>
158+
<version>2.17.1</version>
160159
</dependency>
161160

162-
<!-- Mockito core (re-added with specific version) -->
161+
<!-- Mockito (explicit) -->
163162
<dependency>
164-
<groupId>org.mockito</groupId>
163+
<groupId>org.mockito</groupId>
165164
<artifactId>mockito-core</artifactId>
166165
<scope>test</scope>
167166
</dependency>
168-
169167
<dependency>
170-
<groupId>org.mockito</groupId>
171-
<artifactId>mockito-inline</artifactId>
172-
<version>5.2.0</version> <!-- Use the latest version -->
173-
<scope>test</scope>
168+
<groupId>org.mockito</groupId>
169+
<artifactId>mockito-inline</artifactId>
170+
<version>5.2.0</version>
171+
<scope>test</scope>
174172
</dependency>
175173

174+
<!-- Spring Data JPA -->
175+
<dependency>
176+
<groupId>org.springframework.boot</groupId>
177+
<artifactId>spring-boot-starter-data-jpa</artifactId>
178+
</dependency>
176179
</dependencies>
177180

178181
<build>
@@ -183,12 +186,12 @@
183186
<version>1.7.1</version>
184187
</extension>
185188
</extensions>
189+
186190
<finalName>${project.artifactId}-${project.version}</finalName>
187-
<pluginManagement>
188-
189-
191+
192+
<!-- EXECUTABLE plugins -->
190193
<plugins>
191-
<!-- Spring Boot (single declaration) -->
194+
<!-- Spring Boot -->
192195
<plugin>
193196
<groupId>org.springframework.boot</groupId>
194197
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -235,9 +238,28 @@
235238
<configuration>
236239
<printFailingErrors>true</printFailingErrors>
237240
<failOnViolation>true</failOnViolation>
241+
<linkXRef>false</linkXRef>
242+
<targetJdk>17</targetJdk>
238243
</configuration>
239244
<executions>
245+
<!-- Generate an HTML report -->
246+
<execution>
247+
<id>pmd-report-html</id>
248+
<phase>verify</phase>
249+
<goals>
250+
<goal>pmd</goal>
251+
</goals>
252+
<configuration>
253+
<format>html</format>
254+
<outputDirectory>${project.build.directory}/site</outputDirectory>
255+
<!-- optional: include tests too -->
256+
<!-- <includeTests>true</includeTests> -->
257+
</configuration>
258+
</execution>
259+
260+
<!-- Keep the build-breaking check -->
240261
<execution>
262+
<id>pmd-check</id>
241263
<phase>verify</phase>
242264
<goals>
243265
<goal>check</goal>
@@ -246,7 +268,8 @@
246268
</executions>
247269
</plugin>
248270

249-
<!-- JaCoCo -->
271+
272+
<!-- JaCoCo (bind to test + verify so reports are produced) -->
250273
<plugin>
251274
<groupId>org.jacoco</groupId>
252275
<artifactId>jacoco-maven-plugin</artifactId>
@@ -278,6 +301,5 @@
278301
</executions>
279302
</plugin>
280303
</plugins>
281-
</pluginManagement>
282304
</build>
283305
</project>

src/main/java/dev/coms4156/project/metadetect/MetaDetectApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package dev.coms4156.project.metadetect;
22

3+
import java.time.Clock;
34
import org.springframework.boot.SpringApplication;
45
import org.springframework.boot.autoconfigure.SpringBootApplication;
6+
import org.springframework.context.annotation.Bean;
57

68
/**
79
* Entry point for the MetaDetect AI Image Detection Service.
@@ -13,4 +15,9 @@ public class MetaDetectApplication {
1315
public static void main(String[] args) {
1416
SpringApplication.run(MetaDetectApplication.class, args);
1517
}
18+
19+
@Bean
20+
public Clock clock() {
21+
return Clock.systemUTC();
22+
}
1623
}

0 commit comments

Comments
 (0)