Skip to content

Bit 0.34.0

Choose a tag to compare

@mdwekat mdwekat released this 01 Oct 01:53
· 1834 commits to 6083336c1a64749e02635d468e21e3249f376400 since this release
3b63c82

Bit 0.34.0

Breaking changes

  • The compiler rejects programs it used to accept:
    • E0058: a wrong number of type arguments at any type position (let x: Pair<i64>, Plain<i64>{...}), and an explicit type-argument list on a call whose length does not match the function.
    • E0050, E0041, E0063: wrong positional arguments to a static method call.
    • E0300: reading a relation field the compiler cannot prove was loaded. The error names where to add .with("rel").
  • from is a contextual keyword. It can be used as an ordinary name everywhere except in import ... from.
  • pkg/orm 0.2.0:
    • db.table<T>() repositories;
    • Laravel-style migrations (Migration, Schema, batch migrate/rollback);
    • orderBy(column, Dir.Desc);
    • relations that load themselves.
  • pkg/kv 0.2.0: open(path) and store.collection<T>().
  • pkg/jobs 0.2.0: the Locker interface has two new methods, window() and serverNowNs().

Highlights

  • Named arguments work in every call shape, including generic functions, generic methods, static methods called through a written instantiation, and generic interface values.
  • Generic class constructors:
    • Pair<i64, string>(7, "s") builds the instantiation, and Pair(7, "s") infers the type arguments.
    • Static methods work through the bare class name (Pair.make(7, "s")).
  • pkg/jobs cron scheduling (q.schedule("0 2 * * *", Job{}, missed = Missed.RunOnce, tz = "America/New_York"), q.every(15 * Minute, Job{})):
    • a tick is missed only when it is over a minute late, and every dropped tick is logged;
    • daylight-saving transitions follow Vixie cron's rules;
    • catch-up work is bounded however far behind the schedule is;
    • a wall clock stepped backwards re-anchors the schedule;
    • an instance whose clock disagrees with the database clock fires nothing;
    • bad options and RunAll caps fail at registration.
  • std/time applies each zone's TZif footer rule after the last listed transition, so daylight saving continues past 2037. zone() rejects a footer that contradicts the zone's last transition.
  • Runtime: a resumed task's saved registers are cleared, so the GC no longer keeps garbage alive through them.
  • std/http: readMessage allocates 4 objects per request instead of 6.
  • pkg/yaml:
    • duplicate detection for collection keys takes amortised constant time (20,000 keys: 56.6G to 1.14G instructions);
    • alias-repeated bytes count against maxDocumentBytes.
  • Package commands: bit <words> runs a package's cmd/<words>/main.bit.

Fixes

  • fix: honor a defaulted parameter on a generic class's method (b0c35b4)

