Improve Seqera API preflight errors - #144
Merged
Merged
Conversation
Co-authored-by: Florian Wuennemann <flowuenne@gmail.com>
Co-authored-by: Florian Wuennemann <flowuenne@gmail.com>
edmundmiller
requested changes
Apr 24, 2026
edmundmiller
left a comment
Contributor
There was a problem hiding this comment.
found one correctness issue in the new preflight cache. i also left one non-blocking note here: the groovy preflight path would be worth covering with an nf-test or integration regression so this behavior stays locked in.
| } | ||
|
|
||
| static void validateApiAccess(String apiEndpoint, Map headers, String tokenEnvVar, String token) { | ||
| def validationKey = "${apiEndpoint}|${tokenEnvVar}|${token.hashCode()}" |
Contributor
There was a problem hiding this comment.
using token.hashCode() here can collide across distinct strings, so a different bearer token could incorrectly skip /user-info preflight in the same JVM. consider caching on the full token or a collision-resistant digest instead.
Contributor
There was a problem hiding this comment.
fixed in 266688c. this now keys the cache on a sha-256 digest of the token instead of token.hashCode(), so distinct tokens cannot collide and skip preflight.
Add lightweight nextflow_function coverage for lib/SeqeraApi.groovy and document the lib test layout with a link to the nf-test function testing docs.
edmundmiller
approved these changes
Apr 24, 2026
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.
PR checklist
CITATIONS.md,README.md, and agent/context guidance in the same PR.nextflow run . -profile test,docker --outdir <OUTDIR>).nextflow run . -profile debug,test,docker --outdir <OUTDIR>).CHANGELOG.mdis updated.README.mdis updated (including new tool citations and authors/contributors).Description
Issue #72 is still reproducible on current
main: an invalid token currently retries/orgsand fails with a genericAPI request failed ... HTTP 401message.This change adds a shared API preflight step before workspace resolution:
GET /service-infoGET /user-infoIt also aligns the standalone Python fetch helper with the same behavior, adds focused regression tests, and updates the docs/context describing the API path and known failure modes.
Testing
uv run --with typer --with pyyaml --with jinja2 --with pyarrow --with pytest --with httpx pytest -v modules/local/aggregate_benchmark_report_data/tests/test_aggregate.py modules/local/normalize_benchmark_jsonl/tests/test_normalize.py modules/local/render_benchmark_report/tests/test_render.py bin/test_benchmark_report_fetch.pynf-test test --profile=+docker --verbosenextflow run . --input workflows/nf_aggregate/assets/test_benchmark.csv --generate_benchmark_report --outdir /tmp/nf-aggregate-e2e-results -profile dockerpre-commit run --all-filesTOWER_ACCESS_TOKEN=bad-token nextflow run . --input /tmp/issue72_run_ids.csv --generate_benchmark_report --seqera_api_endpoint http://127.0.0.1:8765 --outdir /tmp/issue72-bad-token -ansi-log falseTOWER_ACCESS_TOKEN=good-token nextflow run . --input /tmp/issue72_run_ids.csv --generate_benchmark_report --seqera_api_endpoint http://127.0.0.1:9999 --outdir /tmp/issue72-bad-endpoint -ansi-log falseThe two issue-specific runs confirm the pipeline now fails at
/user-infofor bad tokens and/service-infofor bad endpoints, instead of surfacing a generic/orgsfailure.