Skip to content

Comments

feat: add public member access for Qore objects in V8#213

Merged
davidnich merged 10 commits intodevelopfrom
feature/qore_v8_integration
Feb 13, 2026
Merged

feat: add public member access for Qore objects in V8#213
davidnich merged 10 commits intodevelopfrom
feature/qore_v8_integration

Conversation

@davidnich
Copy link
Member

@davidnich davidnich commented Feb 12, 2026

Summary

  • Add V8 named property interceptors (getter/setter/query/enumerator) to InstanceTemplate of wrapped Qore classes, enabling transparent read/write access to public data members from JavaScript
  • Cache member metadata per class template in QoreV8MemberHandlerData with std::unordered_map for O(1) lookups instead of iterating QoreClassMemberIterator on every access
  • Use kNonMasking flag so prototype methods take precedence over member interceptors
  • Fix latent V8 12+ bug in QoreV8NamespaceWrapper where returning kYes without setting a return value would crash with Check failed: !IsTheHole
  • Add comprehensive tests (10 sub-tests, 29 assertions) covering read/write, private access denial, Object.keys(), in operator, round-trip, nullable members, and JS-only properties
  • Update Doxygen docs and design document with member access examples and architecture

Test plan

  • All 45 test cases pass across 4 test suites
  • Valgrind shows 0 bytes definitely/indirectly lost
  • CI passes on both Ubuntu and Alpine

🤖 Generated with Claude Code

davidnich and others added 6 commits February 12, 2026 18:52
- Check saveQoreReference() failure in wrapExistingObject() to prevent
  premature GC of wrapped objects
- Add missing newline at end of QoreV8Program.cpp
- Support multiple inheritance by recursively adding methods, static
  methods, and constants from additional parent class hierarchies
- Add cache lookup in namespace query() to avoid redundant lookups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set up GitLab CI with Ubuntu and Alpine test jobs that build the v8
module from source and run all Qore tests. Add GitHub webhook mirroring
infrastructure and Copilot auto-review workflow for PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cmake needs NODE_LIB_DIR=/opt/nodejs/lib to find libnode in the
qore-test-base image. Also run tests with --enable-debug for full
test coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use transient references (tRef/tDeref) instead of real references
(realRef/realDeref) for Qore objects held by V8, matching the pattern
used in module-jni and module-python. This avoids strong reference
cycles while keeping C++ memory alive for V8's weak callback cleanup.

Also adds NODE_INCLUDE_DIR for Alpine CI where Node headers are at a
non-standard path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The NamedPropertyHandlerConfiguration callbacks changed from returning
void to v8::Intercepted in V8 12+ (Node.js 22+). Use preprocessor
conditionals on V8_MAJOR_VERSION to support both old and new APIs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add V8 named property interceptors to InstanceTemplate of wrapped Qore
classes, enabling transparent read/write access to public data members
from JavaScript. Member metadata is cached per class template in
QoreV8MemberHandlerData for O(1) lookups. kNonMasking flag ensures
prototype methods are not shadowed by the interceptor.

Also fix a latent V8 12+ bug in QoreV8NamespaceWrapper where returning
kYes without setting a return value would crash.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 12, 2026 21:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds comprehensive support for accessing Qore APIs (namespaces, classes, functions, constants, enums, and public data members) from JavaScript through a global qore object. The implementation uses V8 named property interceptors for transparent, lazy resolution and provides proper memory management with weak references and deterministic cleanup.

Changes:

  • Added V8 namespace and class wrapper infrastructure with property interceptors for transparent access to Qore APIs from JavaScript
  • Implemented member access interceptors with O(1) cached lookups for public data member read/write/enumeration
  • Added comprehensive test suite (999 lines) with 10 sub-tests covering member access, inheritance, callbacks, and edge cases
  • Updated documentation with examples and architecture details

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
test/v8-qore-import.qtest Comprehensive test suite with 22 test cases covering namespace access, class instantiation, methods, member access, and edge cases
test/docker_test/test-ubuntu.sh Docker test script for Ubuntu CI builds
test/docker_test/test-alpine.sh Docker test script for Alpine CI builds
src/QoreV8Program.h Added class template cache, tracking sets for wrapper data, and new public methods for class wrapping
src/QoreV8Program.cpp Injected qore global object, implemented cleanup logic, and added support for wrapping non-JavaScript Qore objects
src/QoreV8NamespaceWrapper.h Header for namespace wrapper with data structures and interceptor declarations
src/QoreV8NamespaceWrapper.cpp Implementation of namespace wrapper with named property interceptors for lazy resolution and caching
src/QoreV8ClassWrapper.h Header for class wrapper with data structures for constructor, methods, and member access
src/QoreV8ClassWrapper.cpp Implementation of class wrapper with FunctionTemplate, inheritance, and member access interceptors
docs/mainpage.dox.tmpl Added comprehensive documentation with examples for namespace traversal, class usage, and member access
design/qore-v8-integration.md Detailed design document explaining architecture, memory management, and implementation details
CMakeLists.txt Added new source files to the build
.gitlab-ci.yml Added GitLab CI configuration for Ubuntu and Alpine test runners
.github/workflows/copilot-review.yml Added GitHub Actions workflow for automated Copilot review requests

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

davidnich and others added 2 commits February 13, 2026 05:28
- realRef/realDeref → tRef/tDeref in design doc (3 occurrences)
- JAVASCRIPT-ERROR → JAVASCRIPT-MEMBER-ACCESS-ERROR in Doxygen docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add assert() checks for v8::External data in all 4 member interceptors,
  matching the existing pattern used in other interceptors
- Fix JAVASCRIPT-ERROR → JAVASCRIPT-MEMBER-ACCESS-ERROR in design doc
  getter flow description

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 13, 2026 05:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

davidnich and others added 2 commits February 13, 2026 07:26
Analyze Jest JSON output to distinguish transient network/timeout
failures from real test failures. Only transient issues (timeouts,
connection errors, rate limits, DNS failures) are tolerated with a
warning; real assertion failures still fail the pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test account may not have any flow executions, causing the
checkAllowedValues assertion to fail. Skip if no flow SID is available
and allow empty results, matching the pattern used by the transcription
test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 13, 2026 06:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davidnich davidnich merged commit 85aae4c into develop Feb 13, 2026
7 of 8 checks passed
@davidnich davidnich deleted the feature/qore_v8_integration branch February 13, 2026 07:00
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