Repository navigation
docproc-settings: a settings package for a dispatch's run settings; DOCPROC_OUTPUT_WRITES; v0.11.0 - #47
Merged
Conversation
cmd/docproc requires go-core v0.14.0, from v0.12.0. Neither v0.13.0's breaking change, EventKind.Raise taking a trailing event.RaiseOptions, nor v0.14.0's new sse package reaches cmd/docproc, which raises no event, so the bump needs no adaptation. cmd/docproc's CHANGELOG is unchanged: its prior entries name a dependency only when it requires the next base release. docproc-mail and docproc-onenote move to Rust 1.100.1 and cargo-deny 0.22.2. Their CHANGELOGs are unchanged, as the toolchain is not their output contract. picture.LibreOfficeImage moves to gotenberg/gotenberg 9.10.3-libreoffice, pinned by its multi-arch index digest from crane, with an Unreleased entry in the base CHANGELOG. The integration tier was not run against the new image. The workflows move to jdx/mise-action v5.4.0. MimeKit, MsgKit, and typed-path stay held with their hold reasons; currency reports only them.
settings.Settings holds docproc's 21 run settings, one flat snake-case key per DOCPROC_ variable plus puts, each a pointer field so unset (nil) is told from an explicit zero, which means no bound. A Go caller sets a key with new(v). Decode reads JSON and validates in one step; Validate validates settings built in code. Every refusal names its key and wraps settings.ErrRequest. Decisions: - Decode takes []byte, so every error is the input's: input that isn't one JSON object, an unknown key, a wrong JSON type, or trailing data. - Durations decode as Go duration strings through an unexported wire struct of json.RawMessage fields shadowing the four duration keys, so Settings keeps *time.Duration fields for Go callers. - Validate joins every refusal; the missing required keys are one error. - audio_limit set to zero is refused, as cmd/docproc's parseAudioLimit refuses it, alongside anything audio.NewCutter refuses. - bomb_size stays uint64, as inspect.Options takes it; a negative one is refused at decoding, naming the key. - The package imports audio alone of docproc's packages; the assembly into stages.Options and dispatch.Config is the next slice's.
settings.Run holds a run's settings as stages.Options, dispatch.Limits, the claim release bound, and the puts in flight, mirroring cmd/docproc's Bounds plus Puts. Settings.Assemble validates first and refuses with ErrRequest, so an unvalidated value never dereferences a nil key. An unset optional key assembles to its default: pdf_dpi to document.DefaultDPI, audio_limit to audio.DefaultWindowLimit, and concurrency and puts to 1. Every option no key covers stays zero, the host's own. settings now imports stages and dispatch; go list -deps shows no cycle and no requirement beyond golang.org/x/text. Tests: a table test from JSON through Decode to the whole Run, every field compared, so uncovered fields are proven zero; refusals of unvalidated values; stages.Build over stand-in document tools, where pdf_dpi and pdf_text change the document stage's identity and the set's inspection options are the assembled ones; and dispatch.New over the assembled Limits, Release, and Puts, where max_bytes decides whether a text input is prepared or limited. docs/api.md gains the Settings section (signatures, key table, required and optional keys, formats, defaults); packages.md, layers.md, the api.md package list, and context/README.md list the package.
…ettings.Run; DOCPROC_PUTS newBounds starts a settings.Settings with all 21 keys at docproc's starting values (puts 1, the old runner const), lets each DOCPROC_ variable override its key through go-core's config.SetFromEnv (unset or empty keeps the starting value), and returns s.Assemble(). The bounds node now holds a settings.Run; the app.Bounds type is gone, and run.Config carries the settings.Run as Bounds in place of its Stages, Limits, and Release, so the runner takes Puts from it. DOCPROC_PUTS is new; docs/command.md gains its row. Refusals: cmd/docproc's parsers keep only the per-variable format checks (a whole number, in range for its type; a Go duration; a number; a switch; bomb_size, unsigned, below zero). Every range and cross-key rule (below zero, below 1, the bomb pair, finite bomb ratio, the audio limit) comes from settings.Validate through Assemble. Each refusal is joined after the parse errors with its settings key mapped to its variable by config.EnvName, the settings package's own naming rule, and the "settings: " prefix and ErrRequest suffix dropped, so the operator sees e.g. "bounds: DOCPROC_PUTS: 0 is below 1" and "bounds: DOCPROC_BOMB_RATIO and DOCPROC_BOMB_SIZE: set both above zero, or both to zero for no bomb rule"; the existing audio-limit message is unchanged. cmd/docproc's go.mod replaces github.com/standards-lab/docproc with ../.., as 0dab39f, 27b1246, and 1e0bff1 did, so its GOWORK=off build and tests take this checkout's settings package until v0.11.0 is tagged; the require stays v0.10.0, and go mod tidy drops v0.10.0's go.sum lines. Tests: bounds_test.go's helpers take settings.Run (startingBounds gains Puts 1) and boundVars lists DOCPROC_PUTS, so the every-variable tests cover it; no assertion changed. New: DOCPROC_PUTS overrides puts and empty keeps 1; 0, -2, and x fail naming DOCPROC_PUTS; zero DOCPROC_CONCURRENCY and DOCPROC_PDF_DPI keep their documented default; the bomb pair's whole message; a parse and a range refusal joined; a bad DOCPROC_PUTS fails docproc run before any tool lookup. Decisions: - DOCPROC_CONCURRENCY and DOCPROC_PDF_DPI at 0 leave their key unset, so Assemble gives 1 and document.DefaultDPI, keeping "zero is 1" and "zero is document.DefaultDPI"; settings refuses an explicit 0 for both. - Refusal text is rewritten from settings' messages rather than duplicated: settings has no structured refusal, and its keys are by design the variables' names. mise run check passes.
…, postgres v0.1.9, cmd/docproc v0.2.9 - CHANGELOG.md: [Unreleased] becomes [v0.11.0] - 2026-11-28, an empty Unreleased above it and the compare links extended, as d66d5f3 did. Added lists the settings package: Settings, Decode, Validate, ErrRequest, Run, Assemble, the 21 keys, the four optional ones and their defaults; the Gotenberg 9.10.3 entry stays under Changed. The README's go get line names v0.11.0. - storage v0.1.9 and postgres v0.1.9: their CHANGELOGs require base v0.11.0 and say what reaches a caller (nothing stored or indexed changes; no stage identity moves); their README install lines name v0.1.9. - cmd/docproc v0.2.9: Added DOCPROC_PUTS; Changed the move onto settings, every existing variable keeping its meaning, format, and default, the Gotenberg 9.10.3 image as v0.2.8 listed its pin moves, and go-core v0.14.0. Decisions: - The go.mod files don't move here. v0.11.0 isn't tagged, and check:go resolves each module with GOWORK=off, so storage and postgres stay on v0.10.0 and cmd/docproc keeps its replace => ../.. with the require at v0.10.0, as 0dab39f left it. At SHIP, after v0.11.0 is tagged, one commit bumps the three requires to v0.11.0 and drops cmd/docproc's replace, as 0cb2f43 did, before the provider and command tags. - The provider CHANGELOGs and READMEs are written now rather than in that later commit, since the brief puts them in this slice. mise run check passes.
…e refusal, not its text cmd/docproc rewrote settings' error strings, cutting their prefix and suffix and splitting the key off the reason, so a change to settings' wording would silently mis-name a variable. A refused value is now a settings.KeyError carrying its keys and reason, wrapping ErrRequest, as dispatch.StoreError and tool.VersionError carry theirs; cmd/docproc renders it. Every message is unchanged. Standard: construction-and-execution (a refusal matches its package's ErrRequest), consistency with the library's structured errors.
… wires stages and dispatch from a settings.Run
The settings key puts becomes output_writes, settings.Settings.Puts and settings.Run.Puts become OutputWrites, and cmd/docproc's DOCPROC_PUTS becomes DOCPROC_OUTPUT_WRITES, in code, tests, doc comments, docs, and the unreleased v0.11.0 and cmd/docproc v0.2.9 changelog entries. - dispatch.Config.Puts, shipped in v0.10.0, keeps its name; the key table maps output_writes to it, and Run.OutputWrites is passed as Puts. - The docs describe the key as the most outputs one part writes to the content store at once, at least 1, default 1. - Behavior is unchanged: optional, default 1, a value below 1 refused naming output_writes (DOCPROC_OUTPUT_WRITES in cmd/docproc).
…Bounds names OutputWrites as dispatch's Puts - cmd/docproc/CHANGELOG.md: the v0.2.9 lede's first line ran to 103 columns after the rename; rewrapped to 100. - run.Config.Bounds' doc ran to 100+ columns and called OutputWrites a dispatch's field; it now reads "the Limits, Release, and OutputWrites, as Puts, each dispatch takes", as settings.Run's doc does.
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 12/17 · docproc-settings
Summary
settingspackage: a dispatch's run settings as one JSON object of 21 flatsnake-case keys, refused by name when wrong, assembled into the library's own shapes.
0means no bound);pdf_dpi,audio_limit,concurrency, andoutput_writesare optional, defaulting todocument.DefaultDPI,audio.DefaultWindowLimit, 1, and 1.DOCPROC_variables into onesettings.Settings, gainsDOCPROC_OUTPUT_WRITES, and keeps every existing variable's meaning, default, exit code, andrun dir.
mise-action v5.4.0; MimeKit, MsgKit, typed-path stay held.
v0.11.0,storage/v0.1.9,postgres/v0.1.9,cmd/docproc/v0.2.9(CHANGELOGs and README install lines written).
Core changes
ErrRequest; every unset required key named in one error. Why: the library ships no policy,so a host must state each bound.
jobsand cmd/docproc wire stages and dispatch from thesame value; uncovered options (
Exclude,Env,Picture, …) stay each host's own.settings.Settingsfrom today's starting values plusthe environment and returns its
Run;app.Boundsand the runner'sconst putsare gone.output_writes/DOCPROC_OUTPUT_WRITES: the most outputs one part writes to the contentstore at once (default 1), landing in
dispatch.Config.Puts, which keeps its v0.10.0 name.Verify
mise run check: ✓ docproccheck: ok(every module and tool); ✓ capstone-bunrei0 issues.mise run currency(docproc): only MimeKit, MsgKit, typed-path, held.From
~/architecture/docproc/cmd/docproc,go build -o /tmp/docproc ., then in a dir within.txt:DOCPROC_MAX_PARTS=-1 DOCPROC_UNIT_TIMEOUT=ten DOCPROC_PDF_TEXT=maybe DOCPROC_AUDIO_LIMIT=3s DOCPROC_TOOL_MEMORY=abc PATH=/nonexistent /tmp/docproc run in.txt --out o→bounds:and oneline naming each of the five variables, no tool table, exit 1.
DOCPROC_OUTPUT_WRITES=0 …→DOCPROC_OUTPUT_WRITES: 0 is below 1, exit 1;DOCPROC_OUTPUT_WRITES=x→"x" is not a whole number, exit 1;DOCPROC_PUTS=0is nolonger read, exit 0.
DOCPROC_BOMB_RATIO=0 …→DOCPROC_BOMB_RATIO and DOCPROC_BOMB_SIZE: set both above zero, or both to zero for no bomb rule, exit 1.DOCPROC_OUTPUT_WRITES=4 /tmp/docproc run in.txt --out r1→text prepared 1,failed parts 0, exit 0./tmp/docproc runand--workers 0→ exit 2, as before.grep -A2 ^require go.modat docproc's root →golang.org/x/textalone.Decided without you
settings.KeyError(standards review): cmd/docproc was rewritingsettings' messagetext to name the variables; now it reads
Keysthrougherrors.As. A new export beyond thebrief's list. Reject it and cmd/docproc goes back to parsing text.
settings, so a few refusals of existingvariables are worded differently (e.g.
DOCPROC_BOMB_RATIO=-3→ "isn't a finite number ofzero or more"; a negative
DOCPROC_AUDIO_LIMIT→ the over-4s message). Each is still refusedand names its variable.
0forDOCPROC_CONCURRENCY/DOCPROC_PDF_DPIas unset, so theirdocumented "zero is the default" holds; a JSON host gets
Decode's stricter refusal of a set0, and
jobskeeps the strict rule (new Decision).audio_limitof 0 is refused, as cmd/docproc refused it;Decodetakes[]byte;Settingshas noMarshalJSON.replace => ../..) until basev0.11.0is tagged; adocproc-settings-requirePR then bumpsstorage, postgres, and cmd/docproc to it and drops the replace, and the three sub-module tags
go on its merge commit.
contract doesn't change.
settings/doc.goand docproc'sdocs/api.md"Settings" state it.Redirects and escalations
putskey andDOCPROC_PUTStooutput_writesandDOCPROC_OUTPUT_WRITES;dispatch.Config.Putskeeps its name. Done in 6cbb32c, standardsfix 1cc4d4f, spec review: no gaps.
Merge danger: one-way door for the four tags (module proxy, then Bunrei's
jobs); all elsetwo-way · blast radius: docproc's four modules, cmd/docproc's operators (one new variable,
DOCPROC_OUTPUT_WRITES) · docproc: merge waits on CI (gh pr checks --watch), each tag onmarathon ci; the integration tier against gotenberg 9.10.3 runs only in CI (containers) ·capstone-bunrei: the goal record only, merge waits on CI · tags:
v0.11.0, thenstorage/v0.1.9,postgres/v0.1.9,cmd/docproc/v0.2.9after the require PRNeeds you: none