Page MenuHomePhabricator

Call Flow API with DerivativeRequest for server actions
Closed, DeclinedPublic

Description

There is an apiResponse field in View.php. Some of the contents come from renderApi (shared by the actual API).

However, some are put directly there, which means the data is only available in the template if it's a server rendering. That in turn means the template output differs.

This is a major problem (the architecture is built on the assumption that individual templates behave exactly the same on client and server), and causes bugs like T74655: Shows 'Post a new message to ""' after changing sort order.


Version: unspecified
Severity: normal

Details

Reference
bz72659

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:59 AM
bzimport set Reference to bz72659.
bzimport added a subscriber: Unknown Object (MLST).

One approach to solve this is to have View call the actual API with a DerivativeRequest, and pass the API output directly to the template.

However, there are other approaches that still solve this problem.

(In reply to Matthew Flaschen from comment #1)

One approach to solve this is to have View call the actual API with a
DerivativeRequest, and pass the API output directly to the template.

We're going to try this approach.

EBernhardson set Security to None.

Marking this as high priority as its an important architectural change that needs to happen.

This remains somewhat controversial, but consensus seems to be against in the broader MW architecture group.

Some prefer to have backend services/controllers/interactors (somewhat similar to what we have now, but the desired approach is not super well-defined), rather than FauxRequest/DerivativeRequest.

See https://tools.wmflabs.org/meetbot/wikimedia-office/2015/wikimedia-office.2015-03-11-21.00.html and T89889: RFC: Service split along presentation vs data manipulation line.