Page MenuHomePhabricator

Modernize commit/edge transaction when parsing commit messages
ClosedPublic

Authored by epriestley on Jul 6 2014, 2:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 24, 10:48 PM
Unknown Object (File)
Sat, Apr 20, 7:15 PM
Unknown Object (File)
Mon, Apr 15, 12:06 AM
Unknown Object (File)
Thu, Apr 11, 10:02 AM
Unknown Object (File)
Fri, Apr 5, 12:29 PM
Unknown Object (File)
Fri, Mar 29, 12:28 AM
Unknown Object (File)
Fri, Mar 29, 12:28 AM
Unknown Object (File)
Fri, Mar 29, 12:28 AM
Subscribers

Details

Summary

Ref T5245. With work elsewhere (notably, D9839) we can remove this TODO and use real transactions.

Test Plan

Pushed a closes Txxx commit and got a close + transaction.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Modernize commit/edge transaction when parsing commit messages.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: joshuaspence, chad, btrahan.
joshuaspence edited edge metadata.

Looks good. A couple of minor points that mostly belong to other diffs.

src/applications/diffusion/controller/DiffusionCommitController.php
423

I feel that this would be cleaner as new DiffusionEdgeTypeCommitHasTask(), perhaps

src/applications/diffusion/edge/DiffusionEdgeTypeCommitHasTask.php
3 ↗(On Diff #23619)

As in D9839, I'm not sure that I agree with the class name. I would prefer DiffusionCommitHasTaskEdgeType.

5–9 ↗(On Diff #23619)

As in D9839, this feels sort of strange... do we need a function and a constant?

83–88 ↗(On Diff #23619)

As in D9837, the argument order is wrong.

src/applications/maniphest/edge/ManiphestEdgeTypeTaskHasCommit.php
3 ↗(On Diff #23619)

As above.

5–9 ↗(On Diff #23619)

As above.

83–88 ↗(On Diff #23619)

As above.

This revision now requires changes to proceed.Jul 7 2014, 12:06 AM

I don't love passing objects instead of scalar constants. It's cleaner in some sense, but discards the explicitness of "this is definitely a scalar value which you could safely store in a database or put in a URL".

We also might end up with a weird "take a list of constants, look up all the objects, pass them through, then the other side of the method extracts the constants again" dance somewhere. Not a big deal, and I'm not sure we ever do this, but it feels silly.

It would become challenging to query edges which no longer exist (e.g., for a migration).

The majority of Query classes also accept scalars to the majority of withXYZ() methods, although this isn't a hard-and-fast rule.

Scalars are easier to put in a map on the way in, and some methods of EdgeQuery return maps by type, which would become cumbersome to manage if we primarily switched to using objects.

All pretty weak arguments, but I don't think there's a really compelling argument for using objects instead of constants.

Maybe reexamine this after moving off EdgeConfig? The API would need to work in both modes until then anyway, and doing it this way for now doesn't create much more work if we decide to switch later.

epriestley edited edge metadata.
  • Fix removal strings.

I don't love passing objects instead of scalar constants. It's cleaner in some sense, but discards the explicitness of "this is definitely a scalar value which you could safely store in a database or put in a URL".

Yeah, scratch that... It was a terrible idea.

joshuaspence edited edge metadata.

This looks good except maybe the class names (see discussion in D9839)

This revision is now accepted and ready to land.Jul 7 2014, 4:57 AM
epriestley edited edge metadata.
  • Rename to BlahBlahEdgeType.
  • Remove getEdgeConstant() methods, now implemented with reflection.
epriestley updated this revision to Diff 23930.

Closed by commit rPd4b2bfa2f4c1 (authored by @epriestley).