Skip to content

fix: isolate node dictionaries from Object.prototype - #265

Open
Aschenbath wants to merge 1 commit into
dagrejs:masterfrom
Aschenbath:fix/oss-20-20261125-77d1-graphlib-prototype-nodes
Open

Aschenbath wants to merge 1 commit into
dagrejs:masterfrom
Aschenbath:fix/oss-20-20261125-77d1-graphlib-prototype-nodes

Conversation

@Aschenbath

Copy link
Copy Markdown
Contributor

Node IDs such as constructor, toString, hasOwnProperty, and __proto__ currently appear to exist before insertion, break graph operations, or are skipped by algorithms. Store node-indexed data in dictionaries without inherited properties, including adjacency and compound relationships, traversal state, priority queues, and shortest-path tables. Tests exercise node removal, serialization, filtering, traversals, components, shortest paths, and spanning trees. Shortest-path results remain string-keyed records and no longer inherit Object.prototype properties.

Validation: 288 Jest tests pass, plus package build, TypeScript checking, and ESLint on Windows / Node 24.22.0. The pre-existing Windows ESM smoke test fails on the unchanged base with ERR_UNSUPPORTED_ESM_URL_SCHEME; only that test was excluded (tracked separately in #258). New failing behavior was reproduced on the unchanged base.

Developed with AI assistance; changes and regression results were reviewed before submission.

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