feat: add custom map iteration naming - #585
Conversation
This comment has been minimized.
This comment has been minimized.
45b16bf to
862cddc
Compare
| var names = new java.util.ArrayList<String>(items.size()); | ||
| for (int i = 0; i < items.size(); i++) { | ||
| if (namer == null) { | ||
| names.add(branchPrefix + i); |
There was a problem hiding this comment.
Style (low): Fully-qualified class name java.util.ArrayList. AGENTS.md marks this as a MUST-follow rule ("ALWAYS use proper imports, NEVER use fully qualified class names in code"), and spotless:apply won't rewrite it. Add import java.util.ArrayList; and use the simple name.
| names.add(branchPrefix + i); | |
| var names = new ArrayList<String>(items.size()); |
Codex AI review[P2] Preserve map item typing in Using Reviewed commit |
|
|
||
| // Convert to List for deterministic index-based access | ||
| var itemList = List.copyOf(items); | ||
| var iterationNames = resolveMapIterationNames(name, itemList, config); |
There was a problem hiding this comment.
Low / maintainability: DurableContextImpl.resolveMapIterationNames is a byte-for-byte duplicate of MapOperation.resolveIterationNames (branch-prefix construction, null-namer default naming, and ParameterValidator.validateOperationName invocation). Because mapAsync always resolves names here and passes them to the 7-arg MapOperation constructor, the copy inside the legacy 6-arg constructor is only reachable via that retained-for-compatibility constructor — yet both must stay in lock-step. Any future change to naming or validation (e.g. length limits, null handling) applied to one copy but not the other would silently diverge the two construction paths.
Fix: extract a single shared helper (e.g. a package-visible static method on MapOperation) and call it from both mapAsync (before nextOperationId(), preserving the "validate before allocating the operation ID" ordering) and the 6-arg constructor, deleting one of the copies.
Claude AI reviewSummaryThis PR adds
FindingsLow — maintainability (duplicated name-resolution logic) — Residual test risk
Reviewed commit |
Summary
MapConfig.itemNamerfor custom nested map-iteration namesnullnamer result as an unnamed iterationitemNamerwithNestingType.FLAT, whose virtual iterations have no context operation to nameCompatibility
MapConfigremains non-genericDurableContextmethod signatures are unchangedValidation
mvn -pl sdk test— 1102 passedmvn -pl sdk-integration-tests test— 391 passedmvn -pl conformance-tests package -DskipTests— passedKnown baseline issue
Project-wide
mvn spotless:checkreports six pre-existing formatting violations underconformance-tests/src/main/java/plugin/. Those unrelated files are intentionally excluded from this PR.Closes #528