Skip to content

Self-identify the OpenAPI spec + add hlint/weeder configs#148

Merged
ccomb merged 11 commits into
mainfrom
chore/engine-release-hygiene
Jun 24, 2026
Merged

Self-identify the OpenAPI spec + add hlint/weeder configs#148
ccomb merged 11 commits into
mainfrom
chore/engine-release-hygiene

Conversation

@ccomb

@ccomb ccomb commented Jun 23, 2026

Copy link
Copy Markdown
Owner

What

  • OpenAPI self-identificationinfo.version/info.title were blank (servant-openapi3 default), so a published openapi.json could not be anchored or diffed across releases. volcaOpenApi now stamps them from the engine version and a fixed title.
  • Hygiene configs — add .hlint.yaml (activates the CI hlint step, which skips when no config is present) and weeder.toml (unused-export / dead-module detection; needs an HIE build). weeder.toml is un-ignored so the config is tracked.
  • pyvolca docs — regenerate the api-reference block to pick up the wire-compatibility note the generator now emits.

Why

Lets the API surface be version-anchored (the spec self-identifies) and the engine's lint / dead-code be enforced in CI. The first hlint run surfaces ~89 default hints to fix or baseline (follow-up).

ccomb added 11 commits June 23, 2026 15:16
servant-openapi3 leaves info.version and info.title blank, so a published
openapi.json cannot be anchored or diffed against a prior release. Stamp them
from the engine version and a fixed title in volcaOpenApi.
.hlint.yaml activates the CI hlint step, which skips when no config is present.
weeder.toml configures unused-export / dead-module detection (needs an HIE
build). Un-ignore weeder.toml so the config is tracked.
Picks up the wire-compatibility note (pyvolca 0.6.0, wire 1, engine >= v0.8.0)
the generator now emits but the committed README lagged.
Export to all five formats, in-place database editing, the activity_name /
product_name split, far wider EF 3.1 coverage, octet-stream uploads, global
substitution, and the ecoinvent waste-treatment / EcoSpold-subdir / not-found
/ missing-CSV fixes.
Apply hlint's default suggestions across src/ and fix a name-shadowing
warning. Behavior is unchanged (full test suite green).

Highlights:
- Point-free / idiomatic rewrites: eta reductions, fromMaybe/catMaybes/
  lefts/rights/sortOn, maybe/fromMaybe for case-on-Maybe, void/<$>,
  tuple sections, unless/when, lambda-case, guard reordering.
- Replace `typeOf (undefined :: T)` with `typeRep (Proxy :: Proxy T)`,
  avoiding the partial `undefined`.
- Drop six unused LANGUAGE pragmas.
- Rename the local `unitName` in EcoSpold.Parser2 that shadowed the
  Types import (-Wname-shadowing).

The one remaining hint (`Use head` in Method.ParserCSV) is baselined in
.hlint.yaml: the indexing is guarded, and `head` is a partial function
we avoid project-wide.
Make the tree warning-free so a -Werror build passes:

- API.OpenApi: drop imports only mentioned in comments (toJSON; the
  Database.Manager dependency-choice types; the whole Types import) —
  the ToSchema instances they document live next to their data decls.
- API.MCP: drop the unused isTechnosphereExchange import and the
  BioFlowDB argument of mkMcpCrossDBEntry (the entry builder never
  touched it, so the flow DB was threaded in for nothing).
- Tools.SynonymsCompiler: discard the unused name->group map from the
  union-find fold (only the group sets are returned), and rename a
  local that shadowed Options.Applicative.value.
- ServiceSpec: remove an unused mkTechFlow helper.
…uite

Both specs are picked up by hspec-discover and already run, but they were
missing from the test suite's other-modules. -Wmissing-home-modules flags
that, which fails a -Werror build; declaring them fixes it without changing
what runs.
The benchmark no longer compiled against the engine; its loader/LCIA
calls had drifted from the API:

- buildDatabaseWithMatrices / parseSimaProCSV gained a WasteFlowDB.
- loadDatabaseWithCrossDBLinking gained a GeographyPolicy (pass the
  permissive GeoGlobal, matching how the manager loads cross-DB).
- buildMethodTables gained an EnergyDensityMap (empty here).
- the empty Database needs dbWasteFlows; emptyCrossDBLinkingStats is
  gone, use the CrossDBLinkingStats Monoid (mempty).
weeder must be built with the project's GHC (HIE format is version-locked),
and each component needs its own HIE dir so the exe's and the test suite's
two `Main` modules don't collide — a shared dir hides the real entry point
and makes nearly everything look dead. Document that invocation.

With HIE generated correctly, weeder reports 44 findings, all in
exposed-modules. They are baselined as roots with grouped reasons: most are
public library API consumed only out-of-repo (writers, cache loaders, Type
lookups, parsers), which weeder cannot see; a tagged subset is genuinely
dead (LCIA placeholder stubs, a few orphan helpers, unused test fixtures)
and is parked here for a maintainer to delete in a dedicated pass.
The previous regeneration pasted the `volca._compat` compatibility footer
inside the api-reference block, but `render_reference()` never emits it (it
belongs to the separate compatibility block, which was already correct). The
stray lines made the committed block diverge from the generator output, so
`test_readme_api_reference_in_sync` failed CI.

Regenerated with `gen_api_md.py --write`; the api-reference block now matches.
@ccomb ccomb merged commit 646a64e into main Jun 24, 2026
8 checks passed
@ccomb ccomb deleted the chore/engine-release-hygiene branch June 24, 2026 07:05
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