Repository navigation
fix(value-object): 🐛 Enforce runtime value immutability - #67
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
haskou
force-pushed
the
fix/value-object-runtime-immutability
branch
from
September 6, 2026 20:02
6e1e186 to
518d0ff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JavaScript consumers could overwrite, delete, or redefine a ValueObject's stored value and bypass constructor validation despite its
protected readonlydeclaration. Protectvalueat runtime while keeping the instance extensible so subclasses can initialize their own fields.Remove Enum's redundant parameter property so it uses the inherited protected value. Document the guarantee and the requirement to pass the final primitive to
super(). Treat this as a fix to the existing immutability contract; code that writes or redeclares the protected value after construction will now fail.Validation:
yarn test(567 tests),yarn build,yarn docs:build, and formatting checks pass. Distribution checks exercise both ESM and CommonJS with strict/non-strict writes, deletion, redefinition, subclass initialization, and Enum validation/NullObject behavior. The new overwrite assertion was observed failing against the original compiled package before the fix.