Skip to content

[ZEPPELIN-6484] Deduplicate IdHashes and add unit tests - #5379

Open
big-cir wants to merge 1 commit into
apache:masterfrom
big-cir:ZEPPELIN-6484
Open

[ZEPPELIN-6484] Deduplicate IdHashes and add unit tests#5379
big-cir wants to merge 1 commit into
apache:masterfrom
big-cir:ZEPPELIN-6484

Conversation

@big-cir

@big-cir big-cir commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What is this PR for?

IdHashes existed twice with identical behaviour — org.apache.zeppelin.util in zeppelin-interpreter and org.apache.zeppelin.notebook.utility in zeppelin-server — and neither copy had any tests.

The ticket left the scope open between "tests only" and "dedupe plus tests". This PR takes the dedupe path: notebook.utility held nothing but that one file, and Note.java was the only thing importing it, so removing it is a file deletion and an import switch. Splitting that into a second ticket would cost more than it saves.

org.apache.zeppelin.util.IdHashes is kept as the canonical copy, matching the module dependency direction — zeppelin-server already depends on zeppelin-interpreter, not the other way round.

The new IdHashesTest pins what generateId() guarantees: the character set (digits 1-9 and A-Z without I, L and O, left out so IDs stay unambiguous when read by a person), non-emptiness, and uniqueness. encode() is private, so all three go through generateId(). The expected character set is spelled out in the test rather than read back from IdHashes, so a change to the dictionary shows up as a failure instead of being silently followed.

Note IDs are unaffected: IdHashes only mints IDs and never parses them, and the two copies produced identical output, so existing notes keep reading their stored IDs as before.

What type of PR is it?

Improvement

Todos

  • - Add IdHashesTest against the canonical org.apache.zeppelin.util.IdHashes
  • - Remove the zeppelin-server notebook.utility copy and switch Note.java to the canonical import
  • - Rebuild the shaded chain and confirm zeppelin-server still builds

What is the Jira issue?

How should this be tested?

New tests:

./mvnw package -pl zeppelin-interpreter --am -Dtest=IdHashesTest -DfailIfNoTests=false

Tests run: 3, Failures: 0, Errors: 0, Skipped: 0

Dedupe, per the ticket's verification note — rebuild the shaded chain, then build zeppelin-server:

./mvnw clean package -pl zeppelin-interpreter,zeppelin-interpreter-shaded --am -DskipTests
./mvnw package -pl zeppelin-server --am -Dtest='NoteTest,InterpreterSettingTest' -DfailIfNoTests=false

Both succeed. NoteTest (8 tests) covers the switched import directly, since the Note constructor is what calls IdHashes.generateId(); InterpreterSettingTest (12 tests) covers the canonical copy's other caller. apache-rat reports no unapproved licenses.

Screenshots (if appropriate)

N/A

Questions:

  • Does the license files need to update? No
  • Is there breaking changes for older versions? No
  • Does this needs documentation? No

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