From 36266bcade0cc9cd706c97af74c360f893530359 Mon Sep 17 00:00:00 2001 From: Roman Zaiev Date: Thu, 3 Dec 2026 18:19:43 +0000 Subject: [PATCH] Release 0.10.4: check the rules by litany and send agents to the docs make lint checked formatting, odoc and the release build, so the rules a compiler does not hold were held by reading. litany now runs there on Hypha's lint set, with the gold copy held whole in the litany file, and the code meets it; the one open of an ordinary module, Shape's, is allowed with its reason. An agent using rowtype reaches its signatures in the switch's lib/, by go-to-definition, a hover or a read, and never opens its doc/, where the catalogue and the pages are installed. So every interface names its page, where a page is about it, or its package's catalogue, by its path through opam var, and the README's With an agent says the same; the reference's table of packages names rowtype-test, which it had left out. --- AGENTS.md | 8 +- CHANGES.md | 7 + Makefile | 6 +- README.md | 12 +- agents/pages/reference.md | 1 + docs/src/content/docs/reference.md | 1 + dune | 29 ++- dune-project | 7 +- litany | 223 ++++++++++++++++++ migrate/postgres/rowtype_migrate_postgres.mli | 3 + migrate/rowtype_migrate.ml | 2 +- migrate/rowtype_migrate.mli | 6 + migrate/sqlite/rowtype_migrate_sqlite.mli | 3 + postgres/rowtype_postgres.mli | 3 + rowtype.opam | 1 + sqlite/forms.ml | 2 +- sqlite/forms.mli | 4 +- sqlite/rowtype_sqlite.ml | 2 +- sqlite/rowtype_sqlite.mli | 6 + src/rowtype.ml | 7 +- src/rowtype.mli | 2 + src/shape.mli | 2 + testing/rowtype_test.mli | 6 + 23 files changed, 321 insertions(+), 22 deletions(-) create mode 100644 litany diff --git a/AGENTS.md b/AGENTS.md index a00f1db..e2c3661 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ user-visible change updates. make setup # once: the switch rowtype, all dependencies make test # starts the test Postgres in Podman, runs every test; # RUNTIME=docker for Docker -make lint # formatting, odoc, and the release build +make lint # formatting, odoc, the release build, and Hypha's rules by litany make fmt # format in place make docs # the documentation site into _build/docs, as Pages publishes it, and # agents/ from its pages @@ -207,9 +207,9 @@ Each rule comes with why it exists and the test that catches a break. open is a span's alone**, `Mtime.Span.(10 * s)`. Why: the walk exists to pattern-match that GADT, and every constructor qualified would bury the match; a span's operators are made to be opened around the one - expression, as OCAML.md writes one. Symptom: - `rg -n '^\s*open |\b[A-Z]\w*\.[(\[{]' -g '*.ml' src postgres sqlite migrate | rg -v 'Mtime\.Span\.\('` - finds anything but `open Shape`. + expression, as OCAML.md writes one. Symptom: `make lint`'s litany + reports `open-of-ordinary-module`, which `open Shape` is allowed with + its reason beside it. ## Changes and releases diff --git a/CHANGES.md b/CHANGES.md index c284d52..8bfd7fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## 0.10.4 (2026-12-03) + +- Every package installs the documentation for agents, `llms.txt` and every + page, in `$(opam var :doc)`, and every interface it installs + names its page there, or `llms.txt`. The README's *With an agent* says so. +- The reference's table of packages names `rowtype-test`. + ## 0.10.3 (2026-11-22) - The rowtype package installs its documentation for agents: each page as diff --git a/Makefile b/Makefile index dbcc1e0..bb95d05 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,12 @@ test: ## run the tests $(OPAM) ./_build/default/testing/bin/main.exe run --runtime $(RUNTIME) -- \ $(OPAM) dune test --force -# Release is the profile opam installs with. -lint: ## check formatting, docs and the release build +# Release is the profile opam installs with. litany holds the code to +# Hypha's rules, as the litany file selects them. +lint: ## check formatting, docs, the release build and Hypha's rules $(OPAM) dune build @all @fmt @doc $(OPAM) dune build --profile release @all + $(OPAM) litany check fmt: ## format the code $(OPAM) dune fmt diff --git a/README.md b/README.md index 87dfd9a..211b08f 100644 --- a/README.md +++ b/README.md @@ -79,14 +79,14 @@ The same statements run on SQLite unchanged: [SQLite](https://hyphatech.github.i ## With an agent -Each release installs its documentation for an agent with it, at -`$(opam var rowtype:doc)`: `llms.txt`, and every page in Markdown. An agent -reads it when your project's `AGENTS.md` tells it to: +Every package of rowtype installs its documentation for an agent with it, at +`$(opam var :doc)`: `llms.txt`, and every page in Markdown. An +agent reads it when your project's `AGENTS.md` tells it to: ```md -Before writing code with rowtype, read `$(opam var rowtype:doc)/llms.txt` and -the pages it lists for the parts you need, and use those parts rather than -writing your own. +Before working with rowtype, read `llms.txt` in `$(opam var :doc)`, +for any rowtype package the project installs, then the pages it lists for the +parts you need, and use those parts rather than writing your own. ``` ## Contributing diff --git a/agents/pages/reference.md b/agents/pages/reference.md index fe2de7c..a4d85c3 100644 --- a/agents/pages/reference.md +++ b/agents/pages/reference.md @@ -15,6 +15,7 @@ names it as a module (`Rowtype_postgres`). | `rowtype-postgres` | `rowtype-postgres` | The Postgres backend, over [postgres-eio](https://hyphatech.github.io/postgres-eio/) | | `rowtype-sqlite` | `rowtype-sqlite` | The SQLite backend, over the [sqlite3](https://github.com/mmottl/sqlite3-ocaml) binding | | `rowtype-migrate` | `rowtype-migrate`, `rowtype-migrate.postgres`, `rowtype-migrate.sqlite` | The migrations and the `rowtype-migrate` command, for each dialect installed beside it | +| `rowtype-test` | `rowtype-test` | A Postgres database a test run owns: a server for the run, a database of its own for each case that asks, and the `rowtype-test` command | ## rowtype diff --git a/docs/src/content/docs/reference.md b/docs/src/content/docs/reference.md index ee43881..f75176e 100644 --- a/docs/src/content/docs/reference.md +++ b/docs/src/content/docs/reference.md @@ -17,6 +17,7 @@ names it as a module (`Rowtype_postgres`). | `rowtype-postgres` | `rowtype-postgres` | The Postgres backend, over [postgres-eio](https://hyphatech.github.io/postgres-eio/) | | `rowtype-sqlite` | `rowtype-sqlite` | The SQLite backend, over the [sqlite3](https://github.com/mmottl/sqlite3-ocaml) binding | | `rowtype-migrate` | `rowtype-migrate`, `rowtype-migrate.postgres`, `rowtype-migrate.sqlite` | The migrations and the `rowtype-migrate` command, for each dialect installed beside it | +| `rowtype-test` | `rowtype-test` | A Postgres database a test run owns: a server for the run, a database of its own for each case that asks, and the `rowtype-test` command | ## rowtype diff --git a/dune b/dune index ac355a3..b3d1298 100644 --- a/dune +++ b/dune @@ -8,11 +8,36 @@ (:standard -w +a-4-40-41-42-44-45-48-67-70)))) ; The documentation for a user's agent, agents/, written from the site's pages -; by `make docs`: rowtype, which every other package depends on, installs it -; whole, so $(opam var rowtype:doc) holds llms.txt and each page. +; by `make docs`: every package installs it whole, so a package installed +; alone, rowtype-migrate without rowtype, still holds llms.txt and each page in +; $(opam var :doc). (install (package rowtype) (section doc) (source_trees (agents as .))) + +(install + (package rowtype-migrate) + (section doc) + (source_trees + (agents as .))) + +(install + (package rowtype-postgres) + (section doc) + (source_trees + (agents as .))) + +(install + (package rowtype-sqlite) + (section doc) + (source_trees + (agents as .))) + +(install + (package rowtype-test) + (section doc) + (source_trees + (agents as .))) diff --git a/dune-project b/dune-project index eb236ae..4507197 100644 --- a/dune-project +++ b/dune-project @@ -55,7 +55,12 @@ (ocamlformat (and :with-dev-setup - (= 0.29.0))))) + (= 0.29.0))) + (hypha-litany + (and + :with-dev-setup + (>= 1.3.0) + (< 2.0.0))))) (package (name rowtype-postgres) diff --git a/litany b/litany new file mode 100644 index 0000000..34bb3b7 --- /dev/null +++ b/litany @@ -0,0 +1,223 @@ +; Hypha's lint set, as litany holds it. Every Hypha repository's litany file +; selects each rule here and keeps each forbid as it is written here; what is +; the repository's own -- a forbid more, a per-path -- is added with its +; reason. Hypha's OCAML.md says what each rule is for. + +(litany-config 1) + +(lint + (select default) + (extend + unsafe-partial-stdlib + unsafe-obj-magic + untyped-ignore + ignored-result + wildcard-over-owned-variant + open-of-ordinary-module + restricted-dependency)) + +(rule restricted-dependency + ; Refused in every file. + (forbid Stdlib.failwith + (use "a result; a test that raises on purpose declares its own exception")) + (forbid Stdlib.compare + (use "the type's own comparison: Int.compare, String.compare")) + (forbid Stdlib.min + (use "the type's own: Int.min, Float.min")) + (forbid Stdlib.max + (use "the type's own: Int.max, Float.max")) + (forbid Unix.time + (use "the clock the caller gives, read as a Ptime.t")) + (forbid Unix.gettimeofday + (use "the clock the caller gives, read as a Ptime.t")) + (forbid Stdlib.Sys.time + (use "Eio.Time.Mono.now, for time that has passed")) + (forbid Unix.sleep + (use "Eio.Time.Mono.sleep_span")) + (forbid Unix.alarm + (use "Eio.Time.Timeout.v")) + (forbid Unix.setitimer + (use "Eio.Time.Timeout.v")) + (forbid Unix.getitimer + (use "Eio.Time.Mono.now")) + (forbid Eio_unix.sleep + (use "Eio.Time.Mono.sleep_span")) + (forbid Eio.Time.sleep + (use "Eio.Time.Mono.sleep_span")) + (forbid Eio.Time.sleep_until + (use "Eio.Time.Mono.sleep_span, over the span from now to the instant")) + (forbid Eio.Time.with_timeout + (use "Eio.Time.Timeout.v, given an Mtime.Span.t")) + (forbid Eio.Time.with_timeout_exn + (use "Eio.Time.Timeout.v, given an Mtime.Span.t")) + (forbid Eio.Time.Timeout.seconds + (use "Eio.Time.Timeout.v, given an Mtime.Span.t")) + (forbid Eio.Time.Mono.sleep + (use "Eio.Time.Mono.sleep_span")) + (forbid Uri.query + (use "what the router decoded and validated")) + (forbid Uri.get_query_param + (use "what the router decoded and validated")) + ; Refused outside a library's clock module. + (forbid Eio.Time.now + (use "the library's instant.ml, which gives a Ptime.t") + (except **/instant.ml)) + (forbid Unix.sleepf + (use "the library's instant.ml, which takes an Mtime.Span.t") + (except **/instant.ml)) + ; Refused in a library: a program, a test and an example own their process, + ; wherever in the tree its bin/, test/, examples/ or bench/ is. + (forbid Stdlib.Sys.getenv + (use "a value the executable read at startup and passed in") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.getenv_opt + (use "a value the executable read at startup and passed in") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Unix.getenv + (use "a value the executable read at startup and passed in") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Unix.environment + (use "a value the executable read at startup and passed in") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Unix.putenv + (use "an argument: a library sets no global state") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.argv + (use "a value the executable read at startup and passed in") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.signal + (use "the executable: it owns the process's signals") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.set_signal + (use "the executable: it owns the process's signals") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.chdir + (use "a directory capability the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Sys.command + (use "Eio.Process, on the process manager the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.at_exit + (use "Eio.Switch.on_release, on the switch the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Random.self_init + (use "a Random.State.t, or the secure random source the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Random.init + (use "a Random.State.t, or the secure random source the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Logs.set_reporter + (use "the executable: it configures the log reporter") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Logs.set_level + (use "the executable: it configures the log level") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_string + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_endline + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_bytes + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_char + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_int + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_float + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.print_newline + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_string + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_endline + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_bytes + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_char + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_int + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_float + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.prerr_newline + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.stdout + (use "a sink the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.stderr + (use "a sink the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Printf.printf + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Printf.eprintf + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Format.printf + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Format.eprintf + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Format.print_string + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Format.std_formatter + (use "a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Stdlib.Format.err_formatter + (use "a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Fmt.pr + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Fmt.epr + (use "a log on the library's own source, or a formatter the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Eio_main.run + (use "the env, switch or capability the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Ptime_clock.now + (use "the clock or ~now the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Mtime_clock.now + (use "the clock the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Mtime_clock.elapsed + (use "the clock the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Mtime_clock.counter + (use "the clock the caller gives") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + ; Refused in a Melange library: the console is the page's. + (forbid Js.log + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Js.log2 + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Js.log3 + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Js.log4 + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Js.logMany + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**)) + (forbid Js.Console + (use "a value returned to the caller") + (except **/bin/** **/test/** **/examples/** **/bench/**))) diff --git a/migrate/postgres/rowtype_migrate_postgres.mli b/migrate/postgres/rowtype_migrate_postgres.mli index 0d27909..418d580 100644 --- a/migrate/postgres/rowtype_migrate_postgres.mli +++ b/migrate/postgres/rowtype_migrate_postgres.mli @@ -1,6 +1,9 @@ (** Migrations on Postgres, by {!Rowtype_migrate}'s files and rules: the library [rowtype-migrate.postgres], built where [rowtype-postgres] is installed. + Its page, with its examples: + [$(opam var rowtype-migrate:doc)/pages/guide/migrations.md]. + A run holds a Postgres advisory lock, so two processes migrating at once take turns and the second finds nothing left to do; each migration runs only on the session that took it. The connection's bounds are lifted for the run: diff --git a/migrate/rowtype_migrate.ml b/migrate/rowtype_migrate.ml index 8f09cf1..7edbc6f 100644 --- a/migrate/rowtype_migrate.ml +++ b/migrate/rowtype_migrate.ml @@ -371,7 +371,7 @@ let read migrations recorded = | Some _ -> ((fun v -> v <= b.version), None) | None -> ((fun _ -> false), Some b)) in - let highest = List.fold_left (fun h (v, _, _) -> max h v) 0 recorded in + let highest = List.fold_left (fun h (v, _, _) -> Int.max h v) 0 recorded in let to_apply = List.filter (fun m -> Option.is_none (recorded_as m.version)) migrations |> List.sort (fun a b -> Int.compare a.version b.version) diff --git a/migrate/rowtype_migrate.mli b/migrate/rowtype_migrate.mli index 88d2c2d..dd139cb 100644 --- a/migrate/rowtype_migrate.mli +++ b/migrate/rowtype_migrate.mli @@ -6,6 +6,12 @@ [rowtype-migrate.sqlite], built where that dialect's backend is installed, so a program links the dialects it uses and no other. + Its documents, a page for each part: + [$(opam var rowtype-migrate:doc)/llms.txt]. + + Its page, with its examples: + [$(opam var rowtype-migrate:doc)/pages/guide/migrations.md]. + A migration is a file named [_.sql] in one directory, the version a UTC timestamp of fourteen digits. They are applied by the [rowtype-migrate] command, which links no application: diff --git a/migrate/sqlite/rowtype_migrate_sqlite.mli b/migrate/sqlite/rowtype_migrate_sqlite.mli index 30e3723..458bee2 100644 --- a/migrate/sqlite/rowtype_migrate_sqlite.mli +++ b/migrate/sqlite/rowtype_migrate_sqlite.mli @@ -1,6 +1,9 @@ (** Migrations on SQLite, by {!Rowtype_migrate}'s files and rules: the library [rowtype-migrate.sqlite], built where [rowtype-sqlite] is installed. + Its page, with its examples: + [$(opam var rowtype-migrate:doc)/pages/guide/migrations.md]. + SQLite has no lock over a run: each migration's transaction takes the write lock as it begins and first asks the record whether another process applied it while this one waited, so two processes migrating at once take turns. A diff --git a/postgres/rowtype_postgres.mli b/postgres/rowtype_postgres.mli index 8268dfd..c435e92 100644 --- a/postgres/rowtype_postgres.mli +++ b/postgres/rowtype_postgres.mli @@ -1,6 +1,9 @@ (** {{!Rowtype}rowtype} over Postgres, through [postgres-eio]: the one place the two meet. + Its documents, a page for each part: + [$(opam var rowtype-postgres:doc)/llms.txt]. + Statements are Postgres's as written, [$1] for a shape's first value. An {!Rowtype.instant} is a [timestamptz], which keeps the microsecond too, sent as ISO 8601 in UTC and read back whatever the session's time zone, which the diff --git a/rowtype.opam b/rowtype.opam index 0832ce0..be36d39 100644 --- a/rowtype.opam +++ b/rowtype.opam @@ -21,6 +21,7 @@ depends: [ "merlin" {with-dev-setup & >= "5.6-504"} "ocaml-lsp-server" {with-dev-setup & >= "1.25.0"} "ocamlformat" {with-dev-setup & = "0.29.0"} + "hypha-litany" {with-dev-setup & >= "1.3.0" & < "2.0.0"} "odoc" {with-doc} ] build: [ diff --git a/sqlite/forms.ml b/sqlite/forms.ml index f4353cf..6c748c7 100644 --- a/sqlite/forms.ml +++ b/sqlite/forms.ml @@ -38,7 +38,7 @@ let date_of_string s = microsecond an instant is written to, so one read is one that writes back as itself, and compares with one written. *) let picoseconds fraction = - let kept = String.sub fraction 0 (min 6 (String.length fraction)) in + let kept = String.sub fraction 0 (Int.min 6 (String.length fraction)) in Option.map (fun us -> Int64.mul (Int64.of_int us) 1_000_000L) (int_of_string_opt (kept ^ String.make (6 - String.length kept) '0')) diff --git a/sqlite/forms.mli b/sqlite/forms.mli index b23bb18..ca4c368 100644 --- a/sqlite/forms.mli +++ b/sqlite/forms.mli @@ -1,6 +1,8 @@ (** The text forms SQLite keeps a value in where it has no kind of value for one -- an instant, a date, an interval, an array -- written and read with no IO. -*) + + Its documents, a page for each part: + [$(opam var rowtype-sqlite:doc)/llms.txt]. *) val instant : Ptime.t -> string (** [2026-10-20 09:24:46.621000]: in UTC, to the microsecond below, as SQLite's diff --git a/sqlite/rowtype_sqlite.ml b/sqlite/rowtype_sqlite.ml index c319dd6..48be84f 100644 --- a/sqlite/rowtype_sqlite.ml +++ b/sqlite/rowtype_sqlite.ml @@ -680,7 +680,7 @@ module Pool = struct "a database in memory is each connection's own, so a pool of \ them is many databases: give the pool a file") else - let size = max 1 size in + let size = Int.max 1 size in let remake () = connect ~sw ~mono_clock ?timeout ?observe file in let rec made k acc = if k = 0 then Ok acc diff --git a/sqlite/rowtype_sqlite.mli b/sqlite/rowtype_sqlite.mli index d36b4b0..2ff572e 100644 --- a/sqlite/rowtype_sqlite.mli +++ b/sqlite/rowtype_sqlite.mli @@ -2,6 +2,12 @@ place the two meet, and the one package of rowtype that binds C, since SQLite is a library, not a server, and has no protocol to speak in OCaml. + Its documents, a page for each part: + [$(opam var rowtype-sqlite:doc)/llms.txt]. + + Its page, with its examples: + [$(opam var rowtype-sqlite:doc)/pages/guide/sqlite.md]. + Statements are SQLite's as written. A placeholder is [$1], [$2], ... as in every backend, or SQLite's own [?1] or [?], each bound by its number from the shape's values, so [$1] twice asks about one value twice. One with a diff --git a/src/rowtype.ml b/src/rowtype.ml index 16e736a..8f7fac8 100644 --- a/src/rowtype.ml +++ b/src/rowtype.ml @@ -140,9 +140,10 @@ module type S = sig val exec_raw : conn -> string -> (unit, [> error ]) result end -(* The walk exists to pattern-match the GADT, and qualifying every - constructor would bury the one thing it does. *) -open Shape +open Shape [@@litany.allow + "open-of-ordinary-module: the walk exists to pattern-match the \ + GADT, and qualifying every constructor would bury the one thing \ + it does"] let rec holds_array : type a. a ty -> bool = function | Unit | Scalar _ -> false diff --git a/src/rowtype.mli b/src/rowtype.mli index 39ca311..0970815 100644 --- a/src/rowtype.mli +++ b/src/rowtype.mli @@ -1,5 +1,7 @@ (** A query's shape, described once, for any SQL database. + Its documents, a page for each part: [$(opam var rowtype:doc)/llms.txt]. + One {!ty} value describes a query's shape {i once} and drives both directions -- binding parameters and decoding rows -- and a {!statement} is a query with its shapes and how many rows it answers, declared once and run diff --git a/src/shape.mli b/src/shape.mli index 0a9f778..5e466da 100644 --- a/src/shape.mli +++ b/src/shape.mli @@ -1,5 +1,7 @@ (** The shape of a query. + Its documents, a page for each part: [$(opam var rowtype:doc)/llms.txt]. + A {!ty} describes a query's shape {i once} and drives both directions -- binding parameters and decoding rows. This module holds the description and nothing that runs one; {!Rowtype} walks it against a backend. diff --git a/testing/rowtype_test.mli b/testing/rowtype_test.mli index 6e10956..13fd5cf 100644 --- a/testing/rowtype_test.mli +++ b/testing/rowtype_test.mli @@ -3,6 +3,12 @@ that asks, and nothing left once the run ends -- whether it passed, failed or raised. + Its documents, a page for each part: + [$(opam var rowtype-test:doc)/llms.txt]. + + Its page, with its examples: + [$(opam var rowtype-test:doc)/pages/guide/test-databases.md]. + {[ let () = Eio_main.run @@ fun env ->