Skip to content

fix: Make Wazero the lens runtime for C bindings#4524

Merged
ChrisBQu merged 2 commits intosourcenetwork:developfrom
ChrisBQu:issue-4523
Feb 13, 2026
Merged

fix: Make Wazero the lens runtime for C bindings#4524
ChrisBQu merged 2 commits intosourcenetwork:developfrom
ChrisBQu:issue-4523

Conversation

@ChrisBQu
Copy link
Collaborator

Relevant issue(s)

Resolves #4523

Description

A recent change removed a line of code that made the C Bindings' NewNode function explicitly use Wazero as its lens runtime. This broke the C bindings, because that is currently the only runtime that is supported. This reverts that change.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

Specify the platform(s) on which this was tested:

  • WSL

@ChrisBQu ChrisBQu added this to the DefraDB v1.0 milestone Feb 13, 2026
@ChrisBQu ChrisBQu self-assigned this Feb 13, 2026
@ChrisBQu ChrisBQu added bug Something isn't working area/bindings Related to the foreign language bindings labels Feb 13, 2026
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.15%. Comparing base (da33729) to head (a1c77eb).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
cbindings/node.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4524      +/-   ##
===========================================
+ Coverage    76.11%   76.15%   +0.04%     
===========================================
  Files          521      521              
  Lines        41892    41892              
===========================================
+ Hits         31883    31900      +17     
+ Misses        7529     7517      -12     
+ Partials      2480     2475       -5     
Flag Coverage Δ
all-tests 76.15% <0.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cbindings/node.go 12.07% <0.00%> (ø)

... and 11 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update da33729...a1c77eb. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@AndrewSisley AndrewSisley left a comment

Choose a reason for hiding this comment

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

LGTM

@ChrisBQu ChrisBQu marked this pull request as ready for review February 13, 2026 19:45
@coderabbitai
Copy link

coderabbitai bot commented Feb 13, 2026

📝 Walkthrough

Walkthrough

The C bindings node configuration is updated to hardcode the lens runtime to "wazero" instead of using the previous lens runtime value. A comment documents that wazero is the only supported runtime for C bindings.

Changes

Cohort / File(s) Summary
Lens Runtime Configuration
cbindings/node.go
Hardcodes lens runtime to "wazero" and adds explanatory comment. Replaces use of options.NodeWASMLensRuntime constant with direct string value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Assessment against linked issues

