Skip to content

A failed custom validation also loads the fallback file #33

Closed

Description

@Shinrai

Problem

When the primary JSON file loads but fails the caller's custom validate function, wisp falls through to the fallback file as if the primary were missing. Validation failure and load failure are different cases: the caller asked to reject invalid data, and silently returning the fallback's data hides that.

Found during the release-docs backfill (#32), which documented the actual error message format.

Fix

Use the fallback only when the primary file can't be read or parsed (missing, unreadable, invalid JSON). A validation failure on the primary should throw the validation error. If the current behaviour is wanted for some callers, add an explicit option such as fallbackOnValidationError defaulting to false, and document it. Add tests for both wisp and wispSync.

Activity

  1. added
    type: bug
    priority: medium
    status: confirmed
    area: core
    on Oct 4, 2026
  2. added
    status: implemented
    and removed
    status: confirmed
    on Oct 4, 2026
  3. cldmv-bot commented on Oct 4, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #35, merged into next. This issue closes automatically when that work ships to the default branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: mediumstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions