Skip to content

Register command names without inherited object-property collisions - #66

Closed
xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix/prototype-named-commands
Closed

xiehuanyi wants to merge 1 commit into
lukeed:masterfrom
xiehuanyi:fix/prototype-named-commands

Conversation

@xiehuanyi

Copy link
Copy Markdown

Registering a command named constructor, toString, valueOf or hasOwnProperty throws Command already exists before anything with that name has been registered. The command dictionary inherits these names from Object.prototype, and its membership check sees them as commands.

Give the internal command dictionary a null prototype. Add public registration-and-dispatch regressions for those names, and check that registering an actual duplicate still throws.

Validation: all four registration cases fail on unchanged master. npm run build and the complete Tape suite pass, with 602 assertions on Node 14.21.3; git diff --check passes. Windows and the Node 6 minimum were not exercised. This clean-master branch excludes the separate help-rendering change. Generated bundles are excluded from the change.

AI disclosure: OpenAI Codex assisted with investigation, implementation, regression tests, and this description.

AI-assisted implementation and verification using OpenAI Codex.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 18:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lukeed

lukeed commented Oct 10, 2026

Copy link
Copy Markdown
Owner

no one does this

@lukeed lukeed closed this Oct 10, 2026
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.

3 participants