Skip to content

JCU/feat(health-report): port health-report and report-diff scripts#1363

Open
Kasinhou wants to merge 3 commits into
customer/jcufrom
jcu/health-report-report-diff
Open

JCU/feat(health-report): port health-report and report-diff scripts#1363
Kasinhou wants to merge 3 commits into
customer/jcufrom
jcu/health-report-report-diff

Conversation

@Kasinhou

@Kasinhou Kasinhou commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Ports the health-report and report-diff DSpace scripts from the LINDAT/UFAL dtq-dev branch into customer/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

  • Persistence: ReportResult entity + service/DAO, Spring wiring (core-services.xml, core-dao-services.xml), Hibernate mapping, and a report_result table migration (postgres + h2).
  • Health-check framework: refactored org.dspace.health checks to emit JSON; added EmbargoInfoCheck and DateFormatConstants.
  • Scripts: HealthReport + ReportDiff (+ their ScriptConfigurations), registered in scripts.xml (main and test override).
  • Deps/resources: added zjsonpatch (report diffing) and report-diff-fields.json.
  • Tests: HealthReportIT (9) and ReportDiffIT (28) — all green locally.

Adaptations for DSpace 9.3 (vs. the DSpace 7-based dtq-dev source)

  • javax.*jakarta.* (persistence/mail); DateInstant/LocalDate API changes.
  • Migration renumbered to V9.3_2026.07.07 (the original V7.6_* sorts below applied V9.0 migrations and Flyway would skip it).
  • Dropped the CLARIN-only LicenseCheck ("License summary") — the CLARIN license framework doesn't exist in vanilla 9.3.
  • Removed the legacy org.dspace.health.Report CLI command (healthcheck launcher entry), superseded by health-report.

Verification

  • Integration tests: HealthReportIT 9/9, ReportDiffIT 28/28.
  • Verified live in a local DSpace 9.3 Docker stack: CLI (health-report, report-diff -l/-s/-t) and Processes UI (health-report no-args / -h / -c, report-diff), plus DB persistence of report_result.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0845d0f1-5b6b-4a72-8cc9-dcf89b1f32be

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ReportResult persistence layer (entity, DAO/service wiring, Hibernate mapping, Flyway migrations).
  • Implemented health-report and report-diff scripts/configurations and registered them in Spring scripts.xml (main + test override), plus added zjsonpatch + report-diff-fields.json.
  • Refactored/extended health checks to produce structured JSON (e.g., InfoCheck, ItemCheck, UserCheck) and added EmbargoInfoCheck + 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.

Comment thread dspace-api/src/main/java/org/dspace/health/UserCheck.java
Comment thread dspace-api/src/main/java/org/dspace/content/ReportResult.java
Comment thread dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiff.java
Comment thread dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiff.java
Comment thread dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiff.java
Comment thread dspace-api/src/main/java/org/dspace/app/reportdiff/ReportDiff.java Outdated
Comment thread dspace-api/src/main/java/org/dspace/health/EmbargoInfoCheck.java
…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>
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