-
Couldn't load subscription status.
- Fork 761
index: make Index ancestor methods fallible
#7851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I think most of the PR description is talking about one of the two commits. Could you move those parts to the commit message of the relevant commit? |
78df233 to
d63bdea
Compare
|
@martinvonz Just added the additional respective details from the PR description to each of the commit messages. |
d63bdea to
8a5e760
Compare
8a5e760 to
3c65d54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
This is part of a series of changes to make most methods on index traits (i.e. `ChangeIdIndex`, `MutableIndex`, `ReadonlyIndex`, `Index`) fallible. This will enable networked implementations of these traits, which may produce I/O errors during operation. See jj-vcs#7825 for more information. - Introduced a few more instances of the existing anti-pattern, `TODO: indexing error shouldn't be a "BackendError"`. We're tracking this known issue in jj-vcs#7849. - Converted `MutableRepo::merge_view` to return a `RepoLoaderError` instead of a `BackendError`. The only caller, `MutableRepo::merge`, already returns a `RepoLoaderError`. - Added three "`fallible_`" iterator helpers to reduce the amount of noise at `is_ancestor` call sites due to the method now being fallible. Using these helpers seem to produce code that's a little more readable than using `process_results` from itertools. One consideration in this trade-off is that these helpers do not themselves return iterators: if we find that we need more support for fallible combinators mid-"chain" of iterator combinators, we might either want to use `process_results` only in those cases, or switch to use of `process_results` across the board (in lieu of these new helpers).
This is part of a series of changes to make most methods on index traits (i.e. `ChangeIdIndex`, `MutableIndex`, `ReadonlyIndex`, `Index`) fallible. This will enable networked implementations of these traits, which may produce I/O errors during operation. See jj-vcs#7825 for more information. This introduces another instance of the existing anti-pattern, `TODO: indexing error shouldn't be a "BackendError"`. We're tracking this known issue in jj-vcs#7849. Closes jj-vcs#7825.
3c65d54 to
0b4e456
Compare
This is the last in a series of changes to make most methods on index traits (i.e.
ChangeIdIndex,MutableIndex,ReadonlyIndex,Index) fallible. This will enable networked implementations of these traits, which may produce I/O errors during operation. See #7825 for more information.Previous PRs in this line of work: #7799, #7823, #7830, #7832, #7843.
A few things to note:
TODO: indexing error shouldn't be a "BackendError". Filed issue Task: Improve error handling whereIndexErrors are wrapped inBackendError#7849 to track this.MutableRepo::merge_viewto return aRepoLoaderErrorinstead of aBackendError. The only caller,MutableRepo::merge, already returns aRepoLoaderError.fallible_" iterator helpers to reduce the amount of noise atis_ancestorcall sites due to the method now being fallible. Using these helpers seem to produce code that's a little more readable than usingprocess_resultsfrom itertools. One consideration in this trade-off is that these helpers do not themselves return iterators: if we find that we need more support for fallible combinators mid-"chain" of iterator combinators, we might either want to useprocess_resultsonly in those cases, or switch to use ofprocess_resultsacross the board (in lieu of these new helpers).This closes #7825.
Thanks to Martin, Yuya, and Philip for guidance with these fallibility changes! I appreciate your help.
Checklist
If applicable:
CHANGELOG.mdREADME.md,docs/,demos/)cli/src/config-schema.json)