Compiler

  • Delete BIT_GENERIC_EXPLODE, BIT_DCE_PARAMS and BIT_DCE_METHODS (b1b8f04)
  • optappendfield: a call_iface is calm when every method its id reaches is; pow joins the local runtime calls (ea2c060)
  • optappendown: the first store of a rule 2 chain on an owned field is no escape; extendKeyPath's second path.rest append runs in place under BIT_APPEND_FRESH (c090a29)
  • @json class needs no import from std/json (E0142 default-retired) (4c205d2)
  • Integrate with: table-row errors are E0178/E0179 (E0174/E0175 belong to @collection) (f899ef9)
  • compiler: lower a synthesized static (__collectionName/__tableName/__fromRow/__columns/__values) only when reached (63aa1eb)
  • compiler/lower*.bit: a deferred synth static reserves no FuncId (cd6286e)
  • pm: resolve a local-path dependency's own local dependencies transitively (635ac87)
  • lowermethodtable.bit: follow moduleReservedCount and emitStaticMethodCall to their files (7b096d4)
  • jsonDecode resolves when T is a generic class's own type parameter (e53646e)
  • orm: fix relation synthesis to survive isolated @table fixtures (b51ee48)
  • Prune __tableAttrs and __loadRelation like the other synthesized statics; checkerdiag count note shortened under the file limit (dfd16e8)
  • Fix catch binder mistyped as generic error on a this-rooted method call (f78822c)
  • R1: auto .with() for same-function relation reads (e2e4cae)
  • Add internal lockRoot to loadProjectCached/buildIr (5abee72)
  • Bundle buildIr's option flags into BuildOpts (bd22020)
  • bundle vStmt's (result, brk, loop, fallibleTy) into VCtx, drop validatestmt.bit's E0202 debt (87f4aa8)
  • R2: relation auto-loading follows rows across function parameters and return values (04498a9)
  • M1b: package-command dispatch, cmd//main.bit is bit <words> (d17f472)
  • Fix the pre-push reds: format pkgcmd files, inline clicmd's 7-param helper, drop a private path and an em dash from orm's migrate doc, declare 6045-closure-tuple-oracle-declines (fe3f158)
  • relation auto-loading follows rows across module boundaries and named arguments (R2b) (c590cd3)
  • drop .claude/ path citations from two R1 header comments (440f67e)
  • orm: create @manyToMany join tables via synchronize (f03a9a1)
  • fix: register JoinDesc synth words, tolerate a class with no __manyToManyJoins, format+doc it (3180cc5)
  • listBitFiles: skip a directory whose name ends in .bit (7d1bbb8)
  • fix: trace a match arm's payload binder back to its scrutinee (E0300) (9b607ef)
  • relationautoerr.bit: cite SPEC §10.5, not a private note (34be7c5)
  • retire E0218 relation-unloaded-read, superseded by E0300 (8fae6f8)
  • Repoint comments from the deleted lintrelation.bit to relationfieldread.bit (e7602b8)
  • pmfetch: vanity deadline = connect+TLS+HTTP budget + std/net resolveBudgetMs (4ab1a0c)
  • compiler: split relationauto.bit, relationautoholder.bit, relationautoerr.bit by responsibility (pure move, ) (4397eb0)
  • E0058 at every type position and on explicit call type arguments (1629584)

Runtime

  • runtime/net: close the DNS socket fd directly, not through pdOpen-tracked netClose (49e3712)
  • runtime/net: parse IPv6 nameservers and walk every resolv.conf entry (2913c3b)
  • runtime/net: dial IPv6 nameservers and try every one in order (aacdf52)
  • runtime/net: repoint DNS comments at the files that declare the symbols (f999dda)
  • net: reset a resolv.conf fd's poll-descriptor state before netReadSock reads it (532d572)
  • Rename locals, params and import aliases that shadow predeclared names (E0048) in compiler, runtime, pkg/mysql, pkg/orm (01f5dd2)
  • zero a task's saved callee-saved words once it resumes, so class 7 stops rooting a stale context (40086b2)

Standard library

  • quic: broadcast loop exit so a stream cmd sent after teardown fails fast (4e7998d)
  • std/http: bound the response write with a deadline (b459593)
  • fix: pin the migrate/rollback lock's whole locked region to one connection (fedafe7)
  • Reword stdlib/sql/desc.bit's plan citation and drop its temporary no-private-path allowlist entry (2a8ef5a)
  • std/time: apply the TZif footer rule after the last transition (758dfc8)
  • readMessage stores common method/version tokens as literals; optstrbox admits a callee's parameter-passthrough ret (ed931fc)
  • time: footer must agree with the last transition; n-form all-year DST (86e2c60)

