Skip to content

zpm-config: accept numeric scalar values for interpolated settings#252

Open
hamidrezahanafi wants to merge 2 commits intoyarnpkg:mainfrom
hamidrezahanafi:hamid/pr1-config-numeric
Open

zpm-config: accept numeric scalar values for interpolated settings#252
hamidrezahanafi wants to merge 2 commits intoyarnpkg:mainfrom
hamidrezahanafi:hamid/pr1-config-numeric

Conversation

@hamidrezahanafi
Copy link

@hamidrezahanafi hamidrezahanafi commented Feb 14, 2026

Why this change needed?

  • npmMinimalAgeGate: 0 inside .yarnrc.yml can't be parsed correctly

Summary

  • allow Interpolated<T> deserialization to accept numeric YAML scalars in addition to strings
  • convert numeric scalars to strings before passing through FromFileString
  • preserve existing string interpolation behavior for env-based string values

Test plan

  • cargo build --release -p zpm
  • Updated Existing acceptance coverage is in tests/acceptance-tests/pkg-tests-specs/sources/features/npmMinimalAgeGate.test.ts to add coverage

Made with Cursor

Allow interpolated configuration fields to deserialize numeric YAML scalars by converting them to strings before parsing. This preserves existing string interpolation behavior while fixing configs like npmMinimalAgeGate: 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 14, 2026

Confidence Score: 4/5

  • Safe to merge with minimal risk - straightforward deserialization enhancement
  • The implementation correctly handles numeric YAML scalars by converting them to strings before parsing. The approach is sound and maintains backward compatibility. Minor edge case with float scientific notation could theoretically occur but is unlikely in practice for duration values.
  • No files require special attention

Important Files Changed

Filename Overview
packages/zpm-config/src/lib.rs Added Integer and Float variants to StringOrAnything enum to support numeric YAML scalars, converting them to strings before parsing
tests/acceptance-tests/pkg-tests-specs/sources/features/npmMinimalAgeGate.test.ts Added test case to verify numeric npmMinimalAgeGate (0) can be parsed from .yarnrc.yml

Last reviewed commit: 7853d62

@github-actions
Copy link

⏱️ Benchmark Results

Metric Base Head Difference
Mean 2.528s 2.540s +0.48% ⚠️
Median 2.535s 2.535s -0.00%
Min 2.302s 2.363s
Max 2.771s 2.732s
Std Dev 0.087s 0.084s
📊 Raw benchmark data

Base times: 2.771s, 2.604s, 2.564s, 2.483s, 2.554s, 2.567s, 2.607s, 2.514s, 2.571s, 2.470s, 2.522s, 2.536s, 2.620s, 2.445s, 2.511s, 2.559s, 2.556s, 2.517s, 2.605s, 2.547s, 2.524s, 2.543s, 2.534s, 2.430s, 2.309s, 2.531s, 2.556s, 2.477s, 2.522s, 2.302s

Head times: 2.732s, 2.682s, 2.620s, 2.460s, 2.427s, 2.562s, 2.523s, 2.535s, 2.494s, 2.464s, 2.466s, 2.530s, 2.426s, 2.535s, 2.564s, 2.496s, 2.452s, 2.363s, 2.610s, 2.561s, 2.506s, 2.584s, 2.657s, 2.462s, 2.525s, 2.554s, 2.584s, 2.608s, 2.669s, 2.562s


Benchmark: gatsby install-full-cold

Add an acceptance test that writes npmMinimalAgeGate as a numeric YAML scalar in .yarnrc.yml and verifies install succeeds. This exercises file-based config parsing rather than env-based overrides.

Co-authored-by: Cursor <cursoragent@cursor.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