Skip to content

harness.layout · docproc - #49

Merged
JaimeStill merged 10 commits into
mainfrom
docproc
Nov 29, 2026
Merged

JaimeStill merged 10 commits into
mainfrom
docproc

Conversation

@JaimeStill

Copy link
Copy Markdown
Contributor

harness.layout · task 9/17 · docproc

Summary

  • docproc takes the layout: .agent/state/ replaces .claude/briefs/ in the ignore lines,
    MISE_ENV=agent is set in the Claude settings, and mise.agent.toml is the only mise profile.
  • A person's mise tasks lists only build, check, currency, fmt, tidy, upgrade, and
    the integration tasks. An agent also sees check:go, check:sqlint, check:tools,
    check:lints, test, vet, and lint.
  • The check runs four step scripts: Go, sqlint, tools, then the lints. CI's go and lints jobs
    call the scripts directly, never under MISE_ENV=agent.
  • Every multi-line task is a file task, at the root and in mail, onenote, and ooxml. mail's
    fixtures profile is now the generator directory's own mise configuration.
  • All four modules' tests sit in <pkg>/test/, and test names are unchanged. Two exceptions
    stay in place: the command's integration package, and the one export_test.go, the
    birth-time probe hook.
  • marathon 0.25.0, htmd 0.7.0, mail-parser 1.0.3. No exported API changes, and no tag.

Core changes

  1. stages/internal/adapter: the stage adapters and the failure classification are
    module-internal, and the tests drive the package's exported API. Why: the old stages
    export_test.go exported ~36 unexported names, which the standard bars. stages' public API
    (Build, Options, Set, Lookup, Routes, ParseRoutes, ErrRequest) is unchanged.
  2. internal/cli's Go media-name writer is gone. Production never called it; the Rust
    envelope owns the writer, and the shared cases still pass through ResolveMedium.
  3. tooltest.Testdata(t, pkg, elem...): a test that reads another package's fixtures
    resolves the path from the module root and fails on a missing file, instead of using ../.
    func Testdata(t testing.TB, pkg string, elem ...string) string
  4. Step scripts in scripts/check/ (go.sh, sqlint.sh, tools.sh, lints.sh): shellcheck
    now covers every file task, and the lints all run before the step fails.

Verify

mise run check: ✓ check: ok, tree clean, no go.work.sum · mise run test:integration: ✓

  1. mise tasks at the docproc root → build check currency fmt integration integration:postgres integration:storage test:integration tidy upgrade.
  2. MISE_ENV=agent mise tasks → the same, plus check:go check:lints check:sqlint check:tools lint test vet.
  3. mise run check; git status → check: ok, a clean tree, and no go.work.sum.
  4. mise run build; ls bin/ → docproc, and git status stays clean.
  5. git ls-files '*export_test.go' → only cmd/docproc/internal/run/export_test.go.
  6. mise run currency → only MimeKit, MsgKit, and typed-path, each marked held, exit 0.
  7. mise -C tools/mail/generator tasks → fixtures and tnef; ls tools/mail/mise.fixtures.toml
    → not found.
  8. mise run test:integration → builds the three tools, every package ok, exit 0.

Decided without you

  1. New stages/internal/stagestest helper package: the Build tests and the adapter tests share
    the program stand-ins, and the tests-and-docs standard puts such shared helpers in a
    <pkg>test package.
  2. The adapters' panic and error messages keep their stages: prefix, because a host sees them
    through stages.Build.
  3. CI jobs are renamed: lint → lints, check:go (…) → go (…). The main ruleset requires
    only the ci gate.
  4. The changelogs record the layout under Unreleased in the base, storage, postgres, and
    cmd/docproc modules, as core did. The system tools' changelogs, scoped to their output
    contract, record only the dependency bumps. New Decision for later migrations.
  5. mail-parser 1.0.2 → 1.0.3, released mid-task: a patch, with the goldens unchanged.
  6. mise trust was run locally for tools/mail/generator/mise.toml. Another checkout trusts it
    once; CI never loads it.
  7. No Decision dropped; two added (the fixture helper, the changelog rule).

Redirects and escalations

  1. Plan round 1, question 3: the exports are narrowed in this task, not deferred to a backlog
    goal.

Merge danger: two-way door · blast radius: docproc's tooling, test layout, and CI, plus the
goal record in claude-plugins · docproc: merge waits on CI, which runs the step scripts directly
for the first time · claude-plugins: merge waits on CI

Needs you: none

…0.7.0

Taken through mise run upgrade. The root mise pin for marathon moves 0.24.1 -> 0.25.0;
tools/mail takes htmd 0.7.0, whose two new converter options are opt-in, so nothing adapts.
MimeKit 5, MsgKit 3.1.0, and typed-path 0.13.0 stay held in their tools' HOLDS; currency
reports only those.

