Repository navigation
tool-packaging: soffice through the exec runner, soffice_memory, SVG through rsvg-convert (v0.12.0) - #50
Merged
Conversation
…ns soffice through the exec runner - stages.Options.LibreOfficeExec: set, Build looks up soffice on PATH and builds it with tool.NewExec under the same Memory, Timeout, and Env as every other exec-run tool; docker is never looked up for it, and soffice's Set.Tools row names its path. False, the zero value, keeps soffice in picture.LibreOfficeImage through the container runner. cmd/docproc is unchanged. - Unit tier: TestBuildLibreOfficeExec, over the tooltest stand-ins, records the lookups: soffice and never docker when set, docker and never soffice when unset, office and vision-converted wired or missing accordingly. - Integration tier: TestLibreOfficeExec builds the office route with the option through exec.LookPath, fails on a docker lookup, and prepares office/test/testdata/rtf/memo.rtf through the host's soffice. - README: the setting, and the correction that Build runs ffmpeg and ffprobe through the exec runner alone; the go get line names v0.12.0. docs/api.md lists the field. CHANGELOG: Unreleased becomes [v0.12.0] - 2026-11-29 with the setting under Added, an empty Unreleased above, and the compare links extended, as b2ccbba did. Not tagged. Decisions: - The option is a bool named for the program's package spec (LibreOfficeSpec/LibreOfficeImage) rather than a general per-tool runner choice: soffice is the only tool Build runs in a container, so nothing else needs one. - The integration test sets no memory bound: on this host soffice 26.8.1 fails to write its output under a 4 GiB RLIMIT_AS and succeeds under 8 GiB, so a bound in the test would hold a host-specific floor. mise run check passes.
…iceMemory bounds soffice run through the exec runner
- stages.Options.LibreOfficeMemory: with LibreOfficeExec set, soffice's tool.Spec.MemoryLimit (its
RLIMIT_AS through prlimit) in place of Memory; every other tool keeps Memory. No library default:
zero is none, as Memory's zero is, and Build refuses one below zero through ErrRequest. With
LibreOfficeExec unset, soffice stays under Memory in the container, as before.
- The office and picture stages' configs carry LibreOfficeMemory beside Memory, and a part failure
whose ExitError is soffice's names soffice's bound ("soffice: killed by SIGABRT under a 16 GiB
memory bound"); other tools' failures keep naming Memory.
- Unit tier: TestBuildLibreOfficeExec gains a case with Memory 8 GiB and LibreOfficeMemory 16 GiB,
whose stand-in magick and soffice refuse their version commands unless their RLIMIT_AS is their
own bound (PictureSettings.Limit, new SofficeSettings.Limit). TestLibreOfficeMemoryReason kills
a stand-in soffice converting an EMF and reads the 16 GiB bound in the reason. TestBuildRefuses
covers a negative soffice bound. Each fails with the soffice bound routed as Memory.
- Integration tier: TestLibreOfficeExec runs with Memory 2 GiB and LibreOfficeMemory 8 GiB and
prepares memo.rtf; at 4 GiB it fails, as measured.
- README's memory-bound section, docs/api.md's Options, and the v0.12.0 CHANGELOG entry describe
the bound.
Decisions:
- A sibling field, LibreOfficeMemory, beside the LibreOfficeExec bool rather than a struct: one
added field, the bool from slice 1 kept, and the pair reads as one setting by name.
- A nonzero LibreOfficeMemory with LibreOfficeExec unset is ignored, not refused: the container
path's behavior stays unchanged, and the field documents it bounds soffice only through the exec
runner.
- The stage adapters pick soffice's bound by the ExitError's program name, one unexported helper
(runMemory), rather than changing Classify's signature for every stage.
mise run check passes.
…bles into stages.Options.LibreOfficeMemory settings gains the optional key soffice_memory (Settings.SofficeMemory), whole bytes, zero or more, assembled into stages.Options.LibreOfficeMemory. Unset, it assembles to tool_memory's value, so soffice keeps the bound the host already chose; below zero it is refused by name as a KeyError. Decisions: - cmd/docproc reads each DOCPROC_ variable through its own readEnv line, not generically, and runs soffice in its container (LibreOfficeExec unset), so the key would be inert there. cmd/docproc gains no DOCPROC_SOFFICE_MEMORY; settings/doc.go, docs/api.md, and docs/packages.md say soffice_memory is the one key it doesn't read. - Run.Stages' doc names LibreOfficeExec among the options left to the host. - cmd/docproc's checked build requires docproc v0.11.0, so its bounds tests are unchanged; once it requires v0.12.0, its expected starting Run carries LibreOfficeMemory equal to Memory. mise run check passes.
…g-convert, never magick picture renders an SVG through librsvg's own command, rsvg-convert, in place of magick's rsvg: coder, which a magick built without librsvg (Debian 13's 7.1.1-43) reads through ImageMagick's MSVG renderer, following <image href> to local files and URLs. The run is --zoom=<density/96> --background-color=white --format=png --output=<png> <copy>: zoom scales CSS pixels exactly as magick's -density did (pixel-identical on shapes.svg, and physical units stay true), the output is opaque RGB on white, and librsvg writes no time chunk, so it is reproducible with no magick step. picture.RsvgConvertSpec and RsvgConvertMinimum (2.58) declare the tool; picture.Config.RsvgConvert is required and version-checked through Tool.AtLeast in NewConverter. stages.Build builds it through the exec runner, as magick, and the office and vision-converted routes require it, their rows carrying its version line last. Decisions: - Minimum 2.58: Ubuntu 24.04 LTS's, the rule LibreOfficeMinimum follows, and after 2.56.3's fix of CVE-2023-38633 (path traversal through an SVG reference). Debian 13's 2.60.0 passes; the flags used are far older. - Config.RsvgConvert is required rather than optional, so the office route, whose converter is the same picture.Converter, requires rsvg-convert too though it hands SVGs on as stored. An optional field would have needed a refusal of its own; ErrNoReader names magick. - rsvg-convert works in the batch's picture-* directory (its HOME under the exec runner), since fontconfig writes its cache under HOME and the caller's directory must hold the PNG alone. - rsvg-convert rounds a fractional size up where magick rounded down (ink.svg 237x119, was 236x118; script-bearing.svg 625x188, was 625x187); the integration expectations follow. - magick's Limits no longer bound SVG rendering; the Tool's memory bound and timeout do, and --unlimited is never passed. TestLimitsHost now proves the width limit on a TIFF. - The office and picture stage identities change through their Version lines; the v0.12.0 CHANGELOG says so. - CI installs no magick (the tools tier runs on the developer's machine), so docs/development.md's host prerequisites gain rsvg-convert and no workflow changes. cmd/docproc's module stays on v0.11.0 and is unchanged; once it requires v0.12.0 it finds rsvg-convert through exec.LookPath as it finds magick, and docs/command.md's unit-timeout list will need it then. mise run check passes; go test -tags integration over picture, office, and stages passes, including the hostile SVG (an absolute path, a file:// URL, and an http URL render nothing and open no connection).
… wrapped to the package's width Comments (architecture/principles/comments.md): the doc comments of picture.NewConverter, ConvertPages, and ConvertBatch, settings' package doc, and Settings.Assemble, which the task's edits left overrunning the 100-column wrap or broken mid-paragraph, rewrapped without a change of wording.
…ntext/bunrei.md's tools and routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
capstone.data-intelligence.bunrei · task 16/17 · tool-packaging
Summary
Dockerfileondebian:13.8-slim, which holds every tooldocproc's routes run. It runs as uid 10001 with one work volume, which is also
TMPDIR.soffice runs under its own 8 GiB bound (
soffice_memory), and every other tool keeps 2 GiB.rsvg-convert, never magick, so an SVG's file and URL references arenever followed.
jobs.exclude, naming each route withits reason.
mise run imageand a CI job: every route is wired, one input per route completes,and a hostile SVG renders blank. The integration tier now proves checkpoint resume on an mbox.
LibreOfficeExec,LibreOfficeMemory/soffice_memory, andrsvg-convert.
Core changes
stages.Options: soffice can run on the host. Why: an image without a dockersocket otherwise loses the office and vision-converted routes.
rsvg-convert(minimum 2.58). Why: Debian's ImageMagick has no librsvg, andits own renderer follows
<image href>to local files and URLs.fault, not a quiet per-part failure.
(it and liborcus only), ffmpeg 9.1 from
mwader/static-ffmpeg, 7zz 26.06, and docproc-ooxml,docproc-mail, and docproc-onenote by tag, each checked against its release's SHA256SUMS.
Currency and upgrade read every
FROM,COPY --from, andARGpin.-tags image), and a killed-replica mbox job that resumes from itscheckpoint (docproc-mail pinned through mise).
Verify
mise run check: ✓ docproc and Bunrei.mise run currency: ✓ clean.mise run integration: ✓.mise run image: ✓ 14 subtests.mise run image:build, thendocker run --rm --entrypoint id capstone-bunrei:local→uid=10001(bunrei).BUNREI_*variablesand
AI_GATEWAY_TOKENset, thendocker logs→ one tool row per program, each at or aboveits minimum (soffice
from=/usr/bin/soffice), and all ten routesstate=wired.-e PATH=/usr/bin:/bin→ it exits 1 with "required routes missing, each tobe provided or named in jobs.exclude: office (docproc-ooxml: not found); …".
-e BUNREI_JOBS_EXCLUDE=office,nested,onenote,archive,audio,video→ it starts, thoseroutes log
state=excluded, and/healthzreturns 200.<image href>names/app/config.json→ each jobreaches
completed, and the SVG's picture is plain white. (Followed through the image tier'sstand-in gateway, not the real one.)
docker buildx build --platform linux/arm64 …→ the server and tools are arm64.Decided without you
soffice_memoryis an optional docproc settings key; unset, it takestool_memory's value.cmd/docproc doesn't read it, because it runs soffice in its container.
and picture stage identities change in v0.12.0, so cached docproc results for them miss once.
during the task and was failing currency.
integration/under theimagetag, so it shares the harness andstand-in gateway, and it needs a fresh stack (
mise run imagealways starts one).docs/building-out.md, and the compose README is renamed "The test stack".decision. Trimmed the
jobs:checkpoint decision to its cache-replay part. Dropped"tool-packaging: TMPDIR is work_dir" and the integration-tier checkpoint decision, because the
docs and tests now state them.
the host's 4 GiB failure.
Redirects and escalations
8 GiB in Bunrei, with 2 GiB kept for every other tool? Answer: yes.
docproc render SVG with rsvg-convert, and the image install librsvg2-bin? Answer: yes.
Merge danger: one-way door: docproc's
v0.12.0tag reaches the module proxy (Release:docproc
v0.12.0). Everything else is two-way: the image is built, not published. Blast radius:docproc and Bunrei. docproc merges first and waits on CI (
checks, thenci), then the tag. Bunreithen drops its temporary
replace, itsCOPY --from=docprocline, and--build-context,requires v0.12.0, and merges once its checks pass. Its CI
imagejob, on push to main, is thefirst to run the image without the temporary build context.
Needs you: none