Skip to content

fix(value-object): 🐛 Enforce runtime value immutability - #67

Merged
haskou merged 1 commit into
masterfrom
fix/value-object-runtime-immutability
Sep 6, 2026
Merged

haskou merged 1 commit into
masterfrom
fix/value-object-runtime-immutability

Conversation

@haskou

@haskou haskou commented Sep 6, 2026

Copy link
Copy Markdown
Owner

JavaScript consumers could overwrite, delete, or redefine a ValueObject's stored value and bypass constructor validation despite its protected readonly declaration. Protect value at 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.

@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-06T20:00:34.159037Z 6e1e186 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@haskou
haskou force-pushed the fix/value-object-runtime-immutability branch from 6e1e186 to 518d0ff Compare September 6, 2026 20:02
@haskou
haskou merged commit 433b962 into master Sep 6, 2026
3 checks passed
@haskou
haskou deleted the fix/value-object-runtime-immutability branch September 6, 2026 20:06
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