Currently, the 'update status' action in a followup only occurs if the file tests being returned are for the last file in the stack. This means no status update if the test is, for example, followed by an interdiff.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drumm’s picture

We could

A) Update the status if the file is displayed. The logic would be the most straightforward of the options.

B) Update the status if the file is attached to the most recent comment with added files. The logic might not be fun; although the node changes API could help. This would most-closely extend the current logic.

I'm not sure what makes sense to more people in the issue queue. I am okay with either.

Damien Tournoud’s picture

I think (a) is enough: mark the whole issue as needs work when one of its displayed patch failed testing.

Berdir’s picture

Hm.

The idea is that you can do this:

File1: test-only.patch
File2: test-and-fix.patch
File3: interdiff.txt

This used to work more or less implicitly on 6.x because it only updated the issue status if no other patches were being processed, so the last one often also came back last and the test-only did not set it to needs work.

I guess this is an attempt to support this explicitly?

What about applying the "should-this-file-be-sent-to-testbot" function/logic on the filenames, and basically check if it's the latest file that is named so that it's tested?

jthorson’s picture

My thoughts align with Berdir's suggestion ... changing things to be the 'last testable' file instead of the 'last file' in the stack.

The motivation in changing this behavior for D7 was to clean up a few inconveniences that the old behavior was causing in the issue queues:

- Random (drive-by?) retesting of old patches which no longer apply would cause issues to be bumped to 'needs work', even though the conversation and followup patches have rendered the tested patch as completely irrelevant, and

- Patch 1 gets uploaded and starts testing, problem found, and corrected Patch 2 is uploaded and starts testing ... Patch 2 completes first (and successfully), followed by the Patch 1 failure which causes the status to be incorrectly changed to 'needs work'.

- Inconsistent behavior for issues containing 'test-only' and 'test-plus-patch' patches, depending on the order they were uploaded/tested ... as Berdir points out, this makes the behavior consistent.

jthorson’s picture

Status: Active » Needs review
FileSize
1.16 KB

I think this should resolve things ... however, I may not be able to fully test until later this week or weekend.

Berdir’s picture

Looks correct to me on a visual review. variable names could some improvements.

What you have there aren't really files, they are file field items. So maybe "foreach ($reversed_file_items as $file_item)"

And using $file_items = field_get_items($node, 'field_issue_files') would allow you to clean up that language stuff a bit, you don't have to mess with 'und' then. field_set_items() unfortunately never made it into core, so you still have to use the constant there.

jthorson’s picture

Great suggestions ... Thanks!

sun’s picture

While noticing an array_reverse() in this patch...

Part of the issue might also be this observation:

When attaching multiple files, the UI makes it appear as if you'd add them in the intended order, but:

After submitting (saving), the files that you attached are actually attached in the reversed order.

Once you notice, next time you try, you can actually take the extra experimental course of clicking the "Show row weights" link that happens to be there. And indeed, after disabling the tableDrag JavaScript:

When attaching new files, the weight of a new file has a "negated" weight compared to all other/existing files.

In turn, first == last, and first != first.

jthorson’s picture

#8: That is true, which is why the array_reverse() was required. The 'latest' patch is the last item on the array stack, even though it is displayed as the 'first' item in the UI.

After saving, the files are attached in the 'normal' manner (i.e. how core traditionally handles a multiple-file array) ... but the display is tweaked in order to show the most recent file at the top instead of having to scroll down through what could be a very long list of files. The weight value is tweaked only to ensure the desired display order, but it is negated again during save to ensure consistency in the stored data. Otherwise, the display order would toggle on each save.

sun’s picture

Yeah, I'm just not sure whether the tableDrag JS was also adjusted accordingly — whenever I'm trying to ensure that the .patch appears first (as opposed to the interdiff), I get an unexpected result.

But I merely wanted to note that ordering aspect in case it's relevant. Looks like it's not and the UX issue I'm talking about is a different issue. Thanks! :)

jthorson’s picture

Ah, gotcha ... because the display is flipping everything, any attempt to order the patch/interdiff is going to end up reversed on the stack; resulting in the opposite behavior from what you were probably expecting.

drumm’s picture

jthorson’s picture

FileSize
1.39 KB

Cleaned up (and fixed).

jthorson’s picture

FileSize
1.4 KB

Ooops.

jthorson’s picture

Status: Needs review » Fixed

Committed in http://drupalcode.org/project/project_issue_file_test.git/commit/34f2993...

Merged to bzr, and deploying to prod.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.