Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

fix: check for valid schema before querying by constrained field#75

Merged
ryanfoxtyler merged 2 commits intomainfrom
matthewmcneely/fix-get-before-schema-write
Apr 25, 2025
Merged

fix: check for valid schema before querying by constrained field#75
ryanfoxtyler merged 2 commits intomainfrom
matthewmcneely/fix-get-before-schema-write

Conversation

@matthewmcneely
Copy link
Contributor

Description
This PR fixes #74. If querying (modusDB.Get) for a struct's constrained field before the schema contained that type, the worker would panic (the bug contains that trace). This change ensures the schema contains the type before launching the query. Note that querying by uid does not suffer from this issue as the discovery of the tablets (groups) are not involved in the query.

Also added tests (as well as expanding existing unit tests) and changed the api file to use errors.New instead of the fmt package as no formatting was being applied.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to
    this PR
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

Add/update tests; use errors.New instead of fmt.Errorf
@matthewmcneely matthewmcneely requested a review from a team February 21, 2025 23:01
@ryanfoxtyler ryanfoxtyler merged commit 18b9e95 into main Apr 25, 2025
6 checks passed
@ryanfoxtyler ryanfoxtyler deleted the matthewmcneely/fix-get-before-schema-write branch April 25, 2025 12:50
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Querying for non-existent record by constrained field panics

2 participants