Contributing
There are many ways to help: report a problem, improve an explanation or example, review a change, or contribute code and tests. Whether your change is small or large, we welcome your perspective.
Start by setting up the repository. See Testing for verification and Releasing for the maintainer workflow.
Get startedโ
For a bug or a larger change, start by checking the issue tracker for an existing discussion. A clear description and a small reproducible example help others understand a bug. For an enhancement, describe the problem and your proposed approach so the community can discuss it with you.
Set up the repositoryโ
git clone git@github.com:visgl/luma.gl.git
cd luma.gl
nvm use
yarn install
Source lives in modules/. Run a standalone example while editing:
cd examples/showcase/instancing
yarn start
Vite reloads changes to source and example code. From the repository root,
yarn website:start runs the complete documentation and example website.
Prepare a pull requestโ
Create a branch for your work and open a pull request when it is ready for review. Explain the problem, what you changed, and how you verified it. Link any related issues and include screenshots or examples when they help reviewers understand the result. Review is a collaborative process; questions and follow-up changes are a normal part of it.
Verify a changeโ
Follow the repositoryโs AGENTS.md and CI requirements. Depending on your change,
the main checks include:
yarn lint fix
yarn build
yarn test
yarn website:build
Test commands and runtime conventions explain
Node and browser verification. Add focused tests beside the affected module's tests.
Use Vitest for new coverage, and remove temporary test.only calls before committing.
Merge queueโ
The test workflow runs on merge_group: checks_requested so GitHub can validate
queued changes against the current master and earlier queue entries. Its concurrency
key uses the queue ref, keeping independent merge groups separate from PR runs.
Queue runs include three general browser shards, two compute shards, Node tests, package builds, GPU presentation, lint, examples, and the website build. Native physics runs on PRs that change its inputs and on every master push. The nightly physics workflow also runs the two native shards and the full endurance matrix. Runs without physics execute the scheduled tests without coverage instrumentation. Coveralls receives the complete reports from runs that include physics.
After merging the workflow preparation, a repository administrator can enable the queue
for master in Settings โ Branches (the existing protection rule), or in a branch ruleset:
- Require
Aggregate test coverageandBuild, lint, Node tests, examples, and website. The aggregate check fails if a scheduled browser shard, Node tests, or presentation fails. The separate build check runs package, lint, example, and website validation. Do not require individual physics checks for queue commits. - Enable Require merge queue. Start with build concurrency 1, minimum and maximum merge group size 1, a 60-minute status-check timeout, and Only merge non-failing pull requests enabled.
- Use squash or rebase merging to preserve the branch's required linear history.
- Retain one required approval, with
ibgreenas the sole user allowed to bypass required PR reviews. Apply protection to administrators as well. Keep this exception scoped to PR review requirements; do not add a bypass for CI or the merge queue. - Queue a small PR and confirm that the two required checks run on its merge-group commit before relying on the queue for subsequent changes.
A bypass applies to the person merging or queuing a PR, not its author. Other contributors
still need an approval when merging their own PRs; ibgreen can bypass reviews for any PR.
See GitHub's merge queue documentation for configuration details. Repository settings are separate from workflow files; merging this preparation does not itself enable the queue.
Writing luma.gl documentationโ
Documentation should help readers choose a layer, complete a workflow, and then look up an exact contract without repeating the same explanation on every page.
Page contractsโ
| Page type | Required progression |
|---|---|
| Module overview | Overview โ when to use โ quick start or live example โ concepts โ capabilities โ workflows โ API index โ limits โ related modules |
| Guide | Outcome and prerequisites โ mental model โ workflow โ example โ tradeoffs โ mistakes โ next steps |
| API reference | Role/import โ usage โ contract โ ownership โ failures โ compatibility โ cost โ related APIs |
| Tutorial | Outcome โ prerequisites โ live result โ incremental implementation โ explanation โ extension โ next lesson |
Omit an irrelevant section instead of adding empty boilerplate, but preserve the relative order of the remaining sections.
Navigationโ
- The sidebar is the complete hierarchy.
- Page tabs contain only three to seven immediate peers.
- Preserve existing routes when splitting a page; turn the old route into an index.
- Every curated page belongs in
docs/table-of-contents.jsonunless it is intentionally internal.
Examplesโ
- Prefer short snippets that focus on one decision.
- Reuse actual example source for longer runnable programs.
- Activate embedded GPU examples explicitly; do not capture page scrolling before activation.
- State backend requirements and resource ownership.
Style and maintenanceโ
- Use sentence-case headings and factual language.
- Link the first unfamiliar term to Terminology.
- Use local status badges instead of remote images.
- Put implementation roadmaps in
dev-docs, not public API pages. - Run documentation contract tests and the website build before merging.
Testingโ
luma.gl uses Vitest for Node and browser tests. Start with a focused check while working, then run the relevant repository checks before opening a pull request. GPU tests run in Chromium through Playwright and need an available browser and suitable GPU support. The root scripts provide a consistent interface for both contributors and automation.
Set upโ
From the repository root, select the version in .nvmrc and install dependencies:
nvm use
yarn install
yarn playwright:install
The last command installs Playwright's Chromium and WebKit browsers. See Contributing for repository setup and the setup guide for application development.
Choose a test commandโ
| Goal | Command | What it does |
|---|---|---|
| Check CPU-only behavior | yarn test-node | Runs the Node test project. |
| Debug browser tests locally | yarn test-browser | Runs browser-backed tests in headed Chromium. |
| Run browser tests without a window | yarn test-headless | Runs the headless browser project. |
| Run the standard test suite | yarn test | Runs Node tests followed by headless browser tests. |
| Run a quick check | yarn test-fast | Runs lint and Node tests. |
| Collect browser coverage | yarn test-coverage | Runs headless browser tests with Istanbul coverage. |
| Collect Node coverage | yarn test-node-coverage | Writes Node LCOV coverage. |
For a change that affects shared APIs or multiple packages, run yarn build as
well as the relevant tests. Follow the repository's AGENTS.md and CI requirements
for the full set of checks. A passing Node suite alone does not exercise browser or
GPU behavior.
Write and organize testsโ
Vitest discovers specs directly. Use *.node.spec.ts or *.node.spec.js for
CPU-only tests that must run in Node. Other *.spec.ts and *.spec.js files use
the browser-backed path by default. An audited list in vitest.config.ts also
routes existing CPU-only specs to Node.
Put focused tests near the behavior they cover. Use Vitest for new tests, and
remove temporary test.only calls before committing. Node workers reuse their
module graph: restore changed globals, environment variables, mocks, and shared
module state in cleanup hooks. Browser tests normally isolate files; CI has
explicit exceptions for audited groups.
For device tests, use the reusable WebGL and WebGPU helpers from
@luma.gl/core/test-utils. Creating too many devices can exhaust browser GPU
contexts. Use offscreen texture readback for numeric GPU assertions and reserve
canvas screenshots for behavior that depends on presentation.
Debug a website exampleโ
The yarn website-debug command uses the Playwright utilities in
scripts/playwright/ and the aliases and defaults in .ocularrc.js. It can open an
example, select a backend, collect console and page diagnostics, probe WebGPU, and
capture a screenshot.
yarn website-debug --example showcase/persistence
yarn website-debug --example api/animation --backend webgpu-core
yarn website-debug --example persistence --backend webgl2
An example can be specified by route segment, full /examples/... route, alias,
or full URL. Backend choices include webgpu-core, webgpu-core-max,
webgpu-compatibility, and webgl2; webgpu is an alias for webgpu-core.
Without an explicit backend, the runner prefers core WebGPU, then compatibility
WebGPU, then WebGL2.
The runner writes a screenshot, WebGPU probe, page diagnostics, and the last URL
to .playwright-artifacts/. For an interactive debugging connection, launch a
managed browser with a debugging port or attach to a browser that was already
started with one:
yarn website-debug --example showcase/persistence --debug-port 9222
yarn website-debug --attach=http://127.0.0.1:9222 --target-tab persistence
Attach mode can reuse a page matching a URL or title, or open one in the attached browser context. It cannot attach to a browser without remote debugging enabled or control the Chrome DevTools UI.
Specialized checksโ
Presentation captureโ
yarn test-presentation verifies canvas presentation and captured pixels for
WebGPU and WebGL2. This checks the browser compositor separately from rendering
logic; missing GPU support or blank captures fail with an infrastructure
diagnostic. On Linux, an X display is required; use
xvfb-run -a yarn test-presentation when appropriate.
Physics enduranceโ
yarn test-physics-endurance runs the full-duration physics endurance specs
without coverage instrumentation. The standard local headless suite includes the
full-duration specs; release CI uses a separate group that excludes the endurance
qualification. Scheduled and manually dispatched physics workflows run both the
regular native physics shards and the full endurance matrix.
Benchmarks and visual checksโ
yarn test-browser-benchmarks runs benchmark-only browser specs without coverage.
For example-level visual checks, LUMA_VISUAL_TEST_PIXEL_SCALE=1 requests a
full-resolution diagnostic run; some visual tests normally use a smaller drawing
buffer. GLOBE_SOFTWARE_GPU=true selects the globe software-GPU diagnostic.
HDR captureโ
For examples that expose the HDR capture contract, add --hdr-capture and set the
viewport if needed:
yarn website-debug --example showcase/tempest-ocean --backend webgpu-core --hdr-capture --viewport-width 1580 --viewport-height 780
The runner keeps the normal PNG and writes raw Display-P3 HDR and SDR planes plus
a JSON manifest in .playwright-artifacts/. HDR capture requires a compatible
extended-range canvas or an example-provided capture implementation; an SDR
fallback is not reported as HDR.
Legacy snapshotsโ
test/render/** snapshots and test/perf/** benchmarks remain on the legacy
repository-only browser harness and are excluded from Vitest. See
SnapshotTestRunner for the
legacy harness. Prefer Vitest and the current Playwright utilities for new tests.
How the test infrastructure fits togetherโ
vitest.config.ts configures the node, browser, and headless projects using
shared @vis.gl/dev-tools configuration. Browser projects use Playwright. Browser
files run serially within a project to avoid competing for GPU resources and
foreground input; CI parallelizes across configured shards and test groups. CI
also collects and merges Node and browser coverage. The workflow files and the
configuration are the source of truth for current grouping and schedules.
When a browser or GPU test fails, inspect the console and page diagnostics first,
confirm the selected backend and GPU availability, and distinguish an assertion
failure from a browser startup or canvas capture failure. If you change the test
infrastructure itself, update the relevant root script, vitest.config.ts,
.ocularrc.js, or scripts/playwright/ alongside this guide.
Maintaining browser shard balanceโ
test/utils/browser-test-sequencer.ts assigns complete files using measured execution
weights, longest first. A large file cannot be balanced internally: keep independent,
expensive pixel scenarios in separate specs with a shared fixture helper. The ray material
pixel scenarios retain isolated GPU resources and all assertions, but can execute on
separate workers. Do not replace GPU behavior checks with source-text assertions or shorten
simulation horizons just to improve a timing number.
Refresh weights from completed GitHub Actions logs when expensive suites are added or moved. For example:
gh run view <run-id> --log > browser-run.log
node scripts/ci/browser-timings.mjs browser-run.log > browser-timings.json
The extractor accepts raw ANSI and gh-escaped logs, ignores Node results, and retains the
slowest observed file duration plus one second for page/import overhead. Keep Linux
SwiftShader and native macOS physics measurements separate when updating the two maps.
Incomplete files have no duration; inspect cancelled logs before trusting an apparent
speedup. Measure both the longest job and total worker time after the change lands in CI.
The presentation canary runs once in its dedicated job and once per coverage worker;
repeating it in the dedicated job adds little coverage. Release jobs install Chromium only,
matching their browser project.
Keep the previous weight for any file missing from a new measurement, especially when a shard was cancelled. An absent result is not evidence that a suite became fast. Remove a weight only when the file is removed or a completed measurement replaces it.
Releasingโ
This guide is for maintainers preparing a luma.gl release. Releases are published from an eligible branch by the GitHub Actions release workflow. A pushed version tag starts the workflow; after its tests and build pass, it checks the changelog, creates the GitHub release, and publishes packages to npm.
For an ordinary release:
- Choose an eligible branch and release version.
- Write and commit the matching changelog entry.
- Version the packages, review the changes, and run the checks.
- Commit and tag the release, then push the branch and tag.
- Monitor the workflow and verify every public package on npm.
The examples below use v10.0.0-alpha.7 to illustrate the commands. Substitute
the version and branch for the release you are preparing. Alpha releases use the
beta npm dist-tag; check the expected dist-tag for other release types before
publishing.
Existing packages use npm trusted publishing in the release workflow, so routine
releases do not require a local npm login or a publishing token. A new package
name needs the one-time setup described below. Determine the current public
package set from modules/*/package.json and each packageโs private flag.
1. Choose the release sourceโ
Publish only from master or a release branch whose name ends in -release, such as 9.4-release.
The workflow checks that the tagged commit is contained in one of those remote branches. Use the
appropriate release branch for patch releases and master for a new major or minor release unless
the release plan says otherwise.
Use a clean checkout of the release branch. If the development checkout contains unrelated changes, use a separate clean checkout rather than stashing, committing, or publishing those changes. Do not publish from a feature branch or a detached commit outside the permitted release branches.
2. Prepare the changelog and versionโ
Check lerna.json, remote Git tags, and npm before choosing a version:
git ls-remote origin refs/heads/master 'refs/tags/v10.0.0-alpha.*'
npm view @luma.gl/core dist-tags --json
If the intended version already has a failed or partial release, follow recovery below instead of
incrementing merely to escape the failure. Alpha packages use npm's beta dist-tag. Preserve the
existing latest tags for prereleases.
Add a user-visible release entry to CHANGELOG.md. Its heading must exactly match the intended
tag, for example ### v10.0.0-alpha.7. Stage and commit the changelog on the release branch
before invoking version tooling. The workflow verifies the exact heading before publication.
The following controlled sequence allows version references to be checked before anything is pushed. Replace the example versions throughout this guide with the intended release versions.
nvm use
yarn install
git add CHANGELOG.md
git commit -m 'docs: prepare v10.0.0-alpha.7 release notes'
npx lerna version 10.0.0-alpha.7 --force-publish --exact --no-commit-hooks --no-git-tag-version --no-push --yes
Review the resulting manifests. Lerna has left old references in the website workspace and in
anari and graph peer dependencies during previous releases. Find remaining references to the
previous luma.gl version and align dependencies that should follow this release:
rg '10\.0\.0-alpha\.6' --glob package.json --glob '!node_modules/**'
Review compatibility ranges deliberately; do not replace unrelated dependency versions. Run
yarn install again after correcting manifests so the lockfile agrees with them.
yarn publish-beta and yarn publish-prod remain convenience alternatives: they version, commit,
tag, and immediately push. Use them only when no intermediate manifest corrections are needed.
Do not run them after the controlled versioning sequence, which would bump the version again.
3. Validate and tag the releaseโ
After the final manifest and formatting changes, run:
yarn install
yarn lint fix
yarn build
yarn test
A successful yarn build does not exercise every prepublishOnly hook. Before pushing, also check
every public package's repository metadata and run its actual prepublish hook:
node --input-type=module <<'JS'
import assert from 'node:assert/strict';
import {execFileSync} from 'node:child_process';
import {existsSync, readdirSync, readFileSync} from 'node:fs';
import {join} from 'node:path';
for (const directory of readdirSync('modules')) {
const packageDirectory = join('modules', directory);
const manifestPath = join(packageDirectory, 'package.json');
if (!existsSync(manifestPath)) continue;
const packageInfo = JSON.parse(readFileSync(manifestPath, 'utf8'));
if (packageInfo.private) continue;
assert.equal(packageInfo.repository?.url, 'https://github.com/visgl/luma.gl', packageInfo.name);
console.log(packageInfo.name);
if (packageInfo.scripts?.prepublishOnly) {
execFileSync('npm', ['run', 'prepublishOnly'], {cwd: packageDirectory, stdio: 'inherit'});
}
}
JS
The repository URL must match the repository identified by the workflow's provenance. A missing
repository.url caused npm to reject @luma.gl/three with E422 even though build and tests passed.
Bundle hooks also catch workspace alias problems that TypeScript builds can miss.
A local VITEST_BROWSER_CONNECTION_CLOSED is a failed infrastructure run, not a passing test run.
Record it and investigate; require the full Linux test gates on the same release source to pass
before publication. Do not skip assertions or weaken release gates to work around a browser crash.
Immediately before pushing, fetch the release branch and check that its remote head has not advanced. Incorporate new source changes and repeat the relevant checks if necessary. In the clean release checkout, review the diff, commit the version changes, and push only the intended tag:
git diff --stat
git diff
git add --all
git commit -m 'v10.0.0-alpha.7'
git tag -a v10.0.0-alpha.7 -m v10.0.0-alpha.7
git push origin master
git push origin refs/tags/v10.0.0-alpha.7
Substitute the release branch for master when appropriate. The workflow runs Node tests and six headless release-suite shards. After those
pass, it builds packages, checks the changelog, creates the GitHub release, and
publishes through OIDC. Monitor the whole workflow through completion.
The release suite uses LUMA_TEST_BROWSER_GROUP=release. It keeps rendering, data processing,
and ordinary physics correctness checks, while application-scale domino and endurance
qualification stays in physics CI. Their assertions and thresholds are unchanged. Default local
tests and PR physics coverage still exercise the domino scenario; the full endurance matrix also
runs through the scheduled/manual physics workflow. The qualification list lives in
test/utils/browser-test-groups.ts.
4. Verify the published releaseโ
For every public package, verify the exact version, expected dist-tag, and provenance:
npm view @luma.gl/core@10.0.0-alpha.7 version dist.attestations --json --prefer-online
npm view @luma.gl/core dist-tags --json --prefer-online
Repeat for the package set printed by the preflight above. Confirm beta points to the new alpha,
latest remains unchanged, the GitHub release is a prerelease, and each OIDC publication has a
provenance attestation. Initial authenticated bootstrap versions may lack OIDC provenance; the
subsequent workflow-published version must have it.
Capture every public package's dist-tags before publishing so verification can compare all
previous non-beta tags, including latest, rather than just the new beta value.
Registry metadata can lag a successful publish, including returning E404 or the previous
beta tag. During alpha.9, ordinary npm queries initially returned 404 after the workflow
succeeded; packages appeared at different times, and all seven were verified several minutes
later. Allow at least five minutes for propagation and recheck each package independently.
This is a diagnostic interval, not a guarantee that registry caches have refreshed.
Retain the successful publish log. Fresh cache-busted registry metadata can help diagnose stale
responses, but finish with ordinary npm view --prefer-online verification of exact versions,
dist-tags, and provenance. Do not republish or move the tag just because an early query returns
404. A green workflow alone is not proof that every version is publicly installable.
New package names: one-time setupโ
Bootstrap before the target releaseโ
Merge the public-package change, declare its repository URL, and pass build, tests, and prepublish
checks on master or a permitted release branch. Use the real built package for one authenticated
initial publication so that its npm settings can be configured.
Do this before bumping to the target release version. For example, bootstrap a new package at
the current alpha.6 version, configure its publisher, then let the next alpha.7 workflow publish
it through OIDC. If it is manually published at the target version, from-package skips that
version and the new trust connection will still need a later OIDC publication to validate.
From the checked source, replace modules/new-module with the new package's directory:
npm login
npx --yes npm@^11.15.0 publish ./modules/new-module --access public --tag beta --auth-type=web
Complete any browser authentication or authenticator-code prompts directly with npm. Terminal login and browser settings authentication are separate; npm may request another code for each settings change. Never add a maintainer token to the release workflow for this bootstrap.
Configure and validate the publisherโ
In the new package's npm Settings, create a GitHub Actions trusted publisher:
| Setting | Value |
|---|---|
| Organization or user | visgl |
| Repository | luma.gl |
| Workflow filename | release.yml |
| Environment name | Leave empty; the release job does not use a GitHub environment |
| Allowed actions | Enable direct publishing (npm publish) |
Use the filename alone, not .github/workflows/release.yml. A stage-only connection does not
match this repository's immediate publishing flow. Inspect an existing connection before making
changes; do not recreate an already valid publisher for each release.
A maintainer with npm 2FA can also inspect and configure a connection through the CLI:
npx --yes npm@^11.15.0 trust list @luma.gl/new-module
npx --yes npm@^11.15.0 trust github @luma.gl/new-module --repo visgl/luma.gl --file release.yml --allow-publish
These commands manage npm account settings and may require 2FA, including for inspection. After the workflow publishes a new version, check that npm Settings shows Valid, rather than Pending validation, and verify its registry provenance.
A new connection must complete its first successful publication within two days or it expires.
Plan the bootstrap and next OIDC publication together; saving the connection is not the final
step. See npm's configuration expiry documentation
and the npm trust reference.
Recover from a failed publicationโ
Keep the same version while completing a failed or partial release. First inspect the failed job and query npm for every public package to establish which versions actually reached the registry. Do not unpublish or attempt to overwrite successful versions.
Allow automatic publishing recovery to finishโ
The current @vis.gl/dev-tools publisher makes up to three publishing attempts with a
120-second delay between attempts. The release workflow invokes this publisher directly;
inspect the installed publisher and logs if its behavior changes after a dev-tools upgrade.
Alpha.9 encountered TLOG_CREATE_ENTRY_ERROR / HTTP 409 because equivalent provenance entries
already existed in the transparency log. The built-in second attempt recovered: it skipped the
already published graph package and published the remaining six packages. The successful log
therefore listed six newly published packages while the complete release contained seven.
Verify the full public package set, including packages skipped on a retry.
While the publisher is still running its bounded retries, monitor it rather than starting a competing job or deleting the GitHub release. Keep OIDC and provenance enabled. A transparency error in an earlier attempt does not establish that the final publication failed.
Retry unchanged source after automatic recovery is exhaustedโ
Only after the job has failed and registry state has been inspected, use manual recovery. For a transient publishing failure, retain successful test jobs and rerun only the publishing job. If the workflow already created its GitHub release, delete that incomplete release entry first; this does not delete the Git tag or npm packages. The current publisher creates the GitHub release before npm publication, so leaving the entry in place prevents a clean retry.
Replace VERSION, RUN_ID, and JOB_ID below with values from the failed release.
The API query returns the publishing job's numeric ID.
gh release delete vVERSION --repo visgl/luma.gl --yes
gh api repos/visgl/luma.gl/actions/runs/RUN_ID/jobs --jq '.jobs[] | {id, name, conclusion}'
gh run rerun RUN_ID --repo visgl/luma.gl --job JOB_ID
Delete the GitHub release only if it exists. The from-package publisher skips versions already
on npm. After a retry, repeat the complete registry verification, including dist-tags and
provenance. Use bounded retries for transient failures, not an endless rerun loop.
Correct the release sourceโ
Put source or workflow fixes through a PR and merge them with the required reviews and checks. Do not assume a release request authorizes bypassing branch protections. From a clean permitted release branch at the corrected, validated commit, move the existing tag with a lease:
releaseTag=v10.0.0-alpha.7
previousTagObject=$(git ls-remote origin "refs/tags/$releaseTag" | cut -f1)
git tag -f -a "$releaseTag" -m "$releaseTag" HEAD
git push origin "refs/tags/$releaseTag" "--force-with-lease=refs/tags/$releaseTag:$previousTagObject"
Remove an incomplete GitHub release entry before pushing the tag. A moved tag triggers a fresh
workflow; do not rerun an old job expecting it to check out the corrected commit. The commit must
remain contained in remote master or a *-release branch, with the exact changelog heading.
Already published packages remain immutable and keep their original provenance. If a published package itself requires a code fix, release a new version rather than trying to replace it. Do not claim skipped packages were rebuilt from a later recovery commit.
Known failure signaturesโ
| Failure | Action |
|---|---|
npm E422 says repository.url does not match provenance | Correct the package manifest to identify https://github.com/visgl/luma.gl, verify the packed manifest, and merge before retrying. |
| A prepublish bundle cannot resolve an internal workspace path | Check the bundle alias against the package export map. Run actual prepublish hooks; a TypeScript build alone does not cover this. |
TLOG_CREATE_ENTRY_ERROR / HTTP 409 says an equivalent transparency-log entry exists | Let the built-in bounded retry finish; inspect the final job result and registry. Retry the publisher manually only if automatic recovery is exhausted. Keep OIDC and provenance enabled. |
ERR_INVALID_ARG_TYPE says the timeout is a string | Remove npm_config_timeout. Lerna forwards that untyped environment value as a string, while its HTTP client requires a number. Do not use this variable as a Sigstore workaround. Test any future override through the actual HTTP client, not just a configuration snapshot. |
A newly published version returns E404 or an old dist-tag | Allow registry propagation, compare with publish logs, and recheck exact versions and tags before retrying. |