Skip to content

nix_utils::BaseStore: return Result from all fallible methods #1753

Merged
Mic92 merged 1 commit into
NixOS:masterfrom
obsidiansystems:ffi-result
May 19, 2026
Merged

nix_utils::BaseStore: return Result from all fallible methods #1753
Mic92 merged 1 commit into
NixOS:masterfrom
obsidiansystems:ffi-result

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Previously the trait implementations silently swallowed FFI errors as
"path not found" / empty / zero. This was dubious and could cause
mysterious failures. For example, a daemon connection error would look
like "path is present" to callers, causing paths to be skipped from
import and builds to fail with cryptic errors instead. We don't want
that! Better to have an earlier clear failure.

The C++ query_path_info now checks isValidPath first and returns
a found: false sentinel instead of throwing InvalidPath
eliminating brittle error-message string matching on the Rust side.

All callers updated to propagate errors with ?.

Previously the trait implementations silently swallowed FFI errors as
"path not found" / empty / zero. This was dubious and could cause
mysterious failures. For example, a daemon connection error would look
like "path is present" to callers, causing paths to be skipped from
import and builds to fail with cryptic errors instead. We don't want
that! Better to have an earlier clear failure.

The C++ `query_path_info` now checks `isValidPath` first and returns
a `found: false` sentinel instead of throwing `InvalidPath` —
eliminating brittle error-message string matching on the Rust side.

All callers updated to propagate errors with `?`.
@Ericson2314 Ericson2314 added this pull request to the merge queue May 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit May 18, 2026
@dasJ
Copy link
Copy Markdown
Member

dasJ commented May 18, 2026

21 minutes, John

@Ericson2314
Copy link
Copy Markdown
Member Author

Would you like to review this one? I considered it pretty straight-forward. I also talking about a little bit with @Mic92 over the weekend (though as part of a larger conversation) about it.

#1748 This is the more interesting one that I would much prefer eyes on, if you have limited time. (I will push to it again in a moment.)

Copy link
Copy Markdown
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks rather mechanical.

@Mic92 Mic92 added this pull request to the merge queue May 19, 2026
Merged via the queue into NixOS:master with commit e369455 May 19, 2026
2 checks passed
@amaanq amaanq deleted the ffi-result branch May 19, 2026 12:27
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.

3 participants