Skip to content

Adopt Eliom 13's Deriving_Json codec for persistent references#703

Draft
balat wants to merge 53 commits into
masterfrom
deriving
Draft

Adopt Eliom 13's Deriving_Json codec for persistent references#703
balat wants to merge 53 commits into
masterfrom
deriving

Conversation

@balat

@balat balat commented May 29, 2026

Copy link
Copy Markdown
Member

Summary

Companion to ocsigen/eliom#859. Eliom 13 drops Stdlib.Marshal from
persistent storage; Reference.eref ~persistent now requires a
Deriving_Json.t codec.

Commits

  • Migrate persistent erefs to Deriving_Json codecs
    • `Os/tips.eliom`: declare a `Stringset.t Deriving_Json.t` codec
      (encoded as a sorted string list) and pass it to both
      `tips_seen` and `tips_seen_not_connected`.
    • `Os/date`: expose `local_calendar_json` and the conventional
      `local_calendar_{of,to}_json` so `[%json: Os.Date.local_calendar]`
      resolves transparently. Encoding: Unix float
      (`CalendarLib.Calendar.{to,from}_unixfloat`).
    • `template.distillery/demo_ref.eliom`: pass
      `[%json: Os.Date.local_calendar option]` to the demo eref so the
      generated app shows the new idiom.
  • `opam: relax eliom constraint and drop stale pin-depends`
    • `eliom` constraint bumped from `>= 13.0.0` to `>= 13.0~`
      (in opam semver, `13.0~dev < 13.0.0`).
    • Removed the `pin-depends` entry pointing at an old
      `ocsigen-toolkit` commit on github — it silently overrode any
      local pin to toolkit when ocsigen-start was repinned.

Test plan

  • `dune build` passes locally against `eliom#deriving`
  • `opam install ocsigen-start` succeeds against
    `eliom#deriving` + `ocsigen-toolkit#deriving`
  • Smoke test of `tips`-related code paths in a real ocsigen-start
    app

balat added 26 commits June 22, 2026 14:39
js_of_ocaml must not be a runtime dependency of the server library,
only a compile-time include for type definitions. Otherwise, loading
the library via Dynlink (ocsigenserver in lib mode) fails with
"Unimplemented Javascript primitive caml_pure_js_expr".

Use -I include flags (via type_includes) instead of libraries, like
Eliom does.
Update all references from old Eliom_xxx names to new wrapped names:
- Eliom_service -> Eliom.Service
- Eliom_content -> Eliom.Content
- Eliom_registration -> Eliom.Registration
- Eliom_parameter -> Eliom.Parameter
- Eliom_client -> Eliom.Client
- Eliom_config -> Eliom.Config
- Eliom_reference -> Eliom.Reference
- Eliom_state -> Eliom.State
- Eliom_shared -> Eliom.Shared
- Eliom_bus -> Eliom.Bus
- Eliom_comet -> Eliom.Comet
- Eliom_notif -> Eliom.Notif
- Eliom_request_info -> Eliom.Request_info
- Eliom_tools -> Eliom.Tools
- Eliom_cscache -> Eliom.Cscache
- Eliom.run -> Eliom.App.run
Ot_form -> Ot.Form, Ot_popup -> Ot.Popup, Ot_icons -> Ot.Icons, etc.
Drop the [Os_] prefix from all source files and all internal
references (Os_session -> Session, Os_user -> User, etc.).  The
modules become accessible to users as [Os.Session], [Os.User], ...
via dune's wrapping.
Sync the bundled distillery template with the os_template repository
(via the rename script).
Place all module sources in [src/Os/] and use dune's standard
[(include_subdirs qualified)] + [(wrapped false)] to expose them
under the [Os.] namespace.  Split client side into a separate
[src/client/dune] with [(include dune.client)] + [(mode promote)].

The dune.client generation rule passes [--server-objs-dir] to
ocsigen-dune-rules so [-server-cmo] resolves unambiguously to the
server lib's [.cmo].
Use the installed version from opam instead.

Add ocsigen-dune-rules dependency
The migrate-to-Eliom.Xxx and ocsigenserver wrapping commits depend
on eliom 13. Use [>= "13.0~"] (not [>= "13.0.0"]) so opam also
accepts the pre-release [13.0~dev] version shipped by the eliom
modernize branch (in opam semver, [13.0~dev < 13.0.0]).

