Align TableMode and LogLevel enums between frontend and backend#21
Conversation
… SKIP in JobService, expand EnumAlignmentTest Agent-Logs-Url: https://github.com/MaximumTrainer/OpenDataMask/sessions/d8086b3c-abf3-447b-8c14-a69157dfed83 Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Aligns backend enum definitions with the frontend to prevent enum deserialization/persistence failures (HTTP 400s) when the UI sends newer enum values, and strengthens CI coverage to catch future enum drift.
Changes:
- Added missing enum values on backend:
TableMode.SKIPandLogLevel.DEBUG. - Updated job processing logic to handle
TableMode.SKIPexplicitly. - Strengthened
EnumAlignmentTestto assert exact canonical enum value sets across multiple enums.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| backend/src/main/kotlin/com/opendatamask/model/TableConfiguration.kt | Adds SKIP to TableMode to match frontend values. |
| backend/src/main/kotlin/com/opendatamask/model/JobLog.kt | Adds DEBUG to LogLevel to match frontend values. |
| backend/src/main/kotlin/com/opendatamask/service/JobService.kt | Adds SKIP handling branch when processing a table. |
| backend/src/test/kotlin/com/opendatamask/model/EnumAlignmentTest.kt | Replaces a weak containment assertion with exact-set assertions for several enums. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| addLog(jobId, "Wrote $written rows to destination ${tableConfig.tableName}", LogLevel.INFO) | ||
| } | ||
| TableMode.SKIP -> { | ||
| addLog(jobId, "Skipping table: ${tableConfig.tableName}", LogLevel.INFO) |
There was a problem hiding this comment.
TableMode.SKIP only skips the data-processing step in processTable, but runJob still calls destinationSchemaService.mirrorSchema(...) for every table before processTable runs. As a result, a “skipped” table will still have its schema created/updated in the destination, which contradicts the log message and likely the intent of SKIP. Consider short-circuiting earlier (e.g., in the table loop) so SKIP avoids schema mirroring as well, or adjust the logging/semantics to make it explicit that schema is still mirrored.
| addLog(jobId, "Skipping table: ${tableConfig.tableName}", LogLevel.INFO) | |
| addLog( | |
| jobId, | |
| "Skipping data processing for table: ${tableConfig.tableName} (schema may still be mirrored)", | |
| LogLevel.INFO | |
| ) |
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/MaximumTrainer/OpenDataMask/sessions/a02683db-177a-4aa6-bc70-1d0eac17c259 Co-authored-by: MaximumTrainer <1376575+MaximumTrainer@users.noreply.github.com>
Done in dbb638a. The |
SKIPto backendTableModeenum (TableConfiguration.kt)DEBUGto backendLogLevelenum (JobLog.kt)TableMode.SKIPinJobService.kt— short-circuit the table loop to skip both schema mirroring and data processingEnumAlignmentTest.ktto cover all enum alignmentsEnumAlignmentTesttests pass