Skip to content

fix: preserve string types in schema builder#4392

Open
sapunyangkut wants to merge 1 commit into
nf-core:devfrom
sapunyangkut:codex/issue-4367-preserve-quoted-numeric-string
Open

fix: preserve string types in schema builder#4392
sapunyangkut wants to merge 1 commit into
nf-core:devfrom
sapunyangkut:codex/issue-4367-preserve-quoted-numeric-string

Conversation

@sapunyangkut

Copy link
Copy Markdown

What changed

  • preserve typed JSON string values as schema strings instead of re-parsing them as booleans or numbers
  • keep the existing None, native boolean, integer, float, and empty-string behavior
  • raise an explicit TypeError for unsupported value types rather than creating an invalid string schema
  • update focused tests to reflect the typed JSON contract and cover numeric-looking, boolean-looking, null-like, quoted-content, and empty strings

Since #4271, workflow configuration is loaded with nextflow config -o json and json.loads(), so a Nextflow value such as '3' already reaches build_schema_param() as Python str("3"). The retained legacy string branch then converted it to an integer, losing the type declared by the pipeline author.

The pre-JSON cache format used flat params.* keys, while the current reader expects nested config["params"]; those caches do not reach this conversion branch. Cache migration is therefore kept out of this focused fix.

Fixes #4367.

Validation

  • targeted schema parser tests: 10 passed
  • direct typed boundary assertions for strings, None, booleans, integers, floats, and unsupported lists
  • Ruff 0.15.12 check and format check on both changed files
  • python -m py_compile on both changed Python files
  • git diff --check

The broader TestSchema fixture currently stops on this Windows checkout with a pre-existing Jinja2 TemplateNotFound for create/template_features.yml; the new setup-free regression tests and direct typed assertions pass.

PR checklist

  • The change is based on and targets dev
  • The change includes focused regression coverage
  • The commit includes a DCO sign-off

Automation disclosure

This focused bug fix was prepared and tested with OpenAI Codex automation and independently red-teamed by a separate local agent. The contributor remains responsible for the submitted change; no human review is claimed.

Signed-off-by: sapunyangkut <302607731+sapunyangkut@users.noreply.github.com>
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