Skip to content

fix(concerto-vocabulary): look up terms by own property only#1276

Open
apoorva-01 wants to merge 1 commit into
accordproject:mainfrom
apoorva-01:fix/1241-vocabulary-prototype-property-names
Open

fix(concerto-vocabulary): look up terms by own property only#1276
apoorva-01 wants to merge 1 commit into
accordproject:mainfrom
apoorva-01:fix/1241-vocabulary-prototype-property-names

Conversation

@apoorva-01

@apoorva-01 apoorva-01 commented Jun 30, 2026

Copy link
Copy Markdown

Closes #1241

Vocabulary.getTerm and getElementTerms matched a property's term with propertyName in d, which walks the prototype chain. A property named after an Object.prototype member (hasOwnProperty, constructor, toString, valueOf) matched every declaration object and returned a built-in Function instead of the term, or a Function instead of null for an undeclared name.

Changes

  • Both methods now use an own-property check, Object.prototype.hasOwnProperty.call(d, propertyName), so a term comes back only for a property actually declared on the object.
  • Tests in test/vocabulary.js cover constructor/toString/hasOwnProperty resolving to their own terms and undeclared prototype names returning null; they fail on revert. Suite (95), lint and coverage green.

Flags

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

getTerm/getElementTerms matched with `propertyName in d`, which walks the
prototype, so names like hasOwnProperty or constructor returned a built-in
Function. Match own properties via Object.prototype.hasOwnProperty.call.

Signed-off-by: Apoorva Verma <vermaapoorva0510@gmail.com>
@apoorva-01 apoorva-01 force-pushed the fix/1241-vocabulary-prototype-property-names branch from e1db2e3 to 88e3fe4 Compare July 2, 2026 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant