Skip to content

[v0.4.x] Reject non-finite n in both entry guards #44

Description

@DougManuel

Follow-up from the v04x-hardening branch final review (Phase 1 of development/post-v040-development-plan.md).

Both n-validation guards — create_mock_data() (R/create_mock_data.R) and the spec layer (R/mock_spec.R, validate_mock_spec() area) — accept n = Inf: is.numeric(Inf) is TRUE and Inf != trunc(Inf) is FALSE, so Inf sails through and fails later with a raw runif/rep error. Pre-existing pattern in the spec layer, mirrored (deliberately) by the Task 2 guard alignment.

Fix: add !is.finite(n) to both guards in one small patch, keeping the shared message "n must be a non-negative whole number." Add n = Inf to the edge-case contract tests for both layers.

Sized XS. No API or seeded-output impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Nice to have, lower urgency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions