1292 Commits
Author SHA1 Message Date
Mahdi ramezaan zaade 03079275a4 Port remaining Objective-C code (clipboard, tray, gg, ios bridge) to V (#31077) 2026-10-26 05:31:02 +03:00
Mahdi ramezaan zaade 1f4cb74fae gg: pure-V sgl renderer (gg/render) with CPU rasterizer backend (#31067)
* gg: pure-V sgl renderer (gg/render) with CPU rasterizer backend

* gg: add per-corner rounded rect, 9-slice, CPU output equality test

* gg: add multiply/screen blend modes to renderer and CPU rasterizer

* gg: add multiply/screen to ImageEffect enum

* gg: fix review defects in V renderer (font crash, api break, leaks)

- text_rendering: add FonsRenderTarget allocated before
  fonsCreateInternal, since fontstash calls renderCreate
  synchronously; fixes invalid memory access crash on startup.
  renderUpdate now copies only the dirty atlas region.
- draw: rewrite draw_rounded_rect_filled_4 as a single convex
  triangle strip (removes nonexistent begin_triangle_fan calls
  that broke compilation of any user of the new API, removes
  double-blend overlaps); add clamp_radius/clamp_slice helpers.
- draw_9slice: remove dead slices array/loop, clamp dest slices
  proportionally, use clamped UVs.
- render: do not create pipeline object 5 (quads reuse triangles
  pipeline, matching sgl); push_pipeline uses max_stack_depth-1;
  add is_image_registered/update_image_region/destroy.
- image: register textures once per image; streaming updates
  refresh the CPU copy via update_image_region.
- gg: call ctx.r.destroy() before gfx.shutdown(); drop unused
  gg.render imports; add .vv compile samples for the new APIs.
- flush: pass [4]int dirty rect to validate_texture (was &int,
  heap overwrite causing delayed crash in begin()).

* gg: migrate examples off sokol.sgl to ctx.r

gg no longer submits an sgl context after the pure-V renderer migration, so direct sgl calls in gg examples either failed to typecheck (rotating_textured_quad passed render.Pipeline to sgl.load_pipeline) or silently recorded nothing. Route matrix, pipeline, texture and primitive calls through ctx.r instead.

* x.ttf.render_sokol: draw through ctx.r instead of sgl

draw_text_bmp took ctx &gg.Context but issued its matrix, pipeline, texture and quad calls to sokol.sgl. After the pure-V renderer migration gg no longer submits an sgl context, and the mixed types made the function (and every ttf_font example) fail to compile: cannot use render.Pipeline as sgl.Pipeline in argument 1 to sgl.load_pipeline.

* gg: add a compile-test for all gg based examples

Compiles every examples/gg program, plus breakout, viewer and both ttf_font examples, so examples that keep referencing sokol.sgl directly fail the suite instead of the renderer migration (render.Pipeline is not sgl.Pipeline) going unnoticed. The samples are compiled in parallel with VJOBS-style workers into a private vcache directory.
2026-10-26 05:30:48 +03:00
Alexander Medvednikov 8bd7ffa3f8 Fix macOS CI with default caching and integer migration (#31154)
* cgen: scope cleanup switch cases for older Apple Clang

* checker: let zero assignments leave reference sum variants

* math.big: pass signed byte counts to memory helpers

* checker: limit zero literal inspection to reference narrowing

* checker: stop loop narrowing scans before the current assignment

* tests: repair integer migration inputs for macOS self tests

* checker: return platform int for translated pointer differences

* examples: use signed byte counts for graphics buffers

* cgen: preserve headerless mmap bindings in cached modules

* fastc: repair pointer difference formatting and bootstrap fallback
2026-10-26 05:23:57 +03:00
Alexander Medvednikov fca9fad345 compiler: deprecate isize and usize in favor of int and uint (#31113) 2026-10-25 14:43:23 +03:00
Alexander Medvednikov cf16fefe55 macos: fix failures in the default-cache CI run (#31031)
* macos: fix CI formatting and older SDK TCC headers

* crdt: format gcounter tests for CI

* crdt: remove trailing blank lines caught by CI

* vfmt: format files reported by macOS CI

* veb.csrf: use context configuration when clearing cookies

* math: provide logf in pure V builds

* math: correctly round pure V square roots

* transform: preserve generic elements in fixed array loops

* cgen: escape bool field names for stdbool compatibility

* json2: release JSON5 decoding scratch and cloned map keys

* examples: use pointer recursion in the binary search tree

* modulecache: preserve static macro definitions in declaration headers

* macos: fix declaration test scanning and recursive tree example

* test-self: isolate compiler environment flags from nested builds

* cgen: preserve interface dispatch and module roots with warm caches

* tests: correct backend fixtures exercised by macOS CI

* transform: decode escaped bool generic arguments

* tests: align GC and closure checks with native declarations

* tests: match current HTML tag formatting in option output

* cgen: retain mutable struct addresses in integer casts

* transform: retain explicit generic method calls when ordering arguments

* checker: retain nested translated array types in pointer comparisons

* tests: retain type storage and canonicalize macOS temporary paths

* graphql: store recursive AST edges through pointers

* veb: avoid copying large request and response structs for connection checks

* veb.csrf: expire cleared cookies at the configured path
2026-10-22 16:38:25 +03:00
Alexander Medvednikov 2580db67f7 veb: add typed controller-aware OpenAPI documents (#31025)
* veb: add typed controller-aware OpenAPI documents

* veb: fix OpenAPI ID collisions and field metadata

* veb: match OpenAPI schemas to dispatched routes and JSON encoding

* veb: align typed OpenAPI schemas with routing and JSON encoding
2026-10-22 08:23:02 +03:00
Keito TobichiandAlexander Medvednikov 0fc800c418 sokol: fix sokol.audio on Windows TCC and fix simple_bytebeat example (#30892)
* sokol: fix sokol.audio on Windows TCC and fix simple_bytebeat example (fixes #30891)

- Fix TCC objbase.h bug where COINIT_MULTITHREADED is defined as 0x3 instead of 0x0, causing CoInitializeEx to fail with E_INVALIDARG and CoCreateInstance for IMMDeviceEnumerator to fail with CO_E_NOTINITIALIZED.
- Fix TCC missing 1-byte struct packing for WAVEFORMATEX / WAVEFORMATEXTENSIBLE, which caused IAudioClient_Initialize to fail with E_INVALIDARG.
- Fix simple_bytebeat.v user_data callback signature and frame count handling.
- Add sokol.audio setup/shutdown test in vlib/sokol/audio/audio_test.c.v.

* sokol: keep bytebeat frame state on the audio callback thread

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-20 01:15:29 +03:00
Karan GuptaandAlexander Medvednikov 21882a270f ​examples: add Collatz Conjecture and Pell numbers benchmark example (#30899)
* Add files via upload

* examples: fix cached Collatz chains and guard integer bounds

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-20 01:15:19 +03:00
qpandqp 8a8ec26b80 Remove two unreferenced byte-identical duplicates (#30663)
* vlib/json2: remove duplicated sumtype todo fixture

The todo file was copied into decoder_tests/ by a60fb589 while the
identical original stayed in tests/. Nothing references either copy
(they are uncompiled .vv notes), so drop the newer duplicate.

* examples: remove unreferenced duplicate veb_assets example

veb_assets_example.v is byte-identical to the sibling veb_assets.v and
referenced nowhere (docs, tests, CI). Keep the original, drop the copy.

---------

Co-authored-by: qp <168933756+gabytz777@users.noreply.github.com>
2026-10-18 04:00:14 +03:00
Mahdi ramezaan zaadeandAlexander Medvednikov be90bdf3f1 doc: point hot code reloading at v watch, not v -live (#30376)
* doc: point hot code reloading at v watch, not v -live

The Hot code reloading section documented `v -live` with @[live]
functions as the way to iterate on a running program. That per-function
mechanism no longer reloads under the default compiler (#30198), while
`v watch` - rebuild and re-run on change, plus browser refresh for veb
apps via -d veb_livereload - is what the veb README documents and what
works today.

Make `v watch` the recommended flow in doc/docs.md, with the veb
options from the veb README, keep the @[live] mechanics under their own
heading with a note about the current status, and update the build
comments of the two hot_reload examples to the watch workflow.

Fixes #30355

* doc: explain restart state before legacy hot reload commands

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-14 13:52:57 +03:00
Alexander Medvednikov 0fc4f42d8a cgen: fix macOS CI with default module caching (#30388)
* cgen: fix macOS CI with default module caching

* checker: keep source import scopes for cached header parameters

* markused: retain generic helpers when literal programs keep all functions

* markused: retain IError methods referenced by cached dispatchers

* tests: wait for raw terminal mode before readline input

* cgen: collect wrapped tuple signatures before payload declarations

* compiler: retain shared payloads and assign interface helpers to their type owners

* transform: preserve parsed interface ownership across generated contexts

* cgen: keep portable signal installers local in cached cross builds

* driver: preserve scoped generic interface parameter metadata

* driver: regenerate translated C prefixes after body edits

* cgen: retain late tuple payload layouts and generic interface owners
2026-10-14 00:29:50 +03:00
penguindarkandAlexander Medvednikov f8d9f4cc8d Image decoder (#30206)
* image: add image.decoders with JPEG, PNG, BMP, WEBP, TIFF, GIF decoders

Add pure-V image decoders under vlib/image/decoders: one package per
format, a shared common module (Image/Frame/Animation/BitReader), and a
magic-byte dispatcher. Each codec package is self-contained with its own
tests and test data.

Replace examples/viewer with a viewer built on these decoders instead
of stbi, add a rewritten README, and document the decoders in
README.md, CODEC.md, and development.md.

* image.decoders: shrink the 4.webp fixture to 64x48

Resize the real-world animated WEBP fixture to 64x48 (lossy, alpha
kept) and update the pinned canvas size and FNV-1a checksums.

* examples/viewer: silence unused-function and interface-init notices

Remove the dead ci_less helper (name sorting already lowercases its
keys) and initialize App.player with a NullPlayer no-op implementation.

* image.decoders: shrink the jpeg base.jpg fixture to 256x320

* image.decoders: silence all compiler notices

- Write bit accumulation as x * (1 << k) instead of signed x << k in
  the jpeg, tiff, and webp decoders (identical two's-complement
  semantics, no sign-shift notice).
- Rename locals that shadow function declarations (hev_thr, copied).
- Prefix intentionally unused JPEG-spec parameters with _ in the
  arithmetic decoder.
- Document the conventions in development.md.

* image.decoders: validate allocation sizes and TIFF block tables

* image: bound native buffers and release viewer animation ownership

* image.webp: release tracked arrays through builtin ownership headers

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-12 01:01:13 +03:00
5990a98cee veb: render_request, so an app can render a route without a listener (#30187)
* veb: render_request, so an app can render a route without a listener

`veb.run` starts a server, which is the only way to get a page out of a veb app
today. That is right for a server and wrong for a site that should be a directory
of files: a static export needs the same HTML without a process, a port, or a
second rendering implementation that can drift from the first.

`veb.render_request[A, X](mut app, req)` is one call that does it. It generates
the route table from the app's methods and dispatches the request through the
same `handle_request_and_route` the server loop uses. `Context.conn` stays nil and
`takeover_mode` stays `.none`, so `send_response_to_client` has nothing to write
to and the result is read from `ctx.res` by the caller.

It exists as one function rather than by making `generate_routes` and
`handle_request_and_route` public: those take a `RequestParams` whose fields are
veb internals (`routes: &map[string]Route`), and publishing that struct would
freeze a shape nobody should depend on. The public surface stays what it is plus
one entry - `RawHtml`, `Result`, `no_result()`, `run`, `Context.error`, and now
this.

This is not a new mechanism. veb's own suite has done exactly this by hand since
before this helper existed - `route_arguments_test.v`, `cors_before_request_test.v`,
`middleware_response_lifetime_test.v` and `controller_static_regression_test.v`
each build a `RequestParams` and call the dispatcher directly. Four call sites
reaching for the same private path is the argument for making it callable, not a
new feature.

`vlib/veb/vrender_test.v` covers the body, the 200, the 404 for an unknown path,
repeatability across calls, and - the load-bearing one - that `conn` stays nil.
A future change that started a listener would pass every other assertion in the
file, which is why it gets one of its own.

`examples/veb/static_export/` is a static site generator on top of it: an explicit
route list (a crawler follows links and silently skips pages whose only link is
generated at runtime), the URL-to-file mapping GitHub Pages serves directly, and a
count check so a page missing from `dist/` fails the build instead of shipping
short. `-prod` is used in the example for the reason it is used everywhere: a
template error becomes a build error.

Measured: `v test vlib/veb` is 17 passed / 24 skipped / 0 failed on Windows; the
24 skips are the ones needing a network or display, which CI runs. The example
exports 3 files and previews the same 3 pages through the listener.

* veb: validate and preserve listener-free request dispatch

* examples: correct static exporter invocation

* veb: validate render request context before dispatch

---------

Co-authored-by: metif12 <metif12@users.noreply.github.com>
Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-12 00:36:46 +03:00
Michael St.ClaireandAlexander Medvednikov 640dda22aa veb, tools: live reload over server-sent events, keeping page state (#30208)
* tools: make `v watch` build veb apps before restarting them

- Watch `templates/` and its subdirectories in veb projects. Templates are
  compiled in, but the compiler does not report them, so a change to
  `templates/layout/header.html` never triggered a rebuild.
- For veb apps, build the new executable while the old server keeps
  serving, and swap them only when the build succeeds, so the app is down
  only for the restart. A failed build leaves the old server running. A
  change during a build cancels it and starts a new one, after a 150 ms
  debounce. `--no-build-first` restores the previous behaviour.
- Write the build status (`building`, `failed` with the compiler output, or
  `ok`) to a file named by VEB_LIVERELOAD_STATUS in the app's environment,
  for veb's live reload. Print how long each build took.
- Stop the build and the program on SIGTERM and SIGHUP, as on Ctrl-C. They
  run in their own process groups, so they kept running (and kept their
  port) after `v watch` was terminated.

* veb: live reload over server-sent events, keeping page state

With `-d veb_livereload`:
- Replace the 250 ms polling with one Server-Sent Events stream per page,
  held in a shared hub (no thread per tab), capped by
  `-d veb_livereload_max_streams` (default 32). A keepalive ping every 15 s
  drops closed tabs.
- After a restart, fetch the page again and morph the DOM in place, keeping
  scroll position, focus, typed form values and page JS state. Pages from a
  POST, failed fetches and non-HTML answers reload instead.
- Follow the files of a StaticHandler: a changed stylesheet is swapped in
  place, other files update the page, with no rebuild.
- Relay the build status written by `v watch` (VEB_LIVERELOAD_STATUS): a
  toast for rebuilding/updated, and a panel with the compiler output when a
  build fails. `-d veb_livereload_no_toast` hides them.
- Reconnect every 250 ms; `-d veb_livereload_retry_max_ms` lets it back off.
- Keep the polling script behind `-d veb_livereload_polling`, for HTTPS apps
  and for proxies that block long-lived connections, with its interval set
  by `-d veb_livereload_poll_ms`. Deprecate the unused
  `Context.livereload_poll_interval_ms`, which could never be set.

* examples, docs: update the veb live reload instructions

- examples/vwatch/web_server: put `-d veb_livereload` after `watch` (the
  order before `watch` is currently dropped, see #30199), describe the new
  live reload, and drop `--only-watch=*.v,*.html,*.css,*.js`, which is the
  default for veb projects.
- v-veb skill: live reload is enabled by `-d veb_livereload` and applies to
  any HTML response ending with `</html>`, not only to `$veb.html()` in
  debug builds.
- veb blog tutorial: suggest `v watch -d veb_livereload run blog.v`, so the
  open page updates too.

* veb: reload changed scripts and page resources

* veb: preserve typed values on their original form controls

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-12 00:14:46 +03:00
Delyan Angelov d5ef5c3f82 examples: fix v should-compile-all examples/sokol errors and notices (#30195) 2026-10-11 23:24:25 +03:00
eris 694ad74e1b Merge commit from fork 2026-10-10 23:02:19 +03:00
Alexander Medvednikov e6634b0d45 examples: add Emscripten V WebAssembly playground (#29741) 2026-10-08 06:56:20 +03:00
diviocityandAlexander Medvednikov 89371e2b13 new module: x.progress (#29759)
* x3

* switched to term.printable_len(text)

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-08 02:55:50 +03:00
qpandqp 99c3b94d33 docs: fix grammar mistakes in markdown files (#29743)
* docs: fix grammar mistakes in markdown files

Correct `its`/`it's`, verb-noun agreement, article and number
agreement errors in V-owned documentation.

vlib/x/encoding/asn1/DOCS.md: fix the bulk of the issues, including
`Its` -> `It`/`It is`/`This is`, `two form` -> `two forms`,
`four class` -> `four classes`, `a extra` -> `extra`, and
`you hope an universal type` -> `you need a universal type`.

Other files: single-grammar fixes in chacha20poly1305, ttf,
net/jsonrpc, vpbgen, bench/vectors and examples/templates READMEs.

Vendored thirdparty/ files and historical changelog entries are left
untouched, since the former are external code and the latter are
verbatim commit records.

No behavior change. `./v check-md` passes on all changed files.

* fix review feedback

---------

Co-authored-by: qp <168933756+gabytz777@users.noreply.github.com>
2026-10-08 00:57:06 +03:00
Mahdi ramezaan zaadeandAlexander Medvednikov 3bfe757356 pbgen: emit files that are already v fmt clean (#29570)
* pbgen: emit files that are already v fmt clean

A generated file that the formatter rewrites is a bug in the generator, not a
quirk of the generated code. Two things in the output were not what `v fmt`
produces, so every file this tool wrote reformatted itself the first time anyone
ran the formatter -- a `v git-fmt-hook`, a `v fmt -w`, an editor -- and that
reformat then landed as a diff nobody had written, in whatever repository held
the generated file.

`emit_message_struct` indented `pub mut:` by one level and its fields by two.
`v fmt` puts `pub mut:` at column 0 and its fields one level in, so the whole
struct body shifted on the first format. `write_generated` also ended on the
blank line an emitter naturally arrives at, where `v fmt` leaves exactly one
trailing newline.

Both are fixed at the source rather than by formatting after the fact. The
second one is trimmed in `write_generated` because every output path goes
through it, which also covers the `-grpc` output and the stdout case is
unaffected since it does not write a file.

`examples/grpc/README.md` loses its `v fmt -w` line as a result: there is no
format step to remember any more. Verified with a compiler built from this
tree, running the documented command and confirming the output survives `v fmt`
byte for byte.

The negative control: with these two changes reverted, the same command's output
does not survive `v fmt`.

test_write_generated_replaces_its_own_output expected the written bytes to equal
its input exactly, which the trailing-newline contract changes; it now asserts
the normalised form, and test_write_generated_normalises_trailing_newlines covers
the three trailing-newline shapes an emitter produces.

v -silent test cmd/tools/vpbgen/    2 passed, 2 total

* pbgen: keep enum and service output formatter clean

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-05 23:27:24 +03:00
Alexander Medvednikov fa13b54bf4 examples: restore pendulum verbose progress helper (#29561) 2026-10-05 21:49:53 +03:00
Mahdi ramezaan zaade fb9d9ce68e examples/grpc: generate the kv codec with v pbgen instead of hand-writing it (#29481) 2026-10-05 08:52:32 +03:00
Alexander Medvednikov 70ee511b35 os: deprecate command string APIs and migrate callers to argument arrays (#29365) 2026-10-03 15:55:41 +03:00
Alexander Medvednikov 3388712441 compiler: fix macOS CI reflection and nested interface regressions (#29356) 2026-10-03 09:59:43 +03:00
whi 3a4d9d3ce6 mcp: add support for protocol revision 2026-07-28 (stateless core) (#29308)
Review findings fixed and validated on the verified source head.
2026-10-02 15:01:36 +03:00
Mahdi ramezaan zaadeandAlexander Medvednikov 8b92b156f6 net.grpc: add an experimental gRPC client and server (#29285)
* net.grpc: add an experimental gRPC client and server

Ports the gRPC runtime from we-be/grpc.v into vlib as net.grpc, closing
most of vlang/v#5017. It covers the wire layer only: 5-byte message
framing, the grpc-status/grpc-message terminal status, per-call
metadata, a native gRPC client and server over net.http's HTTP/2 stack,
and a Connect-protocol server for connectrpc.com clients.

Messages cross the wire as []u8, so the module stays codec-agnostic and
pairs with any protobuf runtime (protobuf.v and vpbgen remain external
vmodules).

Two fixes against the ported original:

- Client.do_call must set FetchConfig.enable_http2. net.http reverted
  HTTPS clients to HTTP/1.1 in #28996, so without it the client silently
  degrades and never speaks gRPC. The doc comment claiming net.http
  negotiates h2 on its own is corrected.
- Server wrappers now forward in_memory_verification, so TLS can be
  driven from in-memory PEM strings.

Client and both servers also gained verify/cert/cert_key pass-through,
needed because V has no client-side h2c: a loopback gRPC round-trip has
to go through TLS.

Listed in vlib/.vdocignore as experimental. Streaming stays buffered
(one POST per direction) because net.http's Handler is one request in /
one response out.

* examples: add a net.grpc key-value example

An etcd-lite key-value service showing net.grpc end to end: all three
RPC shapes (unary, server streaming, client streaming), a typed
StatusError crossing the wire as a grpc-status trailer, a call carrying
a deadline and request metadata, and response/trailer metadata.

net.grpc is transport-only and moves []u8 payloads, so the example owns
its codec: kv/codec.v is a hand-written proto3 encoder/decoder for the
schema in kv.proto, with tests. That keeps the example free of external
dependencies, which v build-examples needs since it walks every
examples/**/*.v file that declares `module main`.

The TLS certificate is required rather than optional: gRPC is HTTP/2-only
and net.http negotiates h2 only for https, so even a loopback round-trip
has to speak TLS, as V has no client-side h2c path.

* net.grpc: preserve explicit status and ordered request metadata

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-10-02 12:54:26 +03:00
Alexander Medvednikov 33e3defaac all: fix the macOS CI failures after #29162 (#29180) 2026-10-01 02:13:14 +03:00
David LegrandandAlexander Medvednikov ca7389b7d9 net.http.signature: add HTTP Message Signatures (RFC 9421) module (#27113)
* net.http.signature: add HTTP Message Signatures (RFC 9421) module

* net.http.signature: pad ECDSA private scalar to curve width when parsing PEM

* net.http.signature: strip default ports from @authority per RFC 9421 §2.2.3

* net.http.signature: reconstruct absolute @target-uri for origin-form requests

* net.http.signature: gate the tests on OpenSSL, like the example and crypto.ecdsa

* net.http.signature: preserve canonical request inputs

* net.http.signature: harden request serialization

* net.http.signature: match transmitted request values

* net.http.signature: align request wire semantics

* net.http.signature: cover effective wire fields

* net.http.signature: validate signing inputs

* net.http.signature: finalize effective message fields

* net.http.signature: validate Ed25519 verification keys

* net.http.signature: validate effective responses

* net.http.signature: reject ambiguous signed messages

* net.http.signature: validate stable wire fields

* net.http.signature: handle remaining wire forms

* net.http.signature: canonicalize repeated inputs

* net.http.signature: validate structured metadata

* net.http.signature: preserve verified message values

* net.http.signature: align status and list parsing

* net.http.signature: tighten parameter parsing

* net.http.signature: preserve extension and empty values

* net.http.signature: preflight transport header changes

* net.http.signature: preserve covered cookie fields

* net.http.signature: trim derived host authority

* net.http.signature: enforce verification coverage

* net.http: preserve wire authorities

* net.http.signature: validate covered fields

* net.http.signature: preserve effective field values

* net.http.signature: enforce verification time bounds

* net.http.signature: align proxy and h2 coverage

* net.http.signature: protect response body defaults

* net.http.signature: protect request body defaults

* net.http.signature: reject invalid response status

* net.http: reject unframed trace bodies

* net.http.signature: load ECDSA public keys from raw coordinates

* net.http.signature: rename a local that collides with hash.crc32's q const

* net.http.signature: make the default digest policy independent of the received body

* net.http.signature: refuse to synthesize a forbidden Content-Length

* net.http.signature: run the tests on the default crypto backend

* net.http.signature: make the quick start verifiable

* net.http.signature: reformat structured_field.v with the current vfmt

* net.http.signature: sharpen the Content-Length diagnostics and document their limits

* net.http.signature: check header capacity at every step of the signing mutations

* net.http.signature: opt the HTTP/2 coverage tests into enable_http2

HTTPS requests default to HTTP/1.1 since #28996, so the tests for covered
fields that HTTP/2 negotiation would change have to enable HTTP/2 themselves.

* net.http: pass the remote address in the new h2 server test

serve_h2_conn takes the remote address since master's HTTP/2 server changes.

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-09-29 17:35:23 +03:00
David LegrandandAlexander Medvednikov 1eb5373de0 encoding.cose: add COSE (RFC 9052) and CWT (RFC 8392) modules (#27111)
* encoding.cose: add COSE (RFC 9052) signing and MAC module

* encoding.cwt: add CBOR Web Token (RFC 8392) module

* encoding.cose: harden header validation

* encoding.cose: use the received protected bytes in Sig_structure/MAC_structure (RFC 9052)

* encoding.cose: harden key and message validation

* encoding.cose: validate recipient and critical metadata

* encoding.cose: validate key metadata invariants

* encoding.cose: validate private key consistency

* encoding.cose: validate message header metadata

* encoding.cose: preserve unsupported key constraints

* encoding.cose: enforce HMAC and claim constraints

* encoding.cose: bind external algorithms safely

* encoding.cose: enforce decoded header consistency

* encoding.cose: validate low-level message encoding

* encoding.cose: validate direct recipients before encoding

* encoding.cose: harden decoded metadata handling

* encoding.cose: disambiguate detached verification

* encoding.cose: commit message state transactionally

* encoding.cose: validate key and audience representations

* encoding.cose: normalize elliptic key encoding

* encoding.cose: bind low-level verification payloads

* encoding.cose: enforce attached payload and point widths

* encoding.cose: enforce direct recipient constraints

* encoding.cose: validate private key codec inputs

* encoding.cose: validate algorithm and date ranges

* encoding.cose: validate Ed25519 key consistency

* encoding.cose: reformat headers.v with the current vfmt

* encoding.cose: load EC public keys from raw coordinates

* encoding.cose: reserve modelled header labels in extra entries

* encoding.cwt: reserve standard claim labels in extra claims

* encoding.cose: correct scope statements in the module docs

* encoding.cose: validate text content types (RFC 9052 3.1)

* encoding.cose: reformat the remaining files with the current vfmt

* encoding.cose: use a zero-length structure bucket for an empty protected header

* encoding.cose: run the bundled cose-wg vectors

* encoding.cwt: run the bundled RFC 8392 vectors

---------

Co-authored-by: Alexander Medvednikov <alexander@medvednikov.com>
2026-09-29 17:35:16 +03:00
Alexander Medvednikov 65dcab3605 driver: remove the -skip-unused flag, since it is the default (#29124)
Skipping unused functions has been the default for a while, so
`-skip-unused` was a no-op. Remove it from the driver, so passing it now
reports an unknown option, and drop it from `v complete`, the tests,
examples, tools and READMEs that still passed it.

The `-skip-unused` entry in `v help build` is replaced with one for
`-no-skip-unused`, the remaining way to opt out, which had no entry.
2026-09-29 01:38:43 +03:00
Alexander Medvednikov 713d1d75fa json: remove the cJSON based json module; json2 replaces it (#29112) 2026-09-29 01:18:53 +03:00
Alexander Medvednikov 49cb1fea28 examples, docs: use 64-bit registers in the amd64 inline assembly example
`int` is 64 bits wide on amd64, so the `r` constraints bind 64-bit
registers, and `mov eax, a` reached the assembler as `mov %rax, %eax`.
tcc accepted it, but gcc and clang reject the operand size mismatch
(`build_examples_clang` failed on examples/asm.v).
2026-09-28 08:00:30 +03:00
Alexander Medvednikov d36d94ae8b v3: fix remaining macOS CI failures 2026-09-24 18:50:22 +03:00
diviocity 5c1237543f cleanup: replace C.NULL with unsafe { nil } (#28916) 2026-09-24 00:30:30 +03:00
Alexander Medvednikov 58c7231793 all: vfmt 2026-09-17 10:47:56 +03:00
Alexander Medvednikov 928f574b61 v3: remove the virtual modules/ directory (#28575) 2026-09-14 16:36:59 +03:00
Alexander Medvednikov 2a7447b5e5 compiler: remove V1 entirely; make V3 the default compiler in vlib/v F (#28556) 2026-09-13 07:43:00 +03:00
David Legrand 1d242ad6a1 crypto.scram: add SCRAM (RFC 5802 / RFC 7677) client and server (#28142) 2026-09-08 09:29:51 +03:00
Alexander Medvednikov c417ec75bc js: avoid invoking native prototype accessors (#28357) 2026-09-05 03:06:33 +03:00
Alexander Medvednikov f8b44df1d6 ci: repair master regressions and formatting (#28317) 2026-09-03 16:57:46 +03:00
Alexander Medvednikov 25f5ced70b v3: make int 64-bit on 64-bit targets (i64), 32-bit on 32-bit (i32) (#28293) 2026-09-03 04:08:21 +03:00
Alexander Medvednikov 6db2cdfb59 ci: fix remaining V3 default compiler failures 2026-08-26 14:27:19 +03:00
Alexander Medvednikov e40321b45a ci: fix V3 Linux rebuild regressions 2026-08-26 07:51:02 +03:00
Alexander Medvednikov 3a2fc051f1 examples: match wkhtmltopdf integer ABI 2026-08-26 00:17:38 +03:00
Alexander Medvednikov c84f86aa03 ci: fix cross-platform regressions after V3 rollout 2026-08-25 14:11:47 +03:00
GGRei 73ec30ed71 multiwindow/gg: add cross-platform multiwindow services and lifecycle safety (#28134) 2026-08-25 02:26:19 +03:00
Alexander Medvednikov 1a1d7f09d5 v3: make V3 the default compiler on Linux, report fallback bugs, and enforce it in CI (#28131) 2026-08-24 22:13:01 +03:00
Alexander Medvednikov 41972ab6b9 v3: fix macOS default compiler CI regressions (#28080) 2026-08-16 10:41:30 +03:00
Alexander Medvednikov dea93f120b v3: make V3 the default compiler on macOS and expand compatibility (#28007) 2026-08-03 11:38:56 +03:00
Alexander Medvednikov 432da693ab ci: stabilize macOS password input test 2026-07-30 06:41:02 +03:00