Tests

  • Delete BIT_MAPLIT and BIT_STATIC_METHODS (0b74df6)
  • benchgate: follow BIT_GC_MIN_KB's default to runtime/ABI.md:1957 (489f861)
  • Fix: close method tables over instantiations minted during lowering (53acd3b)
  • declare the 6244-json-attr-implicit-insert oracle-lag signature, add a golden fixture, run test-web-guides-app (3cda774)
  • golden census: dRun 560 after and each added a run case (8455e68)
  • Format run_generic_iface_late_inst.bit; no em dash in docs/stdlib/json.md (d6a4152)
  • Add @collection("name") class attribute, synthesizing __collectionName (468fb1b)
  • sqlValue - a plain value as a std/sql Value (7fec04c)
  • compiler: @table gets static __tableName/__fromRow/__columns + instance __values (4ee362d)
  • Make from a contextual keyword (a5c9ac4)
  • orm: default id primary key, compile-time Repo key check, no panics in repo.bit (1234a9e)
  • fix spec/SPEC.md line-citation drift from the own insertions (test-fmt-citations) (d8fce6e)
  • one orm orderBy(column, dir: Dir = Dir.Asc), enum-variant param defaults, Repo column check (97a6c0e)
  • compiler: bind Self to the type param, not the interface, in a T.m() static call (ad1f5dd)
  • pkg/orm: Repo soft delete and bulk writes, @timestamps filled (7f61ea0)
  • a Value-typed parameter coerces any sqlValue-accepted argument (824be36)
  • @table classes need no std/sql import: E0150 retires like the E0142 (2fdfd5b)
  • Format check_orm_repo_link_bad_relation.bit (f15cb7d)
  • orm: @belongsTo/@hasOne singular relation fields satisfy Tabled (edc7b8c)
  • orm: find() eager-loads with(), after() chains without ? (5cbcebd)
  • Fix citations drifted by: SPEC.md:4179 -> 4178; lintrelation.bit's anchor API is gone (e986f4e)
  • Widen parameter defaults to any expression, not just literals (669f36f)
  • Allow a discarded-statement catch block to fall through without a value (bc930a2)
  • Fix catch binder mistyped as generic error on this.field.method() inside init (b1df936)
  • Synthesize std/sql's __tables() table registry at the IR level (faf2188)
  • Validate arity/types of delete/close/panic/assert call sites (1698458)
  • Fix: a fallible closure result never reached lowering unwrapped (d4d15a9)
  • move the R2b live fixture out of pkg/orm into tests/ (778fc3b)
  • O4: pkg/orm/cmd/migrate/gen.bit + bit migrate live e2e (597a900)
  • live-gate harnesses: sweepOrphans no longer kills a peer's live containers (3c0a661)
  • allow an identical import repeated across a directory module's files (cec5722)
  • Fix: reject an empty []/{} literal against a known non-collection type at check time (4711b25)
  • census: dRun 585, re-derived off disk after and each added a run case (d8b6c23)
  • O5: bit make migration writes migrations/_.bit (f95fd06)
  • fixup: bit fmt tests/bit/noemdash.bit (test-fmt-testsbit was red) (27f08fd)
  • R3 fail-closed build error (E0300) for an unprovable relation read (8b9a28b)
  • fix checker case .expected paths to the bare filename the harness uses (207659c)
  • fix two spec/SPEC.md:4187 citations drifted to :4226 by the new SS10.5 section (35e6fcf)
  • Add bit up/bit add vanity-resolution parity regression test (0c89f26)
  • fmt: keep protective parens around a statement-leading map literal (589d80b)
  • runtime/net, tests: parameterize netResolveHost's port, add DNS fallback + IPv6 test coverage (cd96421)
  • tests/stress: move DNS fallback test to its own program, waive under BIT_GC=stress (98cb54a)
  • tests/stress: point the netdnsfallback waiver at for the blocking-@nosplit design (fdcd6fb)
  • Recognise pkg/orm by the module an import resolves to, not by path text (efcbe94)
  • lint: count attributes, field defaults, trait bodies and use as import uses (b50cf3a)
  • Named arguments bind on generic callees and type-parameter receivers (SPEC §12.11, ) (f53d5a5)
  • Named args: keep seedArrowExpectedGeneric at complexity 10; move SPEC line citations for the -3 line shift (8713293)
  • net: DNS lookups park on the netpoller instead of blocking a thread (5d3c848)
  • netdnsfallback: outlast client-side rendezvous stalls with the stub's recv bound (c8840ff)
  • Relations: @manyToMany loads or E0300, explicit .with proves escaped rows, untraceable call arguments fail (8aa4aca)
  • Push-gate fixes: document resolveBudgetMs and multi-nameserver resolve, bit fmt a lint case, staticmethods expects the named args on a bound generic (023615c)
  • Live harnesses fail, not skip, when Docker is unavailable (d1ca86d)
  • Named arguments: seed arrow arguments by the slot their name fills; static calls through a written generic instantiation (SPEC 12.11, ) (5f9096d)
  • SPEC 12.11: named arrow arguments, static calls through a written instantiation, generic interface values; pay the checkgeneric.bit E0202 debt line (1f61dd7)
  • Re-point the three spec/SPEC.md line citations the 12.11 paragraph shifted (c82106a)
  • Close four relation-proof edges: closure-captured params, spread calls, element writes, assign-before-read (1b1c7f2)
  • Generic class init through a written instantiation constructs the instantiation, not the template (37dadc9)
  • Re-point the three spec/SPEC.md:4253 citations the 10.4 constructor paragraph shifted to 4263 (1218da4)
  • E0300: stores into a parameter's rows, omitted-parameter defaults, raw-SQL hints (42e93d3)
  • re-point SPEC citations, give the default-literal test helper a function caller, cite RelationAutoHolders by its symbol (603830c)
  • a generic class construction infers its type arguments from init's arguments (8424932)
  • a static method called through a generic class's bare name infers the class's type arguments; own-generic statics are recorded in the ledger (5d7be4a)
  • pin the bare-name static gap case's diagnostics with the harness's path spelling (bare filename) (7c22268)
  • check_type_arg_count_positions: bit fmt the case and regenerate its .expected source excerpts (08fa2bb)
  • Clear the three E0098 raw-string warnings in s3live.bit, pkgdocsgate.bit, editors/vscode/sample.bit (b4f0f25)
  • Rename stress-test locals that shadow len/cap (E0048) (c49c156)
  • Add test-no-warnings: fail on any compiler warning in every tracked module the tree compiles (9ba526a)
  • jobslive: serverNowNs against real PostgreSQL, a 4-years-ahead instance fires nothing, hand-clock proofs answer the skew check from their clock (6e0bd57)
  • checker: judge a static call's positional arguments (E0050/E0041/E0063) (ee7314f)
  • relations: E0300 hints that can be followed (c2db56e)
  • relations: Option.None stores no rows, so a return of it is no writer (976d41a)

