Page MenuHomePhorge

Mark manually created Diffs as new objects to fix empty Feed transaction entries
ClosedPublic

Authored by avivey on Jan 14 2024, 23:33.

Details

Summary

When creating a Differential diff manually via /differential/diff/create/ in the web browser instead of using Arcanist, setIsCreateTransaction(true) for the transaction type DifferentialDiffTransaction::TYPE_DIFF_CREATE to avoid an empty Transaction field in the Feed and avoid strncmp() complaining about a null value being passed.

For gory details, see the comments in T15659.

ERROR 8192: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/policy/query/PhabricatorPolicyQuery.php:314]

Closes T15659

Test Plan
  1. Create a valid diff via /differential/diff/create/
  2. Go to /feed/transactions/query/advanced/ and set Object Types to Differential Diff and click Search
  3. See two entries in the Transaction column for the just created diff: One says "created this diff", the other one says "created this object with visibility" and is not an empty line anymore which triggered an exception.

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I've read your awesome travel in T15659 but I've also read this inline comment:

// TODO: Once everything is on EditEngine, just use getIsNewObject()

So maybe this? but I'm not bold enough:

$mark_as_create = $this->getIsNewObject();
...

So maybe this?

$mark_as_create = false;
if ($this->getIsNewObject()) {
  $mark_as_create = true;
}
...

In any case, if it works, the rest of the code could be moved inside a private function guessIsNewObject() or similar.

If it works, we need to probably expand a bit the test plan

In an ideal world 1030-1313 could become just:

$mark_as_create = $this->getIsNewObject() || $this->guessIsNewObject();

// TODO: Once everything is on EditEngine, just use getIsNewObject()

So maybe this? but I'm not bold enough:

Me neither currently. :) Could be a nice followup project to try and test extensively...?

maybe

if ($this->getIsNewObject() || $xaction->getTransactionType == ...)

?
Then it only needs to be tested in the one case, and we can avoid code creeping from Differential here.

edit - oh, it was already suggested :)

In an ideal world 1030-1313 could become just:

I think you're off with the line numbers?

(Not sure I can entirely follow the last comments - if somebody wants to push another revision, please feel very welcome to.)

The more I look at the code, the less I understand the comment about "just use getIsNewObject()".

I'm gonna counter-diff with setting the IsCreate in the CreteRawDiff conduit class, which is just a pile of hack anyway.

Counter-diff: Keep the hackiness confined

@avivey Much cleaner and also works as expected (just tested). Thanks for finding that better approach! Now how can I approve your patch as I'm still set as original author, sigh?

aklapper added a reviewer: aklapper.

Testing if "Foist Upon" does what I hope it does

This revision is now accepted and ready to land.Feb 6 2024, 12:31