Skip to content

fix(id): address Santanu's review feedback on #109 - #112

Merged
r0goyal merged 9 commits into
id-v2from
id-v2-review-fixes
Aug 17, 2026
Merged

r0goyal merged 9 commits into
id-v2from
id-v2-review-fixes

Conversation

@r0goyal

@r0goyal r0goyal commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Changes

  • Restores IdValidationConstraint.isValid(Id) as the public constraint contract. The generation pipeline converts its internal representation to Id before validation; PartitionValidator converts back to the existing KeyPartitioner input type.
  • Keys IdGeneratorType lookup by formatter implementation class instead of formatter object identity. Fresh built-in formatter instances now resolve correctly without adding an internal lookup method to the public IdFormatter interface.
  • Makes the process-level node ID immutable until reset, while allowing idempotent assignment of the same value. All node-state access uses one synchronization strategy.
  • Resets shared NodeUtils state from both generator cleanup paths to prevent stale node reuse across lifecycles.
  • Documents GenerationResult as an internal implementation detail and marks unused IdGenerationRequest deprecated for removal.
  • Adds the missing Apache 2.0 headers, removes stale @SneakyThrows annotations and an unused import, and documents V1/V2 parser disambiguation.
  • Adds coverage for fresh formatter-instance lookup, node assignment/reset behavior, and asymmetric V2-to-legacy parsing.

Accepted compatibility and design decisions

  • Removal of IdGenerator.initialize(int, List, Map) remains intentional.
  • The changed public shape of GenerationResult is accepted; it remains public only because it is shared across implementation subpackages.
  • The current PartitionValidator/KeyPartitioner conversion is retained.
  • IdGenerator and IdGeneratorV2 keep independent domain and constraint registries.
  • Legacy IDs parse through IdGeneratorV2, while V2-generated IDs are not guaranteed to round-trip through the legacy parser.

Validation

  • mvn -pl ranger-discovery-bundle -am clean test — full reactor passed before the focused follow-up commits.
  • mvn -pl ranger-discovery-bundle -am -DskipTests compile — seven-module reactor passed after each production change.
  • Focused IdGeneratorTypeTest, NodeUtilsTest, IdGeneratorTest, and IdGeneratorV2Test run — 38 tests passed with no failures or errors.

This PR targets id-v2, the source branch feeding #109.

- IdValidationConstraint: restore isValid(Id) as the abstract method
  (binary-compat break flagged in review); isValid(InternalId) is now
  a default bridging via toInternalId()/toId() helpers
- GenerationResult: document as internal-only (not public API contract)
- IdFormatter: add id() so IdGeneratorType.LOOKUP_MAP keys off a stable
  identifier instead of formatter object identity, which only worked
  for the cached IdFormatters singletons
- IdParsersV2: comment DEFAULT_PATTERN's two-step V1/V2 disambiguation
- NodeUtils: add reset(), called from IdGenerator/IdGeneratorV2
  cleanUp() so a stale node id isn't silently reused by a later
  initialize() that forgets to call setNode() again
- add missing Apache license headers on 9 files
- drop stale @SneakyThrows from perf benchmarks, unused import in
  IdParsersV2Test, deprecate unused IdGenerationRequest
- add IdGeneratorV2Test covering the (asymmetric) V2->legacy parse
  interop contract

Refs review comments on #109

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

royrahulop and others added 8 commits July 21, 2026 00:39
Keep V1 and V2 generators on the same process-level node while allowing idempotent startup calls. Reset remains the explicit lifecycle boundary.
Resolve equivalent formatter instances without adding an internal lookup identifier to the public IdFormatter contract.
@sonarqubecloud

Copy link
Copy Markdown

@r0goyal
r0goyal merged commit fe807ce into id-v2 Aug 17, 2026
2 checks passed
@r0goyal
r0goyal deleted the id-v2-review-fixes branch August 17, 2026 09:49
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