Skip to content
standards-labPublic

About

Extraction for Go: text, metadata, and media from binary documents, messages, and streams, with the system tools it runs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

617 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docproc

docproc extracts documents for the models a layer above it runs. github.com/standards-lab/docproc is its Go base module: it inspects and routes each part of an input, reads it through the stage for its format and the system tools that stage runs, stores each output's content, and records what it prepared in an index. It calls no model and runs no inference: the text, pages, pictures, audio windows, and video frames it prepares are for a layer above, such as docinfer, to send on.

The base module requires golang.org/x/text alone, builds on every 64-bit platform, and has no root package. Running a tool needs Linux. Its three system tools, docproc-ooxml, docproc-mail, and docproc-onenote, are built in this repository under tools/, each released on its own tags.

Install

go get github.com/standards-lab/docproc@v0.14.0

The module's releases are tagged vX.Y.Z, and CHANGELOG.md states what each changes. Each package's documentation, go doc github.com/standards-lab/docproc/<package>, is the reference for its exported names, and its doc comment lists them.

Documentation

  • Packages: each package and what it does, and the bounds a host sets.
  • The command: cmd/docproc's commands, exit statuses, and configuration.
  • Limits: what docproc doesn't read, and the limits each stage inherits from its tool.
  • Development: the toolchain, a person's and an agent's tasks, where the tests sit, the compose harness, and releases.

Providers

Two nested modules implement dispatch's stores over a stack library, each released on its own tags and with its own README, which states its configuration, contracts, tiers, and limits:

Module What it is Tags
github.com/standards-lab/docproc/storage storage.New(Config{Client, Prefix, Renew}): a dispatch.Content in object storage over a go-storage Client, at a stable key layout, swept by the host's lifecycle rule. storage/vX.Y.Z
github.com/standards-lab/docproc/postgres postgres.New(ctx, Config{DB, Lease, Flush}): a dispatch.Index in PostgreSQL over sqlate, its Migrations the host applies, Verify, and NewRetention, which the host's sweeper drives. postgres/vX.Y.Z

Each requires the base module, and the base module requires neither. Both pass dispatchtest's suite for their store.

The system tools

stages.Build looks up each tool a stage requires on the host, checks it against its package's minimum in the environment its runs get, and leaves out every stage that requires a tool it can't build, missing, too old, or failing in that environment, so that route has no processor; Set.Rows reports each route's stage and tools.

docproc's own tools

Tool Minimum Current release Stage
docproc-ooxml 0.1.0 tools/ooxml/v0.2.0 office
docproc-mail 0.1.0 tools/mail/v0.2.0 email
docproc-onenote 0.1.0 tools/onenote/v0.1.2 onenote

Each minimum is the tool's first schema "2" release, which its reader requires. Fetch a tool by its own tag, never as the latest release: the repository's releases include the base module's and every tool's, so "latest" names whichever was tagged last. For linux-x64:

gh release download tools/mail/v0.2.0 --repo standards-lab/docproc \
  --pattern 'docproc-mail-v0.2.0-linux-x64.tar.gz' --pattern SHA256SUMS
sha256sum --check --ignore-missing SHA256SUMS
tar -xzf docproc-mail-v0.2.0-linux-x64.tar.gz docproc-mail

Put each binary on the host's PATH. Each tool's README states its install, its output, and its limits: docproc-ooxml, docproc-mail, and docproc-onenote.

The exec runner starts every tool in a fixed environment, never the host's: PATH as it was when the runner was built, LANG=C.UTF-8, HOME set to the run's own working directory, and TMPDIR set to a new empty directory of the run's own, docproc-run-*, under the host's TMPDIR. The program PATH finds must therefore be the program itself, not a version manager's shim, such as mise's or asdf's, which reads the user's configuration again on every run. Under that environment mise refuses the user's global configuration as untrusted. stages.Build checks each tool's version in the same environment, with HOME a new empty directory of the check's own, so such a shim reads as unavailable: its row in the tools table says why, and the stages that need it are missing.

A tool's temporary files live in its run's own TMPDIR, never beside its input. The runner removes that directory, with whatever the tool left in it, once the tool's process group has been killed and the tool reaped, whether the run succeeded, failed, was cancelled, or passed its bound, so a tool ended early leaves nothing under the host's TMPDIR either. A run whose directory can't be made fails before the tool starts.

Other system tools

Program From Minimum Stages
gs Ghostscript 10.0 document
qpdf qpdf 11.0 document
pdfdetach poppler-utils 22.02 document
pdftotext poppler-utils 22.02 document
pdfinfo poppler-utils 22.02 document
magick ImageMagick 7.1 office, picture, vision
soffice LibreOffice 24.2 office, picture
rsvg-convert librsvg 2.58 office, picture
7zz 7-Zip 26.06 archive
ffmpeg, ffprobe FFmpeg 9.0 audio, video

7zz's minimum is its mise pin, 26.06: 25.00 fixes CVE-2025-53816 in RAR's decoder, 26.02 fixes CVE-2026-14266 in xz's, and 26.03 through 26.06 fix vulnerabilities they don't name. The text stage runs no tool.

rsvg-convert renders every SVG, never magick: a magick built without librsvg, as Debian 13's is, renders SVG through ImageMagick's own MSVG renderer, which follows an SVG's references to files and URLs. rsvg-convert's minimum, 2.58, is Ubuntu 24.04 LTS's version, after 2.56.3 fixed CVE-2023-38633, a path traversal through an SVG's reference. The office stage runs no rsvg-convert, since it hands an Office document's SVGs on as stored, but it requires one, because it shares the picture package's Converter.

stages.Build runs soffice by default inside picture.LibreOfficeImage, a digest-pinned image, through the container runner and the docker CLI, 20.10 or later, which it finds through the lookup as docker. With stages.Options.LibreOfficeExec set, it runs soffice on the host through the exec runner instead and never looks up docker: it finds soffice through the lookup as soffice, runs it under every exec-run tool's bounds except the memory bound, which stages.Options.LibreOfficeMemory sets, and names soffice's path in its row in Set.Tools. stages.Build runs every other tool, ffmpeg and ffprobe among them, through the exec runner alone. audio.FFmpegImage is the image for a host that builds ffmpeg and ffprobe itself through tool.NewContainer.

The memory bound

stages.Options.Memory, each tool's tool.Spec.MemoryLimit, has no default. Set, the container runner passes it as --memory, and the exec runner starts every run of the tool through util-linux's prlimit --as=<bytes> --, so the address-space bound is in place before the tool runs: prlimit must then be on PATH, and tool.NewExec refuses a bounded tool without it. A tool that dies by a signal under the bound is recorded with both, as in "killed by SIGABRT under a 256 MiB memory bound".

Run through the exec runner, soffice takes its own bound, stages.Options.LibreOfficeMemory, in place of Memory. It has no default either: zero runs soffice with no bound. soffice needs a far larger RLIMIT_AS than the other tools: soffice 26.8 fails to write its output under 4 GiB on a host where it converts under 8 GiB. Run in the container, soffice stays under Memory, the container's --memory.

Apache-2.0.

About

Extraction for Go: text, metadata, and media from binary documents, messages, and streams, with the system tools it runs.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages