Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .agent/mise-tasks/check/go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's Go step, every gate in every module; gate names as arguments run only those"
# Runs scripts/check/go.sh, one step of the check.
set -euo pipefail
exec scripts/check/go.sh "$@"
5 changes: 5 additions & 0 deletions .agent/mise-tasks/check/lints
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's lints step, shellcheck, actionlint, the tag-routing test, lint-context, and lint-references at the root"
# Runs scripts/check/lints.sh, one step of the check.
set -euo pipefail
exec scripts/check/lints.sh "$@"
5 changes: 5 additions & 0 deletions .agent/mise-tasks/check/sqlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's sqlint step over the postgres module's statements and migrations"
# Runs scripts/check/sqlint.sh, one step of the check.
set -euo pipefail
exec scripts/check/sqlint.sh "$@"
5 changes: 5 additions & 0 deletions .agent/mise-tasks/check/tools
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's tools step, each tool's check and its third-party notices"
# Runs scripts/check/tools.sh, one step of the check.
set -euo pipefail
exec scripts/check/tools.sh "$@"
5 changes: 5 additions & 0 deletions .agent/mise-tasks/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's lint gate, golangci-lint, in every module"
# Runs the lint gate of scripts/check/go.sh.
set -euo pipefail
exec scripts/check/go.sh lint
5 changes: 5 additions & 0 deletions .agent/mise-tasks/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's test gate, go test with the race detector, in every module"
# Runs the test gate of scripts/check/go.sh.
set -euo pipefail
exec scripts/check/go.sh test
5 changes: 5 additions & 0 deletions .agent/mise-tasks/vet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
#MISE description="Run the check's vet gate, go vet, in every module"
# Runs the vet gate of scripts/check/go.sh.
set -euo pipefail
exec scripts/check/go.sh vet
3 changes: 3 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"plansDirectory": "./.claude/plans",
"env": {
"MISE_ENV": "agent"
},
"permissions": {
"allow": [
"Bash(mise run:*)",
Expand Down
16 changes: 8 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Fixtures pinned byte for byte, which git never converts.
# See docs/development.md
audio/testdata/speech.* -text
audio/testdata/speech-tagged.mp3 -text
audio/testdata/*.ffprobe.json -text
office/testdata/rtf/** -text
rundir/testdata/** -text
document/testdata/malformed/** -text
document/testdata/info/** -text
picture/testdata/exif-* -text
audio/test/testdata/speech.* -text
audio/test/testdata/speech-tagged.mp3 -text
audio/test/testdata/*.ffprobe.json -text
office/test/testdata/rtf/** -text
rundir/test/testdata/** -text
document/test/testdata/malformed/** -text
document/test/testdata/info/** -text
picture/test/testdata/exif-* -text
26 changes: 17 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CI: each system tool's check, the Go modules' check:go, the lint, and the providers' live tiers.
# CI: the check's steps, each tool's check, and the providers' live tiers.
# See docs/ci.md
name: CI

Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
with:
filters: |
ooxml:
- &shared ['.github/workflows/ci.yml', 'mise.toml', 'tools/*.sh', 'tools/envelope/cases.json']
- &shared ['.github/workflows/ci.yml', 'mise.toml', 'mise-tasks/**', '.agent/mise-tasks/**', 'scripts/check/**', 'tools/*.sh', 'tools/envelope/cases.json']
- 'tools/ooxml/**'
mail:
- *shared
Expand All @@ -62,6 +62,9 @@ jobs:
- '**/sqlint.toml'
- '.github/workflows/ci.yml'
- 'mise.toml'
- 'mise-tasks/**'
- '.agent/mise-tasks/**'
- 'scripts/check/**'
- 'tools/envelope/cases.json'
- 'tools/mail/tests/golden/**'
- 'tools/onenote/tests/golden/**'
Expand All @@ -85,8 +88,10 @@ jobs:
- 'compose/**'
- '.github/workflows/ci.yml'
- 'mise.toml'
- 'mise-tasks/**'
- '.agent/mise-tasks/**'

lint:
lints:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7.0.1
Expand All @@ -95,11 +100,11 @@ jobs:
with:
install_args: actionlint shellcheck github:standards-lab/claude-plugins

- name: mise run lint
run: mise run lint
- name: The lints step
run: scripts/check/lints.sh

go:
name: check:go (${{ matrix.runner }})
name: go (${{ matrix.runner }})
needs: changes
if: needs.changes.outputs.go == 'true'
strategy:
Expand All @@ -122,8 +127,11 @@ jobs:
key: go-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/go.sum') }}
restore-keys: go-${{ runner.os }}-${{ runner.arch }}-

- name: mise run check:go
run: mise run check:go
- name: The Go step
run: scripts/check/go.sh

- name: The sqlint step
run: scripts/check/sqlint.sh

tool:
name: check (${{ matrix.tool }}, ${{ matrix.runner }})
Expand Down Expand Up @@ -245,7 +253,7 @@ jobs:

ci:
if: always()
needs: [changes, lint, go, tool, integration]
needs: [changes, lints, go, tool, integration]
runs-on: ubuntu-24.04
steps:
- name: Fail if a needed job failed or was cancelled
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.claude/plans/
.claude/briefs/
.agent/state/
mise.local.toml
bin/

Expand Down
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,33 @@ tool under `tools/` keeps its own.

## [Unreleased]

### Changed

- Each package's unit tests sit in its `test/` directory as an external test package
(`<pkg>/test/*_test.go`), the helper packages `dispatch/dispatchtest`, `internal/tooltest`, and
`internal/goldentest` included, with each package's fixtures in `<pkg>/test/testdata/`. A test
reading another package's fixtures names them through `internal/tooltest.Testdata`, which fails
the test on a missing fixture, and the helpers the stages tests share are in the internal package
`stages/internal/stagestest`. No exported API changes.
- The stage adapters and the failure classification sit in the internal package
`stages/internal/adapter`, from which `stages.Build` wires the stages. `stages` declares the same
identifiers as before. No exported API changes.
- `internal/cli` no longer has its own unexported media-name writer, which nothing used: the Rust
envelope owns the writer.
- The repository's check runs as step scripts in `scripts/check/` (`go.sh`, `sqlint.sh`,
`tools.sh`, `lints.sh`), which `mise run check` runs in turn; CI's go and lints jobs run the
scripts themselves.
- Agent tasks live in the agent area, `.agent/mise-tasks/`, which only the `agent` profile
(`mise.agent.toml`, under `MISE_ENV=agent`) loads: `check:go`, `check:sqlint`, `check:tools`,
and `check:lints`, one per check step, and `test`, `vet`, and `lint`, one per gate of the Go
step. The inline `check:go` and `lint` tasks a person saw are agent tasks now: `check:go` runs
the Go step alone, its sqlint run is `check:sqlint`, the old `lint`'s lints are `check:lints`,
and `lint` runs golangci-lint. A person's tasks are `check`, `currency`, `upgrade`, `build`,
`fmt`, `tidy`, and the integration tasks.
- `build` builds the docproc command into the git-ignored `bin/`; `fmt` formats every Go source
file, and `tidy` runs `go mod tidy` in every Go module.
- The repository's multi-line tasks are file tasks in `mise-tasks/`, under the same names.

## [v0.11.0] - 2026-11-28

This release adds the package `settings`, which holds a run's settings as one flat JSON object, so
Expand Down
9 changes: 8 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ The extraction library adjacent to Go Elemental, with the system tools it runs n
`tools/onenote`.
- [`tools/envelope/src/lib.rs`](tools/envelope/src/lib.rs): docproc-envelope, the Rust tools'
shared envelope crate, tested by each Rust tool's check.
- `mise run check`: the check.
- `mise run check`: the check. `.claude/settings.json` sets `MISE_ENV=agent`, the agent profile,
which adds the agent's tasks under `.agent/mise-tasks/`: one per check step (`check:go`,
`check:sqlint`, `check:tools`, `check:lints`) and one per gate of the Go step (`test`, `vet`,
`lint`); [`docs/development.md`](docs/development.md) states every task, a person's and an
agent's.
- Tests: each package's tests sit in its `test/` directory, except `cmd/docproc/internal/run`'s
one `export_test.go` with the test that uses it, and the built-binary `cmd/docproc/integration`
package; [`docs/development.md`](docs/development.md#where-the-tests-sit) states where each sits.
- `mise run integration`: the providers' live tiers, `integration:postgres` and
`integration:storage`, each against its own compose service; `mise run test:integration`, the
pre-tag run, the tools tier and cmd/docproc's built-binary tier over this checkout's tool
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ the reference for its exported names, and its doc comment lists them.
- [The command](docs/command.md): `cmd/docproc`'s commands, exit statuses, and configuration.
- [Limits](docs/limits.md): what docproc doesn't read, and the limits each stage inherits from its
tool.
- [Development](docs/development.md): the toolchain, the tasks, the compose harness, and releases.
- [Development](docs/development.md): the toolchain, a person's and an agent's tasks, where the
tests sit, the compose harness, and releases.

## Providers

Expand Down
2 changes: 2 additions & 0 deletions STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ the tools part to the system tools under `tools/`.
- `architecture/principles/context-architecture.md`: the `docs/` pages, the tool contract on
`docs/tool-contract.md`, and the configuration's reasoning on `docs/development.md`,
`docs/ci.md`, and `docs/tool-builds.md`.
- `architecture/principles/agent-separation.md`: the agent area in `.agent/`, the agent profile in
`mise.agent.toml`, and `MISE_ENV=agent` in the Claude settings' `env`.
- `architecture/principles/comments.md`: each `.golangci.yml` enables nolintlint with
`require-explanation` and `require-specific`.
- `architecture/standards/go-elemental/principles/dependencies.md`: the base, `storage`,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions cmd/docproc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ postgres modules, and each system tool under `tools/` keep their own.

## [Unreleased]

### Changed

- Each package's tests sit in its `test/` directory as an external test package
(`<pkg>/test/*_test.go`), with its fixtures in `<pkg>/test/testdata/`, except two: the
built-binary tier in `integration/`, and `internal/run`'s test of its birth-time probe hook, which
stays beside its `export_test.go`. The command line, run directory, and exit codes don't change.
- `mise run build` at the repository root writes the docproc command to the git-ignored
`bin/docproc`.

## [v0.2.9] - 2026-11-28

This release reads its run bounds through the docproc base module's new package `settings`, at
Expand Down
6 changes: 3 additions & 3 deletions cmd/docproc/integration/fixtures_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func writeTree(t *testing.T, dir string, files ...string) {
func TestReadFixtures(t *testing.T) {
repo := t.TempDir()
writeTree(t, repo,
"stages/testdata/fixtures.tsv", "b/testdata/two.txt\ttext\tprepared\na/testdata/one.zip\tarchive\tprepared\n",
"stages/test/testdata/fixtures.tsv", "b/testdata/two.txt\ttext\tprepared\na/testdata/one.zip\tarchive\tprepared\n",
"a/testdata/one.zip", "one", "b/testdata/two.txt", "two")

got, err := integration.ReadFixtures(repo)
Expand All @@ -43,7 +43,7 @@ func TestReadFixtures_NoTree(t *testing.T) {

_, err := integration.ReadFixtures(repo)

list := filepath.Join(repo, "stages", "testdata", "fixtures.tsv")
list := filepath.Join(repo, "stages", "test", "testdata", "fixtures.tsv")
if !errors.Is(err, integration.ErrNoFixtures) || !strings.Contains(err.Error(), list) {
t.Errorf("ReadFixtures = %v, want an error matching ErrNoFixtures naming %s", err, list)
}
Expand All @@ -52,7 +52,7 @@ func TestReadFixtures_NoTree(t *testing.T) {
func TestReadFixtures_MissingFixture(t *testing.T) {
repo := t.TempDir()
writeTree(t, repo,
"stages/testdata/fixtures.tsv", "a/testdata/one.zip\tarchive\tprepared\na/testdata/gone.pdf\tdocument\tprepared\n",
"stages/test/testdata/fixtures.tsv", "a/testdata/one.zip\tarchive\tprepared\na/testdata/gone.pdf\tdocument\tprepared\n",
"a/testdata/one.zip", "one")

_, err := integration.ReadFixtures(repo)
Expand Down
8 changes: 4 additions & 4 deletions cmd/docproc/integration/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var hostBounds = []string{
// run still going after it is a stall, killed, failing its test with its output.
const Bound = 10 * processtest.Failsafe

const fixtureList = "stages/testdata/fixtures.tsv"
const fixtureList = "stages/test/testdata/fixtures.tsv"

// ErrNoFixtures is what [ReadFixtures] fails with when the fixture tree is absent.
var ErrNoFixtures = errors.New("integration: no fixture tree")
Expand Down Expand Up @@ -232,9 +232,9 @@ func Fixtures(t testing.TB) []string {
}

// ReadFixtures returns the absolute paths of the committed fixtures of the repository at repo, in
// the order its list, stages/testdata/fixtures.tsv, names them. It fails matching [ErrNoFixtures],
// naming the list, when the list is absent, as it is outside a docproc checkout, and names every
// fixture the list names that is missing from the tree.
// the order its list, stages/test/testdata/fixtures.tsv, names them. It fails matching
// [ErrNoFixtures], naming the list, when the list is absent, as it is outside a docproc checkout,
// and names every fixture the list names that is missing from the tree.
func ReadFixtures(repo string) ([]string, error) {
repo, err := filepath.Abs(repo)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/docproc/internal/app/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
// [Nodes] holds one handle per node: each define function fills its own part of one Nodes
// value, and its constructors read the lower layers' nodes from it with Use. Each field's node is
// named for the field, so no comment names it; graph_test.go checks that rule with go-core's
// named for the field, so no comment names it; test/graph_test.go checks that rule with go-core's
// graphtest.CheckNames, and checks that every leaf of the tree, as Command.Leaves yields it,
// builds its nodes without dropping an order between layers. Defining the nodes constructs
// nothing. A command declares the nodes it needs with Use; the dispatcher builds them, with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ func requiredLibrary(t *testing.T) string {
if os.Getenv("GOWORK") != "off" {
return "(devel)"
}
mod, err := os.ReadFile(filepath.Join("..", "..", "go.mod"))
mod, err := os.ReadFile(filepath.Join("..", "..", "..", "go.mod"))
if err != nil {
t.Fatal(err)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 9 additions & 7 deletions dispatch/stage_test.go → dispatch/test/stage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ import (

"github.com/standards-lab/docproc/dispatch"
"github.com/standards-lab/docproc/inspect"
"github.com/standards-lab/docproc/internal/tooltest"
"github.com/standards-lab/docproc/route"
)

type container struct {
world map[string]string
entered chan string
release chan struct{}
world map[string]string
fixtures string
entered chan string
release chan struct{}

mu sync.Mutex
calls map[string]int
Expand All @@ -33,8 +35,8 @@ type remaining struct {
ok bool
}

func newContainer(world map[string]string) *container {
return &container{world: world, calls: map[string]int{}, remaining: map[string]remaining{}}
func newContainer(world map[string]string, fixtures string) *container {
return &container{world: world, fixtures: fixtures, calls: map[string]int{}, remaining: map[string]remaining{}}
}

func (c *container) remainingOf(name string) (remaining, bool) {
Expand Down Expand Up @@ -82,7 +84,7 @@ func (c *container) Prepare(ctx context.Context, p dispatch.Part, dir string) it
var content []byte
if verb == "file" {
content = []byte(c.world[arg])
} else if content, err = os.ReadFile(filepath.Join("..", "inspect", "testdata", arg)); err != nil {
} else if content, err = os.ReadFile(filepath.Join(c.fixtures, arg)); err != nil {
yield(dispatch.Item{}, err)
return
}
Expand Down Expand Up @@ -176,7 +178,7 @@ func newFixture(t *testing.T, world map[string]string, index dispatch.Index, lim
}
f := &fixture{
index: index,
text: newContainer(world),
text: newContainer(world, tooltest.Testdata(t, "inspect")),
pdf: &leaf{name: "pdf"},
archive: &leaf{name: "archive", err: errors.New("archive: can't read entry")},
dir: t.TempDir(),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/acceptance.md
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ The whole-file run, one process for the 915 pages, is for context.
### What doesn't improve

- The paragraphs of columns that line up may alternate between the columns: pdftotext reads
`document/testdata/clean.pdf`'s page 2, two columns of paragraphs side by side, a paragraph
`document/test/testdata/clean.pdf`'s page 2, two columns of paragraphs side by side, a paragraph
from each in turn.
- A word hyphenated at a line's end is joined, its hyphen dropped: `informa-` and `tion` read as
`information`.
Expand Down
8 changes: 5 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ dispatch the walk over an input's parts, the Stage contract an
imports route and inspect only, any 64-bit platform
dispatch/dispatchtest the Index and Content conformance suites and the fixture stage
stages Build and its Options, Routes and ParseRoutes, the stage
adapters, unexported, the failure classification, the
adapters, module-internal, the failure classification, the
identities
settings a run's settings as one JSON object, validated and assembled
into stages.Options, dispatch.Limits, and the release and
output-writes bounds
internal/tooltest, test helpers: the unit tier's stand-in tool, golden sums, and
goldentest, mediatest media's stand-in ffmpeg run
stages/internal/stagestest test helpers the stages and adapter tests share: the stages'
stand-in programs and stages, and the dispatch helpers
rundir, rundir/schema cmd/docproc's run directory: its shapes, read and written
metadata the metadata records' shapes, one per format; imports dispatch
only
Expand Down Expand Up @@ -775,8 +777,8 @@ output without them and nothing clears them. `Tool.Err` stays local beside its t
sniffing of an input, which is the host's record's (`rundir/schema`'s `File`).

`stages` is docproc's shipped wiring, so `cmd/docproc` and Bunrei wire the same stages from the
tools a host holds. It holds the stage adapters, unexported: a stage has its tools or doesn't
exist, so no adapter has a partial mode.
tools a host holds. It holds the stage adapters, module-internal in `stages/internal/adapter`: a
stage has its tools or doesn't exist, so no adapter has a partial mode.

```go
package stages
Expand Down
Loading