JCU/feat(health-report): port health-report and report-diff scripts#1363
JCU/feat(health-report): port health-report and report-diff scripts#1363Kasinhou wants to merge 3 commits into
Conversation
Port the health-report and report-diff DSpace scripts from the LINDAT/UFAL dtq-dev branch, adapted to DSpace 9.3. Both run via CLI and the Processes UI. - Add ReportResult entity + service/DAO + Spring wiring (core-services.xml, core-dao-services.xml) + hibernate mapping + report_result migration (postgres + h2) - Refactor org.dspace.health checks to emit JSON output; add EmbargoInfoCheck and DateFormatConstants; align to 9.3 APIs (jakarta.*, Instant/LocalDate) - Register health-report and report-diff in scripts.xml (main + test override) - Add zjsonpatch dependency and report-diff-fields.json for report diffing - Drop CLARIN-only LicenseCheck (not present in vanilla DSpace 9.3) - Remove legacy org.dspace.health.Report CLI command (superseded by health-report) - Add HealthReportIT and ReportDiffIT Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adding health-report and report-diff pushes the total script count past the default REST page size (20), so the default page no longer contains every script. Request all scripts explicitly (matching findAllScriptsSortedAlphabeticallyTest) so the containsInAnyOrder assertion sees the full list. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Ports/introduces a new “health-report” script and a “report-diff” script (CLI + Processes UI) for DSpace 9.3, including persistence of report results and updates to the health-check framework to emit JSON for downstream diffing.
Changes:
- Added
ReportResultpersistence layer (entity, DAO/service wiring, Hibernate mapping, Flyway migrations). - Implemented
health-reportandreport-diffscripts/configurations and registered them in Springscripts.xml(main + test override), plus addedzjsonpatch+report-diff-fields.json. - Refactored/extended health checks to produce structured JSON (e.g.,
InfoCheck,ItemCheck,UserCheck) and addedEmbargoInfoCheck+ shared date formatting constants.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| dspace/config/spring/api/scripts.xml | Registers health-report and report-diff scripts for CLI/Processes UI. |
| dspace/config/spring/api/core-services.xml | Wires ReportResultServiceImpl into Spring core services. |
| dspace/config/spring/api/core-dao-services.xml | Wires ReportResultDAOImpl into Spring DAO services. |
| dspace/config/modules/healthcheck.cfg | Updates configured default health checks and adds EmbargoInfoCheck plugin mapping. |
| dspace/config/launcher.xml | Removes legacy healthcheck launcher command (superseded by health-report). |
| dspace/config/hibernate.cfg.xml | Adds Hibernate mapping for the new ReportResult entity. |
| dspace-server-webapp/src/test/java/org/dspace/app/rest/ScriptRestRepositoryIT.java | Adjusts scripts REST test to account for pagination/size. |
| dspace-api/src/test/java/org/dspace/scripts/ReportDiffIT.java | Adds integration tests for report-diff script behavior. |
| dspace-api/src/test/java/org/dspace/scripts/HealthReportIT.java | Adds integration tests for health-report script behavior. |
| dspace-api/src/test/data/dspaceFolder/config/spring/api/scripts.xml | Registers new scripts in test Spring override config. |
| dspace-api/src/main/resources/report-diff-fields.json | Adds configurable field mappings/order for report diff “Key Changes” table. |
| dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V9.3_2026.07.07__Create_table_report_result.sql | Adds Postgres migration for report_result table + sequence. |
| dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/h2/V9.3_2026.07.07__Create_table_report_result.sql | Adds H2 migration for report_result table + sequence. |
| dspace-api/src/main/java/org/dspace/health/UserCheck.java | Refactors User check output to also emit JSON. |
| dspace-api/src/main/java/org/dspace/health/ReportInfo.java | Changes report date range representation to Date/GregorianCalendar. |
| dspace-api/src/main/java/org/dspace/health/Report.java | Removes old legacy CLI healthcheck implementation. |
| dspace-api/src/main/java/org/dspace/health/LogAnalyserCheck.java | Updates log analyser to use the new ReportInfo date types. |
| dspace-api/src/main/java/org/dspace/health/ItemCheck.java | Refactors Item check to emit JSON and restructures counting logic. |
| dspace-api/src/main/java/org/dspace/health/InfoCheck.java | Refactors Info check to emit JSON and standardizes formatting. |
| dspace-api/src/main/java/org/dspace/health/EmbargoInfoCheck.java | Adds new check that reports start/end-dated resource policies. |
| dspace-api/src/main/java/org/dspace/health/DateFormatConstants.java | Adds shared date/time formatter constants. |
| dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java | Improves checksum reporting and bitstream reload for details. |
| dspace-api/src/main/java/org/dspace/health/Check.java | Adds JSON report storage/accessors on checks. |
| dspace-api/src/main/java/org/dspace/content/service/ReportResultService.java | Adds service API for managing persisted report results. |
| dspace-api/src/main/java/org/dspace/content/ReportResultServiceImpl.java | Implements ReportResultService. |
| dspace-api/src/main/java/org/dspace/content/ReportResult.java | Adds the ReportResult JPA entity. |
| dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactoryImpl.java | Exposes ReportResultService via ContentServiceFactory. |
| dspace-api/src/main/java/org/dspace/content/factory/ContentServiceFactory.java | Adds abstract getter for ReportResultService. |
| dspace-api/src/main/java/org/dspace/content/dao/ReportResultDAO.java | Adds DAO interface for ReportResult. |
| dspace-api/src/main/java/org/dspace/content/dao/impl/ReportResultDAOImpl.java | Adds DAO implementation incl. findByLastModified. |
| dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiffScriptConfiguration.java | Adds CLI option wiring for report-diff. |
| dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiff.java | Implements report-diff script (listing, selection/defaulting, diffing, formatting). |
| dspace-api/src/main/java/org/dspace/app/healthreport/HealthReportScriptConfiguration.java | Adds CLI option wiring for health-report. |
| dspace-api/src/main/java/org/dspace/app/healthreport/HealthReport.java | Implements health-report script (runs checks, persists JSON, optional file/email output). |
| dspace-api/pom.xml | Adds zjsonpatch dependency for JSON diffing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…set embargo check state - ReportDiff.loadFieldConfiguration(): use try-with-resources so the classpath InputStream is always closed. - EmbargoInfoCheck: clear its result lists at the start of each run(). Check plugins are held in a static map and reused for the JVM lifetime, so without this the lists would accumulate across runs and double-count on a long-running webapp. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Ports the health-report and report-diff DSpace scripts from the LINDAT/UFAL
dtq-devbranch intocustomer/jcu, adapted to DSpace 9.3. Both run via the CLI (dspace health-report,dspace report-diff) and the Processes UI (Administer → Processes → New Process).This is a backend-only change — no frontend work is required (the scripts surface through the generic Processes UI automatically).
What's included
ReportResultentity + service/DAO, Spring wiring (core-services.xml,core-dao-services.xml), Hibernate mapping, and areport_resulttable migration (postgres + h2).org.dspace.healthchecks to emit JSON; addedEmbargoInfoCheckandDateFormatConstants.HealthReport+ReportDiff(+ theirScriptConfigurations), registered inscripts.xml(main and test override).zjsonpatch(report diffing) andreport-diff-fields.json.HealthReportIT(9) andReportDiffIT(28) — all green locally.Adaptations for DSpace 9.3 (vs. the DSpace 7-based dtq-dev source)
javax.*→jakarta.*(persistence/mail);Date→Instant/LocalDateAPI changes.V9.3_2026.07.07(the originalV7.6_*sorts below appliedV9.0migrations and Flyway would skip it).LicenseCheck("License summary") — the CLARIN license framework doesn't exist in vanilla 9.3.org.dspace.health.ReportCLI command (healthchecklauncher entry), superseded byhealth-report.Verification
HealthReportIT9/9,ReportDiffIT28/28.health-report,report-diff -l/-s/-t) and Processes UI (health-reportno-args /-h/-c,report-diff), plus DB persistence ofreport_result.🤖 Generated with Claude Code