Skip to content

Comments

Improvements#25

Open
fronzec wants to merge 13 commits intomainfrom
remove-deprecated
Open

Improvements#25
fronzec wants to merge 13 commits intomainfrom
remove-deprecated

Conversation

@fronzec
Copy link
Owner

@fronzec fronzec commented Feb 11, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where creation timestamps were being incorrectly overwritten during entity processing.
  • Chores

    • Updated container base image to Java 21.
    • Removed unused scheduler and collection dependencies.
    • Added project configuration to standardize formatting, commands, and guidelines.
  • Tests

    • Modernized test suite with JUnit 5/Mockito extension and more robust assertions.
  • Documentation

    • Expanded README and added AGENTS.md with project context, usage, and setup guidance.
  • Refactor

    • Modernized logging and updated date handling to newer Java APIs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Upgrades dev Docker image to Java 21, removes Quartz and Eclipse Collections deps, fixes a row-mapper bug (preserves createdAt), migrates tests to JUnit5+Mockito extension, adds opencode.jsonc and expanded docs, replaces logger in Step3Writer, adds header comments across many source files, and migrates job date handling to LocalDate.

Changes

Cohort / File(s) Summary
Java & Dependencies
fr-batch-service/_devenvironment/Dockerfile, fr-batch-service/pom.xml
Docker base image updated to maven:eclipse-temurin-21; removed Spring Boot Quartz starter and Eclipse Collections dependencies.
Job manager & date API
fr-batch-service/src/main/java/.../JobsManagerService.java
Switched public/internal job-launch methods from Date to LocalDate, use date.toString() for params, avoid mutating default param map, adjusted logging.
Row mapping fix
fr-batch-service/src/main/java/.../EntityPersonV2RowMapper.java
Fixed mapping to set UpdatedAt from updated_at instead of overwriting CreatedAt.
Logging & component
fr-batch-service/src/main/java/.../step3/Step3Writer.java
Replaced java.util.logging with SLF4J private static final logger, used parameterized logs, added @Component.
Tests — JUnit5 & Mockito extension
fr-batch-service/src/test/java/.../JobsManagerServiceTest.java, fr-batch-service/src/test/java/.../ApiClientJavaVersionTest.java
Added @ExtendWith(MockitoExtension.class), removed manual openMocks, replaced Date with LocalDate in tests, relaxed/verifications and adjusted assertions and exception handling; test method signatures now declare throws Exception.
Docs & project config
fr-batch-service/AGENTS.md, fr-batch-service/README.md, fr-batch-service/opencode.jsonc
Expanded AGENTS.md and README with project context, endpoints, run/roadmap info; added opencode.jsonc with coding, testing, and style guidelines.
Header/comment additions
fr-batch-service/src/main/java/.../*
Person.java, Customer.java, CustomerOutput.java, DispatchStatus.java, DispatchedGroupEntityRepository.java, PayloadItemInfo.java, PersonRepository.java, PersonV2Repository.java, BatchItemsPayload.java, DataCalculatedResponse.java, JobInfo.java, etc.
Inserted top-of-file header comment /* 2024-2025 */ into many source files; no behavioral changes.
Minor formatting / EOF
fr-batch-service/_devenvironment/Dockerfile
Added trailing newline at EOF.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 I hopped through code with nimble feet,
Swapped Java skies to twenty-one so sweet,
Mended a mapper, tuned test-time song,
Docs and rules now snug and strong,
A little rabbit cheer — code hops along! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Improvements' is vague and generic, failing to convey the specific nature of changes across multiple significant modifications including Java version upgrade, dependency removal, date type migrations, and documentation updates. Revise the title to be more specific and descriptive of the main changes, such as 'Upgrade Java 17 to 21 and refactor date handling to LocalDate' or 'Java 21 upgrade with dependency cleanup and LocalDate migration'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-deprecated

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/JobsManagerService.java (1)

134-138: ⚠️ Potential issue | 🔴 Critical

Change field types from JobOperator to JobLauncher; JobOperator.run(Job, JobParameters) does not exist in Spring Batch 5.x.

In Spring Batch 5.x (used with Spring Boot 4.0.0), the run(Job, JobParameters) method belongs to JobLauncher, not JobOperator. The JobOperator interface uses start(String jobName, Properties parameters) for launching jobs by name. Your fields named asyncJobLauncher and syncJobLauncher should be typed as JobLauncher, not JobOperator. The current code will not compile.

🤖 Fix all issues with AI agents
In `@fr-batch-service/README.md`:
- Line 97: Change the misspelled word "Sometimetimes" to "Sometimes" in the
README line that currently starts with "Sometimetimes mockintosh venv..." so the
sentence reads "Sometimes mockintosh venv doesn't work correctly by incompatible
version of `markupsafe`, install a compatible version with the". Ensure only the
single-word typo is corrected and preserve the rest of the sentence and
surrounding formatting.

In
`@fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/JobsManagerService.java`:
- Around line 64-71: manualDefinedJobs stores a reference to defaultParams which
is later mutated by launchAllNonAutoDetectedJobs via
defaultJobParams.put("DATE", ...) and put("ATTEMPT_NUMBER", ...) causing
shared-map corruption; fix by cloning the stored or mutated maps so mutations
don't affect the original defaults: when preparing params in
launchAllNonAutoDetectedJobs, create a new map from defaultJobParams (e.g., new
HashMap<>(defaultJobParams)) and then add DATE/ATTEMPT_NUMBER to that copy (or
alternatively store copies into manualDefinedJobs when calling
manualDefinedJobs.put("job1", ...)), ensuring defaultParams remains immutable
across launches.
🧹 Nitpick comments (5)
fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/job1/step3/Step3Writer.java (1)