The marathon pin is a development toolchain pin outside the base module's contract, so the
root CHANGELOG takes no entry (as with the 0.24.1 bump); tools/mail's CHANGELOG records htmd
under Unreleased.
The check runs four step scripts under scripts/check/ directly: the Go
gates per module with GOWORK=off, sqlint over the postgres module (with
GOWORK=off), each tool's check and notices, then the lints last
(shellcheck over *.sh and the extensionless file tasks, actionlint, the
tag-routing test, lint-context, lint-references), every lint running
before the step fails.

The agent profile: mise.agent.toml includes mise-tasks and
.agent/mise-tasks, .claude/settings.json sets MISE_ENV=agent, and the
agent tasks check:go, check:sqlint, check:tools, check:lints, test, vet,
and lint wrap the step scripts. Without MISE_ENV a person sees check,
currency, upgrade, build, fmt, tidy, integration, integration:postgres,
integration:storage, and test:integration. Multi-line tasks are file
tasks; integration is mise-tasks/integration/_default beside its
postgres and storage members. The integration tasks' exit traps are
functions, since shellcheck now reads them. build is one line, cmd/docproc
into the git-ignored bin/. .gitignore lists .agent/state/ in place of
.claude/briefs/.

CI's go job runs go.sh and sqlint.sh, its lints job (renamed from lint)
lints.sh; no job sets MISE_ENV. The tools, go, and integration path
filters add mise-tasks/**, .agent/mise-tasks/**, and (tools and go)
scripts/check/**.

No step writes go.work.sum: every Go step already ran with GOWORK=off,
and neither check nor build reproduced the file.
…asks

Each tool's multi-line tasks are file tasks in its own mise-tasks/, under
the same names: mail's check, publish, golden, currency, and upgrade;
onenote's check, publish, and golden; ooxml's check, publish, currency,
golden, and upgrade, which is mise-tasks/upgrade/_default beside the
still hidden upgrade:packages. One-line tasks stay inline: mail's mboxrd,
onenote's currency and upgrade, ooxml's fixtures. A file task runs in its
config root, the tool's directory, as the inline tasks' dir did; each
starts set -euo pipefail. tools/envelope has no mise configuration.

mail's mise.fixtures.toml is gone: the generator's .NET pin, its env, and
its fixtures and tnef tasks (file tasks) live in tools/mail/generator's
own mise.toml and mise-tasks/, so mail's check and CI, run from
tools/mail, never load .NET. mail's currency and upgrade run the
generator's dotnet through mise exec in generator/, and upgrade reads the
SDK pin from generator/mise.toml. tools/currency.sh reads the mise tools
of the tool's mise.toml and of each subdirectory's mise.toml in place of
every mise.<env>.toml, naming a pin by its path under the tool
(generator/mise.toml), so upgrade rewrites it there.

The lints step's shellcheck covers tools/*/mise-tasks/*, the generator's
included. The docs and mail's README name generator/mise.toml in place of
MISE_ENV=fixtures.
…ternal; the Go media-name writer goes

The stage adapters and the failure classification move from stages into
stages/internal/adapter, whose exported API the stages tests drive; stages.Build
wires the stages from there, and stages/export_test.go goes. go doc ./stages
declares the same identifiers before and after; only the package comment's
lines on where the adapters live change.

- The adapter types, configs, constructors, the three PDF tool interfaces,
  Versions, PartErr, and Classify are exported; textStage, sevenZipReader, and
  exifReader stay unexported, since nothing outside the package names them, and
  NewTextStage returns a dispatch.Stage.
- classify's fault struct goes: Classify returns (content, reason), which the
  tests drove through export_test.go's wrapper.
- The office and picture stages' converters are reached by a Converter method,
  in place of export_test.go's PictureConverter and OfficeConverter functions.
- Each route's required programs move into adapter.Needs, which stages' table
  reads, so the identities test and Build share one list.
- Error and panic messages keep their "stages:" prefix, which a host reads;
  the panics now name the exported Config types (DocumentConfig.QPDF).
- internal/cli's unexported mediaName and its export_test.go go: the Rust
  envelope owns the writer. TestMediaNames keeps checking every name through
  ResolveMedium.

Test lists for stages and internal/cli are unchanged: 112 untagged, 155 under
the integration tag. No CHANGELOG entry: it covers the exported API only.
Every base-module package's tests move, with git mv, into <pkg>/test/ as
<pkg>_test, and each package's testdata into <pkg>/test/testdata: 155 test
files, the TestMain and integration-tagged suites among them, and twelve
testdata trees. Helper packages (tooltest, goldentest, dispatchtest) stay
where they are; their own tests move into their test/ directories.

- stages' tests split by the API they drive: the ones over Build, Routes, and
  ParseRoutes (TestParseRoutes, the TestBuild* tests, TestBuiltConfigs,
  TestClassification, TestClassificationNoBound, TestBuildBounds,
  TestEveryFixture, TestBuiltIdentities) sit in stages/test; the adapters'
  (TestStagesPanic, TestClassify among them) in stages/internal/adapter/test,
  as adapter_test.
- What both need, the stand-in of every program a stage runs, their settings,
  the stand-in office and picture stages, the dispatch helpers, and BuiltSet,
  is hoisted into stages/internal/stagestest, per the shared-helper rule; both
  TestMains pass tooltest.Main stagestest.Programs().
- A package reading another's fixtures names them through tooltest.Testdata(t,
  pkg, elem...), which finds the base module's root as Tools does and fails
  the test on a missing fixture, in place of ../ paths; the package-level
  fixture variables become functions of t, since a stand-in process runs the
  test binary outside the module.
- The tools' goldens still go through tooltest.Tools, unchanged: with tools/
  absent, every golden test skips naming the tree. tooltest's own
  TestTools and TestToolsMissingFile fail then, as they did before.
- stages' fixture list moves to stages/test/testdata/fixtures.tsv with every
  base-module path under test/testdata; cmd/docproc's integration harness and
  its tests read it there. .gitattributes, the testdata READMEs and
  generators, docs/acceptance.md, docs/design-review.md, docs/packages.md,
  docs/api.md, and adapter's package comment follow the move.
- document's pdfdetach test keys its Attachment literal: vet's composites
  check no longer treats document as the test's own package.

go test -list . ./... names the same tests per module before and after, with
and without -tags integration (565 and 677 in the base module). No CHANGELOG
entry: no exported API changes.
…c tests into test/; the docs

The storage, postgres, and cmd/docproc modules' tests move, with git mv, into
<pkg>/test/ as <pkg>_test, fixtures into <pkg>/test/testdata: storage's and
postgres's tests with their TestMains and integration-tagged suites, and
cmd/docproc's internal/app (with testdata/fallback.txt), internal/apptest,
and internal/report (with its golden and rundir testdata).

- Left in place: cmd/docproc/integration, the built-binary tier, and
  cmd/docproc/internal/run's export_test.go (SetBirth, the birth-time probe
  hook) with file_test.go, the one test using it; run has no other test.
  git ls-files '*export_test.go' lists only that file.
- app's requiredLibrary reads its module's go.mod one directory further up
  (../../../go.mod); it is the module's own file, not another package's
  fixture, so it stays a relative path rather than tooltest.Testdata.
- stages/test/testdata/fixtures.tsv names cmd/docproc's fixtures at their
  test/testdata paths.
- Docs: docs/development.md gains "Where the tests sit" (test/ placement,
  the shared helper packages, the module-internal adapters, the two
  exceptions, the agent's scratch area, pointing to tests-and-docs.md) and
  states the agent profile and who sees which tasks; docs/packages.md lists
  stages/internal/adapter and points to the placement; docs/ci.md says which
  jobs run step scripts and which a person's tasks, none under the agent
  profile; CLAUDE.md names the agent tasks and the test placement; README's
  Development line names both; app's package comment names
  test/graph_test.go; the provider READMEs say test:integration runs them
  after cmd/docproc's tier too.

go test -list . ./... names the same tests per module before and after,
GOWORK=off, with and without -tags integration: storage 7/9, postgres 8/28,
cmd/docproc 84/88. No CHANGELOG entry: each module's changelog covers its
contract alone (exported API, or cmd/docproc's command line, run directory,
and exit codes), and none changes.
TestAudioStageReal's closing check that the dispatcher kept its input
re-resolved the fixture through tooltest.Testdata, which fails the test
itself on a missing file, so the assertion's own message could never be
reported; the path is now resolved once and the Stat checks it. The
classify test's messages name PartErr, the function they call.
…paration

The mail fixture generator's notes, in its source and in the committed
manifest.json and truth.json it writes, named the removed fixtures
profile (MISE_ENV=fixtures); they name mise -C generator now. The mail
README said no tool task loads generator/mise.toml, though currency and
upgrade run there. docs/development.md put an agent's scratch tests in
.agent/state/, which agent-separation reserves for state; they go in the
agent area, .agent/. Two paragraphs rewrapped to 100 columns.
…-parser 1.0.3

Each module's changelog records the task under Unreleased, after go-core's and sqlate's: the
base module the test/ placement, the module-internal stage adapters, the removed media-name
writer, tooltest.Testdata, the check's step scripts, the agent tasks and profile, build, fmt,
tidy, and the file tasks; storage and postgres their test/ placement; cmd/docproc its test/
placement with its two exceptions and build's bin/docproc. The marathon pin takes no entry, as
neither precedent records one. tools/onenote's and tools/ooxml's changelogs cover their output
contract alone, so their file tasks take no entry; nor does tools/mail's generator move.

tools/mail locks mail-parser 1.0.3, taken through its upgrade task. Its fixes are to ISO-2022-JP
text with consecutive escape sequences and to its own HTML-to-text conversion, which
docproc-mail doesn't use (htmd converts HTML); re-recording the goldens, the ISO-2022-JP
fixtures among them, changes none. currency now reports only the held MimeKit, MsgKit, and
typed-path.
@JaimeStill
JaimeStill merged commit 6fa1e54 into main Nov 29, 2026
13 checks passed
@JaimeStill
JaimeStill deleted the docproc branch November 29, 2026 19:41
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