Documentation

  • pkg/auth requires web ^0.8.0; install lines and examples name the 0.33.0-era package releases (080e358)
  • web course: bit add auth prints the auth/v0.3.0 commit (609da77)
  • pkg/kv: open(path)/store.collection(name)/db.tx closure, i64 ids, @json values (5f6caf6)
  • pkg/kv: no-argument store.collection() via the T.__collectionName() (acce5da)
  • pkg/kv: rewrite README.md and docs/* to the new open()/collection() API (004656a)
  • pkg/orm: add open(url)/Db/TxHandle/Tabled and Repo (55b4e1d)
  • pkg/orm: live-proof test for open/table/Repo, fix transitive postgres+mysql deps in test harnesses (d3173a3)
  • docs/stdlib/sql.md: no em dash (468c81d)
  • orm live proof uses the target's own from/to names (940c59a)
  • course app lock picks up orm's own postgres/mysql dependencies (bit up) (01fb51d)
  • web guides: rewrite ch08 querying-and-crud to the new orm core (9eab033)
  • orm: keep orderBy/orderByDesc as two methods (compiler-checked direction) (97f4c2b)
  • kv: collection(name = "") instead of a variadic name; census dRun 566 (f1484d7)
  • pkg/redis: rename fromKey back to from now that from is contextual (4f99abc)
  • orm: Repo.lock()/after()/@version (7b97922)
  • orm: db.exec(sql, ...values)/db.query(sql, ...values) on Db and TxHandle (12a0a6a)
  • orm: synthesize __loadRelation, add Repo.with/link/unlink (1b022b5)
  • pkg/orm: reset Repo chain state per terminal, find() hides soft-deleted rows (2d7b162)
  • pkg/orm: make Repo chain methods immutable, never mutate the receiver (4bb45fd)
  • pkg/orm: exercise (find hides soft-deleted rows) in the live proof (3aefdf7)
  • pkg/orm: fix the live proof addition (raw-string backticks, E0067) (b3d3d61)
  • orm: fix Tabled gate for classes declared inside pkg/orm; drop the link/unlink stub (304e9f6)
  • orm: one next() copy for every chain method (with() and dialect no longer dropped), plain Value parameters, trimmed stale comments (6f8e3b6)
  • orm raw SQL live proof: the catch on exec yields a value (5837c8b)
  • Web course: convert chapters 10-12 to the new orm core (db.table()) (1fd94b6)
  • orm: tx.table().lock() is compile-time-only, one LockMode option, live lock/after/version proofs (7d23b53)
  • orm: many-to-many link/unlink and with() eager-load, compiler-synthesized __linkRelation (82c3fed)
  • pkg/mysql: decode COM_QUERY (text protocol) rows by column type, not always Value.Text (aee540c)
  • pkg/mysql: fix live.test.bit's checkOne to read select 1 as Value.Int (0a0b226)
  • pkg/web/guides: rewrite chapters 09 (relationships) and 15 (transactions) to db.table() (4a36e24)
  • orm: add terminal Repo.count(): int!, forward from TxRepo (f3d0391)
  • pkg/orm/docs: rewrite README, query, write and locking to the open/table/Repo API (b9f61d1)
  • pkg/web/guides: revert chapter 09, fix chapter 15's Article to drop @belongsTo (bdad81a)
  • pkg/orm/docs: move relation/manytomany/softdelete/timestamps/errors/testing/naming to the new API (9031773)
  • pkg/web/guides: chapters 09 (relationships) and 14 (pagination) onto db.table() (6b2d6c7)
  • pkg/orm/docs/relation.md: add @belongsTo now that fixes db.table() (05816cd)
  • orm: comments cite the pages keyset/patch content moved to (7b0d00b)
  • pkg/web/guides/09-relationships.md: drop the duplicate 'Db' import (b9392ed)
  • pkg/web/guides/inkwell/articles.bit: fix stale version.md citation (fdbc6f9)
  • pkg/web/guides/09-relationships.md: canonical field formatting on Article (712e175)
  • pkg/orm: split repo.bit by concern (f4f43f5)
  • pkg/web/guides/inkwell: rewrite the app onto the new orm core (d3300f4)
  • orm: remove old find/save/Patch/SoftQuery/forUpdate API (c1430f8)
  • orm docs: fix raw.md to use Db (Data lacks the exec/query/tx sugar) (c7ff74c)
  • orm docs: raw.md's Post class matches canonical bit fmt (attribute on its own line) (4b5d429)
  • orm: give testdrivers/testenv/testfields.test.bit a real test each (E0216) (a4c819f)
  • orm: fix testdrivers.test.bit's new test - wrAdapter must supply every Account column (b387ba6)
  • pkg/orm: drop the migration file generator, keep its diff helpers (9c02629)
  • Fix the pre-push reds from: stdlib docs for setWriteTimeoutMs, TableSchema and __tables; vCatchBind back under complexity 10; 6255 explains an empty oracle types dump when the tree shows a synthesized row mapper (7f475e9)
  • pkg/orm: Laravel names on the schema builder (cbb4e19)
  • pkg/orm: Laravel-shaped Migration interface, Schema builder, batch migrate/rollback (85aaaff)
  • orm: open(url, Options{ synchronize = true }) adds missing tables/columns (85f0410)
  • pkg/orm: migrateMain(files, args): int - migrate/rollback/status CLI (O3b, ) (30e0c08)
  • R2b live acceptance - cross-module + named-argument relation auto-load (281505e)
  • Fix standing red on main: pkg/orm/migratecli.bit's renderDialectFor duplicates db.bit's (4409685)
  • O3c: MySQL migrations take GET_LOCK('bit_migrate', -1)/RELEASE_LOCK (2a2b78f)
  • O3c: deterministic fake-executor proof that RELEASE_LOCK fires on a failing MySQL migration (258b8f9)
  • pkg/orm: migrations ledger's primary key column is dialect-aware (c37acdf)
  • add live proof that synchronize creates a @manyToMany join table (c0110f6)
  • nested relation loading, Repo.with("author.posts") (4a30297)
  • O6: move Inkwell's schema to migrations/*.bit, drop runMigrations and the second connection (9f95389)
  • pkg/orm requires mysql 0.2.0: 0.1.1's text protocol returned every column as Value.Text, so the migrations ledger's batch read back as text (2edd4ab)
  • fix: remove private .claude/ workspace paths from public bit repo, gate against new ones (8a82ab2)
  • Ignore .bit/, the per-project package-command cache (SPEC §17.7) that bit migrate writes; drop two em dashes from docs/stdlib/sql.md (44631eb)
  • spec/SPEC.md: drop a stray .claude/ path citation from the @collection section (62ff4b3)
  • pkg/orm/relationauto.test.bit: bit fmt (4b0a965)
  • remove bare private-note citations, gate dangling .md tokens (28da956)
  • O7: rewrite pkg/orm migrate/schema docs and course part 07 for Laravel-style migrations (0b9326c)
  • yaml: hash mapping keys for duplicate detection instead of a quadratic scan (1fdf580)
  • pkg/jobs: add a 5-field cron parser with a table test, including DST edges (bad04d3)
  • pkg/jobs: add Missed, ScheduleOptions, Locker and the trigger/catch-up core (bba8ced)
  • pkg/jobs: Queue.schedule/every, scheduler loop, per-tick leases, PostgresLocker, live gate, cron docs (d05dec3)
  • pkg/jobs docs: import Queue in the cron page (f8a1067)
  • pkg/jobs cron: read each schedule's last fired tick back from the lease table on start (c893900)
  • pkg/jobs cron: a tick reached later than one pollInterval is missed, even alone; Skip now skips it (e4b78d0)
  • jobs: reject bad Options, RunAll caps and late schedule() at registration (d768a40)
  • jobs: DST-correct cron ticks (Vixie rules), nextAfter is always strictly after (76a6759)
  • jobs: a cron tick is missed only when over a minute late or after the next tick is due; log dropped ticks (53b5aa1)
  • jobs: open refuses a locker that keeps fewer than 1 lease row; newPostgresLocker no longer clamps keep (bd19bbf)
  • pkg/jobs: catch-up walks back from now, bounded by the policy cap (bbfc71e)
  • yaml: collection keys are found by an exact byte encoding, not a yamlEqual scan of every earlier key (361b0a3)
  • jobs: a schedule whose next tick is ahead of a corrected clock re-anchors, and a future lastTick is ignored (f47cec0)
  • pkg/yaml: charge alias-materialized string bytes against maxDocumentBytes (cad3678)
  • jobs: PostgresLocker prunes lease rows by arrival, not by tick (7daba75)
  • cron's once-per-day offset assumption is a checked invariant (1631901)
  • pkg/jobs: an instance whose clock disagrees with the database clock fires no scheduled tick (293f1a8)

Build and tooling

  • Repin stage0 to 0.33.0 (868d785)
  • Retire the oracle-lag signatures (eb985df)
  • Declare oracle-lag signatures (diags, types); fuzzdiff consults diags signatures (09533c5)
  • signatures: no single quotes inside the awk program (46190e6)
  • signatures: an empty tree dump is one empty line (bc63eb7)
  • Declare oracle-lag signatures: from lexes as ident (tokens), renamed token and reserved-word blocks (diags), from bindings (types) (354a8d3)
  • Declare the default-id oracle-lag signature (ir/iropt opcode deltas) (0802ee1)
  • Declare oracle-lag signatures: Self rebound to T (types), inserted instantiations for the one closure fixture (ir/iropt) (71b1c2b)
  • tools/build, tests/bit: add test-package-orm-live gate (10d7a56)
  • 6045-closure-tuple-oracle-declines: the oracle drops functions and truncates the broken closure, it does not dump nothing; match every oracle func header kept, tree adds functions (182ac22)
  • selfhost-fuzzdiff: compare capture files with cmp, re-confirm a divergence (531522d)
  • test-book-ink-live: run docs/book/ink's PostgreSQL test against a throwaway container, failing without Docker (b9a738f)
  • diff signatures: generic constructors typed and lowered as the template by the 0.33.0 oracle (3b66b6c)
  • diff signatures: extend 6363-generic-ctor-type-args to the run_generic_class_static_{make,own} cases (304e3ef)
  • gates: run package tests at BIT_WORKERS=4 so race tests are not vacuous (4bf740e)

Benchmarks

Artifacts

Published for aarch64-linux, aarch64-macos, x86_64-linux and x86_64-windows.
See dist/README.md for the full target table, the archive layout,
the required BIT_STDLIB/BIT_LIBBITRT environment, and the
SHA256SUMS format.

Verify a download before running it:

sha256sum --check --ignore-missing SHA256SUMS   # shasum -a 256 on macOS

Full commit log: v0.33.0..HEAD