Objective Addressed Explanation
Make Wazero the lens runtime for C bindings [#4523]

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@cbindings/node.go`:
- Around line 42-43: Replace the hardcoded "wazero" string used in
opts.DB().SetLensRuntime("wazero") with a named constant to document the
dependency and avoid magic strings; either add a public constant
NodeWazeroLensRuntime in client/options/node.go (type
options.NodeLensRuntimeType) and use that, or add a local const wazeroRuntime =
"wazero" in cbindings/node.go and call opts.DB().SetLensRuntime(wazeroRuntime);
include a brief comment explaining why the wazero runtime is chosen if you keep
it local.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0975bb8 and 3d7b88d.

📒 Files selected for processing (1)
  • cbindings/node.go
🧰 Additional context used
🪛 GitHub Check: codecov/patch
cbindings/node.go

[warning] 43-43: cbindings/node.go#L43
Added line #L43 was not covered by tests

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +42 to +43
// Currently the only supported lens runtime is wazero, so use it explicitly
opts.DB().SetLensRuntime("wazero")
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for "wazero" references to find any constants or defined values
rg -n -C3 'wazero' --type=go -g '!vendor/**' -g '!cbindings/**'

Repository: sourcenetwork/defradb

Length of output: 1453


🏁 Script executed:

#!/bin/bash
# Check cbindings/node.go imports and context
head -60 cbindings/node.go | cat -n

Repository: sourcenetwork/defradb

Length of output: 2065


🏁 Script executed:

#!/bin/bash
# Search for LensRuntimeType definition and check if there's a public constant
rg -n 'type LensRuntimeType' --type=go
rg -n 'const.*LensRuntime' --type=go -g '!vendor/**'

Repository: sourcenetwork/defradb

Length of output: 422


🏁 Script executed:

#!/bin/bash
# Check if options package exposes any lens runtime constants
rg -n 'LensRuntime\|Wazero' --type=go internal/client/options/ 2>/dev/null | head -20
# Also check if there's any public constant in options
rg -n 'const' internal/client/options/ --type=go | grep -i lens

Repository: sourcenetwork/defradb

Length of output: 129


🏁 Script executed:

#!/bin/bash
# Find the options package location
find . -name "options" -type d | grep -v vendor | grep -v node_modules

Repository: sourcenetwork/defradb

Length of output: 100


🏁 Script executed:

#!/bin/bash
# Check the client/options package for any lens runtime related constants
rg -n 'LensRuntime\|lens' client/options/ --type=go -i

Repository: sourcenetwork/defradb

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check how SetLensRuntime is defined in the options package
rg -n 'SetLensRuntime' --type=go

Repository: sourcenetwork/defradb

Length of output: 552


🏁 Script executed:

#!/bin/bash
# Check client/options/node.go for NodeLensRuntimeType constants
rg -n 'const.*LensRuntime\|type NodeLensRuntimeType' client/options/node.go -A2 -B2

Repository: sourcenetwork/defradb

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Search for NodeLensRuntimeType definition and related constants
rg -n 'NodeLensRuntimeType\|NodeJSLensRuntime\|NodeWASMLensRuntime' --type=go

Repository: sourcenetwork/defradb

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Read the SetLensRuntime method and surrounding code
sed -n '435,450p' client/options/node.go

Repository: sourcenetwork/defradb

Length of output: 708


🏁 Script executed:

#!/bin/bash
# Find NodeLensRuntimeType type definition
rg -n 'type NodeLensRuntimeType' client/options/ --type=go -A3
# Also search for any constants in the file
rg -n 'const.*=' client/options/node.go | head -30

Repository: sourcenetwork/defradb

Length of output: 270


🏁 Script executed:

#!/bin/bash
# Get the full const block for lens runtime types
sed -n '60,70p' client/options/node.go

Repository: sourcenetwork/defradb

Length of output: 560


🏁 Script executed:

#!/bin/bash
# Check if "wasm" and "wazero" are related or if there's documentation
rg -n 'wasm.*wazero\|wazero.*wasm' --type=go -B2 -A2
# Also check the internal/db config to understand the lens runtime types
sed -n '45,100p' internal/db/config.go

Repository: sourcenetwork/defradb

Length of output: 798


🏁 Script executed:

#!/bin/bash
# Check if "wasm" maps to wazero or if they're different
rg -n '"wasm"' internal/db/ --type=go -B2 -A2

Repository: sourcenetwork/defradb

Length of output: 47


🏁 Script executed:

#!/bin/bash
# Check if "wazero" is a valid/recognized lens runtime type
rg -n 'runtimeConstructors\[' internal/db/ --type=go -B1 -A1
# Check how the lens runtime is used in tests
rg -n '"wazero"' --type=go -B2 -A2

Repository: sourcenetwork/defradb

Length of output: 2207


🏁 Script executed:

#!/bin/bash
# Check what the public API offers for lens runtime types and verify if "wazero" is valid
cat client/options/node.go | sed -n '58,70p'
# Also verify - is "wazero" actually a valid value or should it be "wasm"?
# Let's check the PR context by looking at git log
git log --oneline --all -20 | grep -i wazero

Repository: sourcenetwork/defradb

Length of output: 593


Hardcoding "wazero" creates unnecessary coupling to an implementation detail.

While a Wazero constant exists in the internal db package, it's not accessible from cbindings (internal packages cannot be imported). The public options.NodeLensRuntimeType API only exports constants for "wasm", "js", and "" — not "wazero".

Consider either:

  1. Adding a NodeWazeroLensRuntime constant to client/options/node.go to formalize this as a supported public runtime type, or
  2. Adding a local constant in cbindings/node.go (e.g., const wazeroRuntime = "wazero") to document the dependency.

Alternatively, if "wazero" is an internal-only detail, document why the magic string is necessary here.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 43-43: cbindings/node.go#L43
Added line #L43 was not covered by tests

🤖 Prompt for AI Agents
In `@cbindings/node.go` around lines 42 - 43, Replace the hardcoded "wazero"
string used in opts.DB().SetLensRuntime("wazero") with a named constant to
document the dependency and avoid magic strings; either add a public constant
NodeWazeroLensRuntime in client/options/node.go (type
options.NodeLensRuntimeType) and use that, or add a local const wazeroRuntime =
"wazero" in cbindings/node.go and call opts.DB().SetLensRuntime(wazeroRuntime);
include a brief comment explaining why the wazero runtime is chosen if you keep
it local.

@ChrisBQu ChrisBQu merged commit ff5fc62 into sourcenetwork:develop Feb 13, 2026
87 of 93 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/bindings Related to the foreign language bindings bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make Wazero the lens runtime for C bindings

2 participants