Skip to content

Migrate Phase 1 already-parameterized tests to @TableSource - #292

Merged
em3s merged 5 commits into
mainfrom
chore/test-migration-phase-1
Apr 28, 2026
Merged

em3s merged 5 commits into
mainfrom
chore/test-migration-phase-1

Conversation

@em3s

@em3s em3s commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase 1 of #271: migrate Kotlin already-parameterized tests from @CsvSource to @TableSource, and keep pipe-row cells as raw String so flow-list cells survive the round trip.

Refs #271

Changes

  • @CsvSource → @TableSource (test counts preserved): ProcessingOrderTest (44×14), SingleTransitionTest (41×32), CombinatoricsTest (45), EdgeIndexMapperTest (4), EdgeCountMapperTest (6); plus annotation-order tidy in EdgeStateMapperTest and a small pilot follow-up in PerCellTTLTest.
  • ObjectSourceExtension.parseRow: pipe cells stay as raw String (only ~ → null). Per-cell YAML parsing previously over-typed flow-list cells like [1, 2]; Jackson coerces at parameter-resolution time anyway. KDoc on TableSource updated; literal ~ string is no longer expressible in pipe form (use flow row).
  • ComplexTransitionTest and ReadOnlyRequestFilterTest keep @MethodSource as the documented escape hatch (runtime cartesian / reflection-scanned endpoints) — no change.

How to Test

./gradlew :core:test --tests '*ProcessingOrderTest'      # 44
./gradlew :core:test --tests '*SingleTransitionTest'     # 41
./gradlew :core:test --tests '*CombinatoricsTest'        # 45
./gradlew :core:test --tests '*EdgeIndexMapperTest'      # 4
./gradlew :core:test --tests '*EdgeCountMapperTest'      # 6
./gradlew :engine:test --tests '*PerCellTTLTest'         # 14 (HBase mini-cluster)
./gradlew :core:test :engine:test                        # full sweep
./gradlew spotlessKotlinCheck

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: Claude Code with Claude Opus 4.7 (1M context)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. maintenance Maintenance work. labels Apr 28, 2026
@em3s em3s changed the title Migrate Phase 1 already-parameterized tests to @TableSource Migrate Phase 1 tests + simplify @TableSource shape Apr 28, 2026
@em3s
em3s force-pushed the chore/test-migration-phase-1 branch from 2bdcd4c to e96f213 Compare April 28, 2026 07:27
@em3s em3s changed the title Migrate Phase 1 tests + simplify @TableSource shape Migrate Phase 1 already-parameterized tests to @TableSource Apr 28, 2026
@em3s
em3s force-pushed the chore/test-migration-phase-1 branch 3 times, most recently from 034f92b to 33e8971 Compare April 28, 2026 07:39
em3s and others added 3 commits April 28, 2026 16:51
Replaces the previous map-with-`columns:`-and-`rows:` shape with a single
canonical form: the annotation value is a YAML list of rows. Cells map to
test method parameters by position via Kotlin reflection, so the redundant
`columns:` declaration is gone too.

Each row item is one of:

- **Flow list** `[a, b, c]` — concise for short tables (existing shape,
  minus the wrapper).
- **Pipe-delimited string** `a | b | c` — recovers the column-by-column
  scannability of the original @CsvSource for wide matrices. Each cell is
  parsed as a YAML scalar (so `~` is null, bare numbers are typed,
  single-quoted strings keep their content). YAML strips `#` comments and
  blank lines naturally.

Example (state-machine style):

    @TableSource("""
        # state machine transitions
        - IDLE    | START | RUNNING
        - RUNNING | STOP  | IDLE
    """)
    fun `transition`(from: State, event: Event, expected: State) { ... }

`parseTableSource` now requires the test method's parameter names; the
extension supplies them from reflection.

Phase 0 callers updated to the new shape:
- engine/.../experiments/hbase/PerCellTTLTest.kt
- server/.../v3/metadata/MetadataStatusTest.kt

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…rce (#271)

Replaces all remaining @CsvSource usages in Kotlin test files with the new
@TableSource shape introduced in #293 (root list, no `columns:` or `rows:`
wrapper, pipe-delimited rows for wide matrices).

- core/codec/EdgeIndexMapperTest.kt — leftover @CsvSource (2 rows)
- core/codec/EdgeCountMapperTest.kt — leftover @CsvSource (1 row)
- core/state/SingleTransitionTest.kt — 41 rows × 32 columns (pipe rows)
- core/state/ProcessingOrderTest.kt — 44 rows × 14 columns (pipe rows)
- test/state/CombinatoricsTest.kt — 8 @CsvSource blocks (flow rows; cells
  are quoted strings parsed by parseAsList)

ComplexTransitionTest.kt and server/filter/ReadOnlyRequestFilterTest.kt
remain on @MethodSource as escape hatches per the issue's guidance: cases
are computed at runtime (cartesian products, reflection-scanned endpoints).

Test bodies and helper calls (toBooleanFlexible, toEventType, toStateValue,
handleSpecialValue, toEventSequence, parseAsList) kept as-is — those
helpers do domain work beyond what Jackson can replace (runtime version
context, special-marker semantics, notation parsing).

Acceptance: `rg "@CsvSource|@valuesource" core engine server` Kotlin
matches drops to 0.

Test counts preserved per file:
- EdgeIndexMapperTest 4 → 4
- EdgeCountMapperTest 6 → 6
- SingleTransitionTest 41 → 41
- ProcessingOrderTest 44 → 44
- CombinatoricsTest 45 → 45

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ource format

Replaces remaining @CsvSource annotations in these test files with the updated @TableSource pipe-delimited row format to align with prior migrations (#271).
@em3s
em3s force-pushed the chore/test-migration-phase-1 branch from 4c4a59f to 15b5570 Compare April 28, 2026 07:53
Two coupled changes:

1. ObjectSourceExtension.parseRow keeps pipe-row cells as raw String
   (only `~` is special-cased to null). Per-cell YAML scalar parsing was
   over-eager: cells like `[1, 2]` parsed to List, then convertValue to
   String target failed. Letting Jackson's resolver handle String →
   target coercion at parameter-resolution time covers all cases (Int,
   Long, Boolean, enum, String) without breaking quoted-list cells.

2. CombinatoricsTest converts from flow rows (quoted-list cells inside
   flow lists) to pipe rows with aligned column headers as comments.
   parseAsList still does the work in test bodies; cells stay String
   end-to-end.

Test counts unchanged: Combinatorics 45/45, SingleTransition 41/41,
ProcessingOrder 44/44, TableSourceTest 12/12, codec tests 4/4 + 6/6.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@em3s
em3s force-pushed the chore/test-migration-phase-1 branch from 15b5570 to 8c14303 Compare April 28, 2026 08:04
Pipe-row cells are now raw String after parser simplification in 8c14303
(no per-cell YAML scalar parsing), so '3' was being kept as the literal
"'3'". The expected param is String?, so a bare 3 round-trips correctly
and matches Bytes.toLong(...).toString() = "3".

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@em3s
em3s merged commit 2a6bdde into main Apr 28, 2026
6 checks passed
@em3s
em3s deleted the chore/test-migration-phase-1 branch April 28, 2026 14:08
@em3s em3s self-assigned this May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Maintenance work. size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant