-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Intersphinx: log warnings for ambiguous target resolutions. #12329
Intersphinx: log warnings for ambiguous target resolutions. #12329
Conversation
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.
Heya thanks, I would suggest though that the warning requires extra metadata, including a type/subtype and a source/origin location
It would also be good to fully check the warnings in the test.
Perhaps have a look at #12193, where I did something similar
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.
oops that was meant to be request change
@goerz can you confirm that the absence of the messaging logic that we discussed in the original pull-request from your follow-up changeset was not an attempt to check whether it's possible to bypass our review processes? I feel that some institutions do spend time attempting such things (such as a case involving the University of Minnesota and the Linux kernel, for example) -- and to some extent I can understand that confirming and reporting those possibilities can provide research data. However, generally I feel like that time would be better spent assisting projects rather than confirming that human error can occur. |
Are you asking whether I deliberately not implemented the warning messages as a form of pentesting? Definitely not. I can confirm that I wasn't trying to poke holes in your review process as some kind of research activity. I forget what my exact reasoning was for why I didn't feel it necessary to include log messages in the second PR. Probably that it ended up being a trivial extension of code that had been there for years, and that it wasn't really my responsibility to add extra bikeshedding to that existing code (in particular because messaging with localization isn't completely trivial). And maybe even more importantly: None of the two systems that I'm aware of that can write Frankly, Sphinx is much too big and contributions to it are too bureaucratized (as a consequence, I'm not pointing fingers at anyone), and thus I would like to limit my development interactions with it to the smallest amount possible. In this case, there was a bug that made interoperability with Julia's documentation generator impossible, and that was something that I felt really needed fixing (and is now fixed), thanks to the latest release. Implementing error handling for errors that cannot currently occur is just not something I have the capacity for. But of course, I have no objection if someone else wants to add more error logging to the inventory resolution, so I fully support this PR. But it really only addresses |
Thank you! Yes; I didn't think it would be the case, but I did want some kind of logging for the ambiguous-resolution scenario. My sense was that we had agreed that, so it surprised me to later learn that the feature had been implemented without it.
Yep - the PR I'm suggesting here lacks localization so far, and I don't know whether it'll be acceptable without that. I'm not too familiar with the
Indeed, I understand that it can feel like results are more likely to be accepted on a prompt timeline when changes are minimized; and also, yes, thank you for stepping in to fix a system compatibility problem - that is much appreciated.
👍 |
…iguous-lookup-warning
sub-type and location information has been added to the warning
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.
Mainly all good cheers, just a nitpick
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
…uous target resolution.
@jayaddison I'm -1 on 72b266d; you've taken a simple PR and suddenly increased its complexity 10-fold, for minimal gain 😅 |
If you want to include |
Yep, it does raise the complexity and that is unfortunate. However, if we discover ambiguous entries within an |
Yes and reporting the inventory key |
…ut ambiguous target resolution." This reverts commit 72b266d.
…us-resolution-time.
Mostly agree, although I do worry about time spent trying to figure out what the inventory mapping config evaluated was at the time-of-build. I've added logging of the |
A thought: perhaps the warnings could/should be detected during the inventory loading process instead of at resolution-time? |
Ok; I've no further changes planned on this branch and will await further review. The changeset has been expanded to emit warnings when ambiguous references are discovered during loading of an inventory file -- I believe that this is only relevant for V2 inventories -- in addition to the initial logic to detect ambiguous-resolution of targets. |
sphinx/util/inventory.py
Outdated
|
||
@classmethod | ||
def load_v1( | ||
cls: type[InventoryFile], | ||
stream: InventoryFileReader, | ||
uri: str, | ||
join: Callable[[str, str], str], | ||
) -> Inventory: | ||
) -> tuple[Inventory, set[str]]: |
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.
This is a breaking change to public API which, without deprecation warnings, I think is not ideal.
either,
just log the warnings within load_v2
(this seems easiest)
or you should create two methods for each version, like: load_v2_with_ambiguties
(new signature), load_v2
(calls load_v2_with_ambiguties
, but then just drops the ambiguties and only returns the inventory)
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.
all good cheers
Thank you @chrisjsewell! |
Feature or Bugfix
Purpose
name
for 'std:label' when loading inventory #12009.Detail
std:label
andstd:term
object types, as of Sphinx v7.3.7), add a logged warning when target resolution is ambiguous.Relates
cc @goerz from the initial discussion in #12009, and @picnixz as reviewer of the approved replacement pull request #12033.