Cap at [< 14.0.0] so CI does not try to build against future
eliom majors that may break this.
Ocsigen_config -> Ocsigen.Config
Ocsigen_extensions -> Ocsigen.Extensions
Ocsigen_lib -> Ocsigen_base.Lib
Ocsigen_stream -> Ocsigen_base.Ocsigen_stream
Bundled CSS files for toolkit widgets (ot_buttons, ot_carousel,
ot_datetime, ot_drawer, ot_form, ot_icons, ot_page_transition,
ot_picture_uploader, ot_popup, ot_spinner, ot_sticky, ot_tongue),
default CSS, wasm_loader.js, and npm metadata (package.json,
package-lock.json).
Provides old Os_xxx module names as aliases to new Os.Xxx modules
to ease migration of existing code.
Apply the same change as in os_template upstream: PROJECT_NAME_icons.eliom's
[Make] functor now takes [Eliom.Content.Html.T] as parameter, replacing
the local ad-hoc ICON_HTML signature.
Use the standard dune install pattern:

    (install
     (package ocsigen-start)
     (section lib_root)
     (files
      (glob_files_rec
       (template.distillery/* with_prefix eliom/templates/os))))

so eliom-distillery picks up the os template at the conventional
[lib/eliom/templates/os/] location.  The template source directory
is named [template.distillery/], and the installed name is [os].

Update src/client/dune to invoke [ocsigen-dune-rules gen ...] using
the new sub-command syntax.
Module namespace migration to Os.Xxx, ocsigen-start-compat package,
PROJECT_NAME_icons on Eliom.Content.Html.T, template renamed to os
and installed at lib/eliom/templates/os/, migration to Eliom 13 +
wrapped ocsigenserver names. Major version bump (9.0.0~dev) for the
module renames.
build/gen_wikidoc.sh runs eliomdoc with the wikidoc plugin against the
modernize layout's wrapped Os.* modules in src/Os/, producing .wiki
files in _build/doc/dev/api/{server,client}/.

The script handles the strengthening of wrapped module names by
generating short-name [include Os__X] aliases in a temporary directory
before invoking eliomdoc, so that doc cross-references like [Session.X]
resolve correctly.

The output is meant to be committed on the wikidoc branch under
doc/dev/api/. The README is updated to point to the script.
The wikidoc plugin generates menu.wiki from the structure of the
ocamldoc -intro file. doc/server.indexdoc and doc/client.indexdoc
group the Os.* modules by topic (User management, Persistence,
Notifications, ...) so the website navigation reflects that grouping
instead of being a flat list.

The script also stops feeding .mli files to the client-side
generation: those files declare server-only modules and would
otherwise produce client docs for modules that don't exist on the
client side.
Replaces the previous print-only stub (left when the OCamlnet
implementation was removed for OCaml 5 compatibility) with one that
pipes an RFC-2822 message to the configured mailer ("sendmail" by
default) via Lwt_process.

When the mailer is not on PATH, the email is dumped to stderr through
Logs.warn instead of failing, so applications remain usable out of
the box without configuring an MTA.

Drops the now-unused Invalid_mailer exception.
Use the installed version from opam instead.

Add ocsigen-dune-rules dependency
Ocsigen_config -> Ocsigen.Config
Ocsigen_extensions -> Ocsigen.Extensions
Ocsigen_lib -> Ocsigen_base.Lib
Ocsigen_stream -> Ocsigen_base.Ocsigen_stream
Provides old Os_xxx module names as aliases to new Os.Xxx modules
to ease migration of existing code.
balat added 5 commits June 22, 2026 14:39
Replaces the previous print-only stub (left when the OCamlnet
implementation was removed for OCaml 5 compatibility) with one that
pipes an RFC-2822 message to the configured mailer ("sendmail" by
default) via Lwt_process.

When the mailer is not on PATH, the email is dumped to stderr through
Logs.warn instead of failing, so applications remain usable out of
the box without configuring an MTA.

Drops the now-unused Invalid_mailer exception.
Eliom 13 drops Marshal-based persistence for [Reference.eref]: every
persistent reference must now be created with a JSON codec via
~persistent:(name, codec).

* tips.eliom: declare a Stringset.t Deriving_Json.t codec (encoded as
  a sorted string list via Deriving_Json.convert) and pass it to both
  tips_seen and tips_seen_not_connected.
* Os.Date: expose local_calendar_json / local_calendar_of_json /
  local_calendar_to_json so that [%json: Os.Date.local_calendar]
  resolves transparently in user code. The encoding is the Unix
  float (CalendarLib.Calendar.{to,from}_unixfloat).
* template.distillery/demo_ref.eliom: pass
  [%json: Os.Date.local_calendar option] to Eliom.Reference.eref so
  the generated app shows the new idiom.
* eliom constraint is bumped from ">= 13.0.0" to ">= 13.0~". The
  pre-release version "13.0~dev" is < "13.0.0" in opam semver, so
  the previous constraint rejected the version actually shipped.
* The pin-depends entry pointing at an old ocsigen-toolkit commit on
  github is removed. It silently overrode any local pin to
  ocsigen-toolkit when ocsigen-start was repinned. Users that want a
  specific toolkit version should pin it themselves.
- Convert <<a_api>>/<<a_manual>> wikidoc refs in src/Os/*.{eliomi,eliom}
  to native odoc references ({!Module}/{{!page-X}}).
- Add doc/intro.mld (converted from wikidoc doc/dev/manual/intro.wiki),
  doc/index.mld (landing page) and doc/dune declaring them in the
  ocsigen-start package, so manual + API build together with odoc and
  cross-references resolve.

Built by wodoc for ocsigen.org; ignored markers keep the source valid
for ocaml.org's stock odoc.
balat and others added 11 commits June 25, 2026 19:36
Replace the per-version build.sh (in ocsigen.github.io) with a single declarative
doc/wodoc consumed by 'wodoc build': (client-server ...) server/client sides from
doc/{server,client}.indexdoc (wrapper Os), (odoc-driver ocsigen-start) builds the
API with odoc_driver --remap on the installed package, (hosted ...) rewrites
sibling Ocsigen xrefs to relative links. dev-only CI (deploy dev, only from
master); stable versions built by hand. NB: needs the odoc_driver base_args fix.

Verified with wodoc build: 122 pages, per-side nav/colour/switch, 0 template holes.
Run the Documentation workflow with a version input to freeze the dev docs
currently on gh-pages as /<version>/ and repoint `latest` at it (wodoc release,
which also refreshes versions.json). No rebuild. Push / version-less runs keep
rebuilding dev only.
Declare the manual nav in doc/wodoc (new format) instead of overlaying a
wikicréole menu.wiki from wikidoc (CI step removed). Also fix the landing, which
pointed at a non-existent ocsigen-start/index.html, to intro.html.
Keep the (hosted ...) table in sync with master: add the js_of_ocaml/tyxml
(subdir layout) and reactiveData (root) entries so cross-project links point
to ocsigen.org. Avoids reverting them when this doc branch merges.

Requires wodoc with the `subdir` layout (ocsigen/wodoc#4).
Keep the (hosted ...) table in sync with master: add (lwt lwt subdir) now
that Lwt's docs are deployed under the standard per-package layout, so this
modernization branch doesn't drop the Lwt redirect when it reaches master.
index.mld already is the package home page (it introduces Ocsigen Start and
links to the introduction and the API). Add @children_order so the
introduction comes before the API modules in the ocaml.org sidebar, point the
ocsigen.org landing at the home page, and drop the now-redundant "Overview"
navigation entry (the home page is the landing).
Follow-up to #712: index.mld (a short home page) and intro.mld (demo,
getting started, implementation and library overview) overlapped. Fold the
introduction's content into index.mld so there is a single home page, and
drop intro.mld and its navigation entry.
Bring the deriving branch in line with master: convert the relative ../<project>
links to odoc cross-package references (quoting hyphenated page names) and
normalise the demo and tutorial links to full https URLs, matching master so a
future merge does not reintroduce the old links.
The screenshots used the wiki-image markup {{files/…png|Ocsigen Start}}, which
odoc rejects ("bad markup") and renders broken. Master uses {%wodoc:img src=…
alt=…%}; the #713 merge carried this branch's older intro markup into index.mld.
Convert to the same wodoc image markup as master.
The API docs are now built with odoc/wodoc (see doc/wodoc and the
Documentation CI workflow); the gen_wikidoc.sh eliomdoc->wiki script
and the README section are no longer used. The indexdoc menus are kept
(still consumed by doc/wodoc).
@balat balat changed the base branch from modernize to master June 25, 2026 18:24
balat and others added 6 commits June 26, 2026 17:34
Eliom.Lib.Option (which re-exported the Ocsigen Server baselib Option module)
was removed in Server 8. Use the stdlib Option module instead (map/iter have
identical signatures).
Pre-existing formatting drift that fails the lint-fmt CI; fix it so the
branch is green.
Adapt to Ocsigen Server 8: use stdlib Option
Pin ocsigenserver#master, ocsipersist#master, eliom#deriving,
ocsigen-toolkit#modernize, ocsigen-dune-rules#modernize,
ocsigen-ppx-rpc#modernize and ocsigen-i18n#modernize.
CI: pin the Server 8 dev branches of ocsigen deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant