Skip to content

[test] Verify CI workflow + upload_accounts fixes + podman test DB#624

Merged
zaucker merged 10 commits into
oposs:mainfrom
zaucker:test-ci-fixes
May 8, 2026
Merged

[test] Verify CI workflow + upload_accounts fixes + podman test DB#624
zaucker merged 10 commits into
oposs:mainfrom
zaucker:test-ci-fixes

Conversation

@zaucker
Copy link
Copy Markdown
Contributor

@zaucker zaucker commented May 7, 2026

Test PR — verifies that the CI workflow changes and code fixes work correctly. Not for merging in this form; this PR is to surface CI green/red status and any remaining issues.

Contents

Three commits (all already on zaucker:main; this branch points at the same HEAD):

  1. 270643a4 "fixes and text/gui improvements from Thomas (fixes and text/gui improvements from Thomas #623)"
  2. e735475c "Add podman-based test DB targets to top-level Makefile"
  3. 1335a917 "Fix upload_accounts handlers, OpenAPI spec, and CI workflow; update CropResidues fixtures"

What changed and why

Bug fixes the upstream CI was failing on:

  • lib/Agrammon/Web/Routes.rakumod and APIRoutes.rakumod — the upload_accounts handlers had bad-request followed by fall-through into success-path code; bad input ended up returning 500 instead of 400. Restructured with explicit if/else.
  • share/agrammon-rest.openapi — added a '400' response (without it Cro's response validator turned 400s into 500s) and dropped format: binary on the accounts field (Cro's multipart parser hands the validator a decoded Str, which the binary-string check rejects).
  • t/routes-user.rakutest — added use Cro::HTTP::Body; so Cro::HTTP::Body::MultiPartFormData::Part resolves.

Test fixture updates for the PlantProduction::CropResidues model addition (numerical drift was masking real problems in CI):

  • t/run-complex-model-with-filters.rakutest — new expected nh3/n outputs for hr-inclNOxExtendedWithFilters, old values preserved as comments per existing convention.
  • t/webservice.rakutestget-outputs-for-rest SummaryTotal updated 141 → 156.

CI workflow cleanup (.github/workflows/backend-and-models.yml):

  • bump actions/checkout@v2@v4 (Node 20 deprecation)
  • fail-fast: false so both ubuntu-22.04 and -24.04 legs report independently
  • actions/cache path: $HOME/.agrammon~/.agrammon (the action does not expand $VAR; the model cache was effectively never hitting)
  • replace deprecated CREATE GROUP with CREATE ROLE + GRANT
  • scope the postgres --health-cmd pg_isready to -U postgres -d agrammon_test so the service log isn't flooded with role "root" does not exist from health probes
  • drop -v from the prove6 invocation; CI logs were huge

New developer convenience (Makefile.am, t/README):

  • make db-start / make db-stop / make test etc. wrap the existing t/Dockerfile so contributors can run the full DB-backed suite locally with one command.

Local test result

Against the podman-launched test DB:

Files=46, Tests=503,  329 wallclock secs
Result: PASS

Test plan

  • Agrammon backend and models workflow on ubuntu-22.04 passes
  • Agrammon backend and models workflow on ubuntu-24.04 passes
  • No deprecation warnings about actions/checkout Node version
  • Postgres service log clean of role "root" does not exist

zaucker and others added 10 commits March 5, 2026 14:20
* Fix technical1990.cfg

* Fix technical1995.cfg

* Fix technical2002.cfg

* Fix technical2007.cfg

* Fix technical2010.cfg

* Fix technical_pre2017.cfg

* Adapt new n2o values (changes from T.K.)

* Partially apply patched changes to other tech files

* Apply changes part 2

* Adapt changes from Thomas (Application)

* Adapt changes from Thomas (Livestock)

* Remove depricated nhd file

* Differentiate between mobile vs. permanent housing for free range

* Adapt test data set to include free_range=mobile

* Fix wrong variable naming for mobile share

* Add new beef cattle categories

* Remove digestate effect on application emission

* Add first version of crop residues

* Clean up recycling fertilizers

* Add crop residue er values

* Add patched diff to residual tech files

* Fix issues introduced with latest code additions/changes

* Fix wrong er (Thomas)

* Adapt changes from Thomas (Storage)

* Add more changes from Thomas (air scrubber)
Pin @qooxdoo/framework to exact 7.8.0 to avoid a 7.9.2 regression
where compiled output rewrites qx.locale.Manager.tr(...) into
qx.locale.Manager.getInstance().tr(...), which fails at runtime
because tr is a static method (upstream issue qooxdoo/qooxdoo#10864).

Switch the frontend build from npm/npx to pnpm: configure.ac picks
up the pnpm binary, Makefile.am drives qx through 'pnpm exec', and
package.json declares packageManager and pnpm.onlyBuiltDependencies
(replacing the old pnpm-workspace.yaml approach which broke under
pnpm 10). frontend/.npmrc relocates the pnpm virtual store to
/scratch for faster CephFS-side installs.

Add regenerator-runtime as an explicit devDependency (qooxdoo 7.8.0
imports it but pnpm doesn't hoist it).

Drop unused 'showdown.Converter' warning by adding @ignore(showdown.*)
to Changelog.js. Stop wrapping data[1] in qx.locale.Manager.tr() in
Error.js where senders already pass translated strings, which silences
"Cannot interpret message ID null" warnings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Split 2 words in English GUI terms

* Fix reporting crop residues etc.

* Refactor free_range: fix->yes

* Fix wrong excretion value for new category

* Add further changes from Thomas
Wrap the existing t/Dockerfile (Postgres 16 + schema/dump) in make
targets so contributors don't have to remember the podman invocation:

  make db-start    # build image + run container, wait for pg_isready
  make test        # prove6 -l t/ with AGRAMMON_CFG pointing at it
  make unit-test   # AGRAMMON_UNIT_TEST=1 prove6 -l t/  (skips DB tests)
  make db-stop     # stop + remove container
  make db-restart  # stop + start
  make db-logs     # podman logs
  make db-psql     # open psql against the test DB

Variables PODMAN, DB_IMAGE, DB_CONTAINER, DB_PORT are overridable.
Update t/README accordingly (replaces the old docker quick-start).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ropResidues fixtures

upload_accounts route handlers (REST + browser) had a control-flow bug
where bad-request set the response but the handler kept executing,
causing 500s on empty / malformed CSV instead of the intended 400.
Rewrite both handlers with explicit if/else so the success path is
unreachable when validation fails.

Adjust agrammon-rest.openapi accordingly: drop format: binary on
the accounts field (current Cro multipart parser hands the validator
a decoded Str, which the binary-string check rejects), and declare a
'400' response so Cro's response validator doesn't turn 400s into
500s on validation failure.

t/routes-user.rakutest: add `use Cro::HTTP::Body;` so
Cro::HTTP::Body::MultiPartFormData::Part resolves at parse time
(without it the module name is parsed as &Part, a sub).

t/run-complex-model-with-filters.rakutest and t/webservice.rakutest:
update expected outputs for the hr-inclNOxExtendedWithFilters and
SummaryTotal cases to reflect the recent PlantProduction::CropResidues
addition. Old values preserved as comments per existing convention.

CI workflow cleanup (.github/workflows/backend-and-models.yml):
- bump actions/checkout from v2 (Node 20 deprecation) to v4
- fail-fast: false so both ubuntu-22.04 and -24.04 legs report
- actions/cache path: $HOME/.agrammon → ~/.agrammon (the action does
  not expand $VAR; the model cache was effectively never hitting)
- replace deprecated CREATE GROUP with CREATE ROLE + GRANT
- scope postgres health check to a real user/db so the service log
  isn't flooded with `role "root" does not exist` from pg_isready
- drop -v from the prove6 invocation; CI logs were huge

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Cro::HTTP 0.8.12 (released after 0.8.11) added a `.name` lookup in
Cro::HTTP::Router::Route.definition-complete (line 447) that does not
work with the OperationHandler shape produced by
Cro::OpenAPI::RoutesFromDefinition 1.0.4 (the version we use):

    No such method 'name' for invocant of type
    'Cro::OpenAPI::RoutesFromDefinition::OperationSet::OperationHandler'

CI hits this on any fresh `zef install` because META6.json was open-
ended. Pin the working version until upstream RoutesFromDefinition
releases support for the new Router internal API.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…TTP pin

The previous Cro::HTTP:ver<0.8.11> pin in META6.json doesn't fully
help: zef installs both 0.8.11 (matching our pin) and 0.8.12 (pulled
in transitively, e.g. by Cro::HTTP::Test), and Raku's runtime then
loads 0.8.12 for any unversioned `use Cro::HTTP::Router`. The pin
restricts our direct dep but not what the runtime actually picks up.

The real fix is the missing `.name` and `.url-prefix` attributes on
Cro::OpenAPI::RoutesFromDefinition::OperationSet::OperationHandler;
PR proposed at croservices/cro-openapi-routes-from-definition#15.

Until that PR lands and 1.0.5 ships, install a patched fork from
zaucker/cro-openapi-routes-from-definition@add-name-attr-to-operationhandler
into the Raku module path *before* the main zef install, so the
project's deps-only install sees Cro::OpenAPI::RoutesFromDefinition
already satisfied at 1.0.4 and skips it.

Drop the workaround step (and bump nothing else) once upstream
releases the fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zaucker zaucker marked this pull request as ready for review May 8, 2026 11:36
@zaucker zaucker merged commit f76e863 into oposs:main May 8, 2026
2 checks passed
@zaucker zaucker deleted the test-ci-fixes branch May 8, 2026 11:36
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.

2 participants