59-59: Stale TODO from 2022 — consider addressing or tracking.

This TODO has been around since September 2022. If finalizing the job on send failure is still needed, consider creating an issue to track it so it doesn't remain forgotten.

Would you like me to open a GitHub issue to track this TODO?

fr-batch-service/AGENTS.md (1)

59-70: Minor: Spotless plugin version and status may drift.

Line 61 hardcodes specific versions ("version 2.43.0", "version 1.22.0") and states the plugin is "currently temporarily disabled." These details will become stale if pom.xml changes. Consider referencing the pom.xml as the source of truth rather than duplicating version numbers here.

fr-batch-service/README.md (1)

51-61: Consider renaming "Job1" to "Job 1" for readability.

The static analysis tool flagged "Job1" as a potential spelling issue. Using "Job 1" (with a space) reads more naturally in a heading.

📝 Proposed fix
-### Job1 - ETL Pipeline Demo
+### Job 1 - ETL Pipeline Demo
fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/JobsManagerService.java (1)

140-152: Consider extracting repeated exception-handling block.

The identical four-catch pattern (lines 140–152, 182–194, 238–250, 305–317) is duplicated across every launch method. A small helper that accepts a Callable<JobExecution> and returns an error string (or empty) would eliminate this duplication.

fr-batch-service/src/test/java/com/fronzec/frbatchservice/batchjobs/JobsManagerServiceTest.java (1)

70-74: Redundant assertion — containsKey is already covered by assertNotNull(result.get(...)).

Line 73 adds no value after line 71. If get("TestJob") returned non-null, the key necessarily exists.

♻️ Remove redundant assertion
         assertEquals(1, result.size());
         assertNotNull(result.get("TestJob"));
-        // The result contains the job.toString() value which is set by the mock
-        assertTrue(result.containsKey("TestJob"));

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/JobsManagerService.java (1)

166-178: ⚠️ Potential issue | 🟠 Major

runningNumber is nullable Integer — potential NPE at line 178.

launchAllNonAutoDetectedJobs (line 109) uses int (primitive), so it's null-safe. Here, Integer allows null to slip through — runningNumber.toString() at line 178 would throw an NPE. Either:

  • Add Objects.requireNonNull(runningNumber) alongside the existing date null check at line 168, or
  • Change the type to int to match the other method.

Also, this method uses "RUNNING_NUMBER" while launchAllNonAutoDetectedJobs uses "ATTEMPT_NUMBER" for what appears to be the same concept. Consider unifying the parameter key.

🐛 Suggested fix
     public HashMap<String, String> launchAllJobsPreloaded(
-            LocalDate date, final Integer runningNumber) {
+            LocalDate date, final int runningNumber) {
         Objects.requireNonNull(date);

If Integer must be kept (e.g., for deserialization), add:

         Objects.requireNonNull(date);
+        Objects.requireNonNull(runningNumber);
🧹 Nitpick comments (3)
fr-batch-service/src/main/java/com/fronzec/frbatchservice/batchjobs/JobsManagerService.java (3)

63-83: Extract hardcoded job names and parameter keys into named constants.

Lines 67-68 use "paramname" / "paramvalue" and line 70 uses "job1" as raw literals. These strings also appear conceptually tied to repeated keys like "DATE", "ATTEMPT_NUMBER", and "RUNNING_NUMBER" used later in the file. Pulling them into private static final String constants avoids typo-induced bugs and makes the intent self-documenting.

The logging improvements and the TODO for dynamic configuration are a nice touch.

♻️ Suggested constant declarations (add near line 38)
 private static final Logger logger = LoggerFactory.getLogger(JobsManagerService.class);
+
+  private static final String PARAM_DATE = "DATE";
+  private static final String PARAM_ATTEMPT_NUMBER = "ATTEMPT_NUMBER";
+  private static final String PARAM_RUNNING_NUMBER = "RUNNING_NUMBER";
+  private static final String PARAM_DESCRIPTION = "DESCRIPTION";

As per coding guidelines, "Avoid magic numbers and strings; use named constants or enums instead of hardcoded literal values."


85-93: Public methods expose HashMap as return type — prefer Map interface.

The changed method signatures at lines 85, 90, and 166 return HashMap<String, String>. Methods asyncRunJobWithParams and syncRunJobWithParams in the same class already return Map<String, String>. Returning the interface type keeps the API consistent and avoids coupling callers to a concrete implementation.

♻️ Suggested change (apply similarly to other methods)
-    public HashMap<String, String> launchAllNonAutoDetectedJobsAsync(
+    public Map<String, String> launchAllNonAutoDetectedJobsAsync(
             LocalDate date, final int runningNumber) {

36-61: Consider making constructor-injected fields final.

Fields asyncJobLauncher, syncJobLauncher, beanFactory, jobsList, jobRepository, and manualDefinedJobs are assigned once in the constructor and never reassigned. Marking them final enforces immutability and signals intent. This is pre-existing, so deferrable.

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.

1 participant