Skip to content

refactor: Replace Once with now stable OnceLock - #259

Merged
Kriskras99 merged 1 commit into
apache:mainfrom
Kriskras99:refactor/once
Oct 28, 2025
Merged

Kriskras99 merged 1 commit into
apache:mainfrom
Kriskras99:refactor/once

Conversation

@Kriskras99

@Kriskras99 Kriskras99 commented Aug 11, 2025 •

Copy link
Copy Markdown
Contributor

This refactor splits a unit test into two integration tests as it's no longer possible to overwrite SERDE_HUMAN_READABLE after it has been set. By splitting it into two integration tests, they don't share global state and can thus modify it for the test.

I've also removed the unit tests that test that the Serializer/ Deserializer correctly use SERDE_HUMAN_READABLE for their is_human_readable implementation as these structs are not accessible from a integration test. I've kept the half of the tests that test for SERDE_HUMAN_READABLE == true. If this implementation is ever changed it will also affect the integration tests so it's still being tested.

Closes #253

@martin-g

Copy link
Copy Markdown
Member

It will be hard for me to merge/rebase this to #246 :-/
Shall we freeze such refactorings until we are ready with the async-ification (i.e. until we merge mine PR or your PR or neither) ?

@Kriskras99

Copy link
Copy Markdown
Contributor Author

Yeah that's fine. I just noticed it while yakshaving for the state machines implentation. I'll keep the PR open and it can rebase on whatever we plan to merge.

@martin-g martin-g mentioned this pull request Oct 28, 2025
@Kriskras99
Kriskras99 force-pushed the refactor/once branch 3 times, most recently from 81ab833 to 7fbf4dc Compare October 28, 2025 20:17
@Kriskras99

Copy link
Copy Markdown
Contributor Author

@martin-g I've added a commit that changes the default of is_human_readable to false. According to the Serde documentation this is the correct value as Avro is not a human readable format. This will make files more compact and have the serializer do less work depending on the type.

This is a breaking change, but it is easy for a user to go back to the previous default by calling set_human_readable(true) which we can add to the changelog.

@martin-g

Copy link
Copy Markdown
Member

@martin-g I've added a commit that changes the default of is_human_readable to false.

Good!
May I ask you to do it in a separate PR, so we can emphasize it in the changelog ?

This refactor splits a unit test into two integration tests as it's
no longer possible to overwrite `SERDE_HUMAN_READABLE` after it has
been set. By splitting it into two integration tests, they don't
share global state and can thus modify it for the test.

I've also removed the unit tests that test that the `Serializer`/
`Deserializer` correctly use `SERDE_HUMAN_READABLE` for their
`is_human_readable` implementation as these structs are not accessible
from a integration test. I've kept the half of the tests that test
for `SERDE_HUMAN_READABLE == true`. If this implementation is ever
changed it will also affect the integration tests so it's still being
tested.
@Kriskras99
Kriskras99 merged commit 773ea78 into apache:main Oct 28, 2025
@Kriskras99
Kriskras99 deleted the refactor/once branch October 28, 2025 20:39
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.

Unnecessary use of Once?

2 participants