Repository navigation
Conversation
ee215ba to
b4ec7b6
Compare
wolfsage
left a comment
There was a problem hiding this comment.
Wild!
I think we should probably test this on the same version of Perl pause is running on to be sure we haven't introduced more incompatibilities (like indented heredocs).
I mostly understand it but it's a lot to reason about.
I think this commit message needs rewording:
Code that wants to abort can $ctx->abort_indexing, which adds a
dist_error uses an exception to stop processing the dist further.
"which adds a dist_error uses an exception" I can't seem to parse
And the final commit regarding attempting to avoid partial indexing doesn't quite make sense. I'm reasonably sure that already happens inside of a transaction.
do_the_database work starts a transaction then does:
- examine_pms->index_by_files->examine_fio->examine_pkg->give_regdowner_perms
Or - examine_pms->index_by_meta->examine_pkg->give_regdowner_perms
while in the transaction.
|
A bunch of code can also be removed if you wish like things referencing INDEX_WARNINGS and has_index_warnings... etc |
|
I reworded the awkward commit. I also removed INDEX_WARNING stuff, which led me to find that the prelude-to-warnings text was not being included. |
af03add to
ba36b83
Compare
5c2f1b0 to
39e973c
Compare
|
@wolfsage As discussed today, I think this is reviewable. |
wolfsage
left a comment
There was a problem hiding this comment.
checks clock 2h6m. whew.
There's.... a lot here. I've only looked at the code, not played with it. I've left a number of questions.
I think there's at least one legitimate bug which implies more tests could be written, and some code that was either lost in a rebase, or didn't make sense to keep in (lc_package in an UPDATE where it's probably not needed).
I question whether we've introduced mem leaks by not deleting $SELF->{DIO} or FIO everywhere like we used to.
I'd like to play with this and test it on a running inabox, but I cannot do that tonight. Wednesay perhaps if you want to wait more.
Otherwise, seems like good improvements, for the bits I could understand the changes without my brain melting
| another) workaround against "Safe" limitations.)}, | ||
|
|
||
| ); | ||
| # TODO: get $err->{openerr} back in here, I guess? |
There was a problem hiding this comment.
Is this todo something to worry about?
There was a problem hiding this comment.
I think it's okay to leave like this, but … I dug into this whole hunk of code and HOO BOY. This is a whole 'nother project for a whole 'nother time.
| delete $self->{FIO}; # circular reference | ||
| return; | ||
|
|
||
| # TODO: get $err->{line} back in here, I guess? |
There was a problem hiding this comment.
is this todo something to worry about?
The indexer, here, kept doing this:
if ($ok) { ... }
if ($ok) { ... }
...and any given block might set $ok to 0, but never return early. That
meant that it was hard to know whether $ok might get set back later. It
never would.
Instead, the code now returns early, because $ok can only become true
early on, and from then on is really a way of saying "abort, but keep
running through code anyway". Better to just return.
This adds the code needed to have the context object track package indexing status. It isn't used yet, but it shows that we need to rename distribution-level errors, so they're unambiguous, and then does that!
Here, we replace all the package-level errors, logged with ->index_status, with ->abort_indexing_package. This lets us put all the error status text in one place and ensure it exists. It also means we can stop worrying about the flow control of package indexing: throw to stop.
In the previous commit, we'd replaced all use of ->index_status to set the current status, and instead used the context methods to record package status. Still, though, those methods set *both* the new status and the old status, and we only read things from the old status. In this commit, we switch to only reading things from the new status, and delete the attributes used to store the old status.
That way, your error can say "this was in previous file X" and not just "in a previous file, not named here".
It just looks better!
I had commented out some code so that we would only check in a package update if we were in an OK state. That is no longer needed, because if we are not in an OK state, we will have thrown an exception. Removing the commented-out code just makes things easier to skim.
We pass "package" and not "pack".
The old code would promote a string to a hashref, but it did it badly.
Even when done correctly, the code in abort_indexing_dist would look for
$error->{message}, but when passing a DISTERROR result, there was none.
This was just general confusion.
Now, ->abort_indexing_dist, and thus ->add_dist_error, expect a hashref
with, at minimum, a "header" value.
Now that abort_indexing_dist must be passed a hashref, fix all the calling code to do so. This has the side-effect of making all these errors public. That's okay because: 1. we were ignoring "public" anyway! 2. they're all reasonable to show the user
This case doesn't come up yet, and wasn't handled properly. This code will better handle private errors, and also errors with a header and no body.
This makes it easier to see that subs in this file are not part of the top-level package.
Right now, this has no effect, but it will give us a place to put extra diagnostic tooling for collecting mail from test runs.
...then I used this to get all the emails produced by the mldistwatch tests to inspect in my MUA!
When filter_ppps was simplified, the push of a surviving package ended up inside the loop over rule types. So a package was kept once for each rule type it didn't match, and dropped entirely when there were no package or namespace rules (for example, when no_index had only directory rules, as ExtUtils::MakeMaker writes by default). It was also kept if it passed the package rules but matched a namespace rule. Now we push it once, after checking every rule type. Co-Authored-By: Claude <[email protected]>
examine_pkg passed the string "invalid package name" to abort_indexing_package, which wants an error hashref. Dereferencing the string died, and since that wasn't an Abort::Package exception, it escaped the indexer entirely, ending the whole run. Any dist whose META "provides" named a malformed package could do this. Use the bad_package_name error, which existed for this but was unused. Co-Authored-By: Claude <[email protected]>
When an eval around indexing fails, we rethrow anything that isn't the Abort exception we expect. If $@ was an unblessed reference, calling ->isa on it died with "Can't call method isa on unblessed reference", hiding the real error. Check blessed first. Co-Authored-By: Claude <[email protected]>
When the distribution_type check moved into check_indexability, its "return" stopped skipping the dist and only left check_indexability, so script dists got indexed. Now the check aborts indexing with a new script_dist error. This also changes behavior from before the refactor: previously, script dists were skipped silently, but now the author gets a failure report explaining why nothing was indexed. Co-Authored-By: Claude <[email protected]>
Every dist error was public, so the refactor started sending a failure report for every skipped upload, including all trial releases. Before the refactor, several skips (trial releases, non-dist files, perl-like archives from non-pumpkings, untar failures) sent no report at all. Trial releases go back to being silent. The others now send a report, which is a deliberate change: the uploader should find out why nothing was indexed. Later, we may want a gentler "declined" report for some of these, rather than "Failed". Co-Authored-By: Claude <[email protected]>
Nothing used these anymore.
This branch provides a common interface (the context object) for collecting and reporting on errors or warnings found during indexing. It also replaces the "set skip or return early" logic with an exception system, to allow deep-down checks to declare that a bit of indexing can't succeed.
I have compared the messages generated by test runs, and believe that while there are some changes, they are either neutral or improvements.
Here's more detail:
index_packagesandmaybe_index_distmethods have been updated to catch abort exceptions and handle them.a+wmode files. We just reject it. (This has come up once in the last 13 years, from a quick look.)