You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "dpol1 (via GitHub)" <gi...@apache.org> on 2026/08/08 09:05:30 UTC
[PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
dpol1 opened a new pull request, #3146:
URL: https://github.com/apache/hugegraph/pull/3146
## Purpose of the PR
- close #3145 (part of the groundwork discussed in #3110)
`LongEncoding` encodes ids and sortable keys, so its exact behavior is a compatibility contract, including the intentional overflow wrapping around `Long.MIN_VALUE` and inputs the decoder accepts but the encoder never produces. Today that contract exists only implicitly in the implementation. This PR pins it in a committed, implementation-independent corpus that any port or refactor can be checked against line by line.
## Main Changes
- `LongEncodingGoldenGenerator` (test scope): produces the corpus by running the current implementation and recording, for each input, the exact output or the exception class. Deterministic: fixed value sets plus a fixed random seed, duplicate lines dropped.
- `longencoding-golden.txt` (test resource): 3940 cases, plain ASCII, tab separated with `\uXXXX` escapes. Covers full-range round trips including `Long.MIN_VALUE`/`MAX_VALUE`, non-canonical decode inputs (`00` decodes to MIN while encode produces `010`), arbitrary UTF-16 decode input including surrogates, the error taxonomy (`IllegalArgumentException` vs `NumberFormatException` vs NPE), and length limits.
- `LongEncodingGoldenTest`: two checks. It replays every corpus line against the implementation, and it regenerates the corpus in memory to assert the committed file matches the generator output exactly, so generator and resource cannot drift apart.
- Both tests registered in `UnitTestSuite` so commons CI executes them.
Review guide: the review surface is the generator (case selection, ~370 lines), the corpus format documented in the file header, and the two-way check mechanics. The corpus file is generated output verified by `testCorpusMatchesGenerator` and does not need line-by-line review.
Contract boundaries: six operations (`encodeSortable`/`decodeSortable`, `encodeB64`/`decodeB64`, `encodeSignedB64`/`decodeSignedB64`). Exact output strings and decoded values are contract; the exception class is contract, the exception message deliberately is not. No production code changes.
## Verifying these changes
- [x] Need tests and can be verified as follows:
- `mvn test -pl hugegraph-commons/hugegraph-common -Dtest=UnitTestSuite -DskipCommonsTests=false` on JDK 11 (the commons CI toolchain): 345 tests, the only errors are 2 environment NPEs in `MachineInfoTest` that reproduce identically on a clean master checkout in the same environment.
- Tamper check: altering one byte of the corpus fails both new tests; regenerating restores green.
- `apache-rat:check`, `checkstyle:check` and `git diff --check` are clean.
## Does this PR potentially affect the following parts?
- [x] Nope
## Documentation Status
- [x] `Doc - No Need` (user docs unaffected; the technical contract is documented in #3145, the corpus file header, and this PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin merged PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5716537914
## [Codecov](https://app.codecov.io/gh/apache/hugegraph/pull/3146?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.25%. Comparing base ([`4f1a8b3`](https://app.codecov.io/gh/apache/hugegraph/commit/4f1a8b34169e021717906167444c75c4c22d426b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c6cf10b`](https://app.codecov.io/gh/apache/hugegraph/commit/c6cf10be65fe89ea05a1f9f950ce7e0322d38688?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 26 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #3146 +/- ##
=============================================
+ Coverage 39.30% 93.25% +53.95%
+ Complexity 264 65 -199
=============================================
Files 771 9 -762
Lines 65915 267 -65648
Branches 8754 22 -8732
=============================================
- Hits 25910 249 -25661
+ Misses 37241 8 -37233
+ Partials 2764 10 -2754
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/hugegraph/pull/3146?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5701471724
@dpol1 Sorry I haven't replied to your proposal directly sooner. We've been focused on getting 1.8.0 released as soon as possible, and we're looking to take the Rust work forward in the 1.9–2.0 timeframe.
As the release work wraps up, we'll discuss the proposal together with the other PMC members and follow up here and in the related issues. A Rust refactor touches quite a few areas, so we do need some additional time to research the options and confirm the scope and compatibility requirements. Thanks for the proposal and the groundwork in this PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "dpol1 (via GitHub)" <gi...@apache.org>.
dpol1 commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5779637764
Thanks for the review, the LF pin, and the formatting pass, @imbajin. I accept ongoing ownership of the testing, compatibility, and fixture work in #3145 and will keep it in small PRs. #3145 describes the next step.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5592119359
Due to the lack of activity, the current pr is marked as stale and will be closed after 180 days, any update will remove the stale label
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "imbajin (via GitHub)" <gi...@apache.org>.
imbajin commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5716470969
Completed six independent review lanes and pushed a small portability fix in c6cf10be65fe89ea05a1f9f950ce7e0322d38688: pin the golden corpus to LF in `.gitattributes`. With `core.autocrlf=true`, checkout previously converted it to CRLF and broke the byte-exact generator comparison; the fixed checkout now matches the committed corpus byte for byte.
Java 11 validation passed: 19 focused tests and all 345 commons `UnitTestSuite` tests, with no failures or skips. The final three-line fix received an independent check. No production code or corpus content changed.
Review score: **9.0/10**. No remaining actionable code findings within the six-operation contract; final-head CI is running, so approval is pending those results.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org
Re: [PR] test(commons): add golden fixture corpus for LongEncoding [hugegraph]
Posted by "dpol1 (via GitHub)" <gi...@apache.org>.
dpol1 commented on PR #3146:
URL: https://github.com/apache/hugegraph/pull/3146#issuecomment-5677441160
@imbajin seeing your interest in my proposal wdyt here?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org