Self-identify the OpenAPI spec + add hlint/weeder configs#148
Merged
Conversation
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.
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.
What
info.version/info.titlewere blank (servant-openapi3 default), so a publishedopenapi.jsoncould not be anchored or diffed across releases.volcaOpenApinow stamps them from the engine version and a fixed title..hlint.yaml(activates the CI hlint step, which skips when no config is present) andweeder.toml(unused-export / dead-module detection; needs an HIE build).weeder.tomlis un-ignored so the config is tracked.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).