Files
Adrià Arrufat 10609b025a Upgrade to Zig 0.17
Dependencies:
- v8: zig-v8-fork 0.17 branch (lightpanda-io/zig-v8-fork#218).
- sqlite3: build the amalgamation directly; the allyourcodebase wrapper
  has no 0.17 support yet.
- pcre2: master commit with 0.17 support (no release yet).
- translate_c package (2.0.0) replaces the deprecated addTranslateC.
  default_init is set to keep 0.16's zero-initialized struct fields.

Build:
- b.pathFromRoot/build_root/args/sysroot are gone: resolve paths from
  b.root, use addPassthruArgs, declare configure-time file and directory
  dependencies, and poison the configure cache for the git version.
- Drop curl config values the template never used (now an error).
- Drop the 0.16 zip-fetch workaround from the Makefile and CI.
- -Doptimize=ReleaseFast -> -Doptimize=fast.

Language and std:
- @intFromEnum/@enumFromInt -> @backingInt/@fromBackingInt.
- Struct-of-arrays @typeInfo (field_names, field_types, decl_names,
  param_types, error_names).
- `a ** n` removed: @splat for arrays, string.repeat for strings.
- errdefer captures removed: split WebDriver.run and fulfillRedirect.
- @hasDecl only sees pub decls: make StyleManager's Spec.finish pub,
  otherwise it silently stops running.
- SafeAllocator replaces DebugAllocator; the test runner now has to
  initialize std.testing.allocator_instance itself.
- std.fmt.allocPrint/bufPrint -> Allocator.print/std.mem.print,
  dupeZ -> dupeSentinel, std.builtin -> std.lang, builtin.os ->
  builtin.target.os, zon.parse arena API, BufferFirstAllocator, and the
  remaining renames (getLastOrNull, bit_set, ascii.find*, meta.Int).
2026-10-03 16:09:42 +02:00

1.5 KiB

AGENTS.md

See CONTRIBUTING.md for how to open a pull request (CLA, dev setup, pre-PR checks).

Build and tests

Run make download-v8 once first: it fetches the prebuilt V8 archive into .lp-cache/, which build.zig picks up automatically. Without it every build compiles V8 from source (10+ minutes).

The C and Rust dependencies are built with -Doptimize=fast whatever -Doptimize is, so debug and release builds share them. Pass ZIGFLAGS=-Ddebug_deps to step into a dependency with a debugger.

make test                                       # Run all tests
make test F="server"                            # Filter by substring
TEST_FILTER="WebApi: #selector_all" make test   # Filter main + subtest (separator: #)
TEST_VERBOSE=true make test
TEST_FAIL_FIRST=true make test
METRICS=true make test                          # Capture allocation/duration metrics as JSON

The custom test runner (src/test_runner.zig) detects memory leaks in debug builds. A test that allocates without freeing fails — not just lints.

Formatting

zig fmt --check ./*.zig ./**/*.zig    # Exact command CI runs

zig build depends on the fmt step, so a local build catches drift too.

Conventions

Mirror the patterns in neighboring files. In particular:

  • @import alias case follows the imported file's basename (const Frame = @import("Frame.zig"), const ast = @import("ast.zig")).
  • Prefer struct-init type inference (.{ ... }) where the expected type is known from the function signature or variable annotation.