Skip to content
This repository has been archived by the owner. It is now read-only.

feat(client): Add the internal capabilities API (no handshake) #3077

Merged
merged 1 commit into from Sep 29, 2015
Merged

feat(client): Add the internal capabilities API (no handshake) #3077

merged 1 commit into from Sep 29, 2015

Conversation

@shane-tomlinson
Copy link
Member

@shane-tomlinson shane-tomlinson commented Sep 17, 2015

Capabilities are a way to query whether the given environment supports
a feature. The goal is to query Firefox to see which FxA features it supports.
With this PR, the signup capability is hard coded, without querying Firefox.

issue #2771

@vladikoff - mind reviewing this to give feedback and see if this is in line with how you were imagining the capabilities API?

@rfk
Copy link
Member

@rfk rfk commented Sep 18, 2015

A drive-by naming nit, but we should also consider whether "capabilities" is the right term here. For big things like "signup" and "choose-what-to-sync" it fits, but if we use the same mechanism to let the device choose between e.g. halting or continuing to settings, then it doesn't sound like a "capability" so much as a "customization".

@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 18, 2015

A drive-by naming nit, but we should also consider whether "capabilities" is the right term here. For big things like "signup" and "choose-what-to-sync" it fits, but if we use the same mechanism to let the device choose between e.g. halting or continuing to settings, then it doesn't sound like a "capability" so much as a "customization".

I'm working on a separate entity for that, for those exact reasons. I'm calling those behaviors.

@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 18, 2015

I'm working on a separate entity for that, for those exact reasons. I'm calling those behaviors.

I'm trying to tease these two concepts apart because they feel different. One says what an environment is capable of, the other controls flow. capabilities could be thought of as a subset of behaviors, but at the same time, adding capabilities to behaviors feels like a single muddied concept. Capabilities would be binary, whereas behaviors can hold additional meta information. Maybe behaviors are the only thing that's needed?

@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 18, 2015

@rfk - I should start with a problem statement(s) to give context.

All behaviors/capabilities are currently hard coded into the brokers and views. This leads to screen->screen transition control being partly handled in views and partly in brokers. Modifying existing behaviors/capabilities, or adding new screen transitions, or dynamically changing screen transitions requires views, brokers, and sometimes reliers to be updated.

Desired system attributes/behaviors

  • A way to define screen->screen transitions and whether features are supported for a particular environment.
  • Allow dynamic setting of screen->screen transitions and whether features are supported.
  • Logic to define possible screen->screen transitions and feature support should be as self contained as possible. Spreading that logic between views, brokers & reliers is difficult to reason about.
  • Views should be relatively unaffected whenever new environments (like Fennec or the upcoming Windows migrator) are supported.

Here are a few links to show how I currently think about these two concepts and how they are used. Feedback appreciated.

Capabilities

Behaviors

@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 21, 2015

@vladikoff - could I get your thoughts on this? Specifically, whether this API is suitable, or whether there are ideas from your former PR that should be brought over here to bring the APIs into alignment?

@rfk rfk added this to the FxA-50: device handshake milestone Sep 21, 2015
* a truthy value to indicate whether it's supported.
*/
defaultCapabilities: {
signup: true

This comment has been minimized.

@vladikoff

vladikoff Sep 22, 2015
Contributor

this is a great start, but it is really simplified. Not sure if that is good or bad. It totally make sense in the refactor but could be problematic for the client integration.

In my case I wanted to make sure that a capability had more distinct names (+ versions) and were also objects that can contain extra details.

@shane-tomlinson shane-tomlinson modified the milestones: FxA-27: fennec web login, FxA-50: device handshake Sep 22, 2015
@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 22, 2015

I'm putting this in the FxA-27 fennec web login milestone because this is for the internal API, not the handshake portion. The internal API will be used to determine whether certain features are supported, e.g., the "open preferences" button.

@shane-tomlinson shane-tomlinson changed the title feat(client): Add the beginning states of capabilities. feat(client): Add the internal API for capabilities (no handshake) Sep 22, 2015
@shane-tomlinson shane-tomlinson changed the title feat(client): Add the internal API for capabilities (no handshake) feat(client): Add the internal capabilities API (no handshake) Sep 22, 2015
@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 22, 2015

For "behaviors", see #3097

@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 29, 2015

@vladikoff and I generated a list of possible data formats at http://oksoclap.com/p/fxa-capabilities. @rfk and I discussed the merits of these and decided on a solution that should allow us to provide the functionality that we need, using a modified version of draft 1:

capabilities: {
  // indicate capability is not supported 
  choose_what_to_sync_web_v1: false, // false could be some other falsy value.

  // for a simple boolean "yep, it's supported"
  choose_what_to_sync_web_v1: true,

  // or, for a more complex case where data is needed:
  choose_what_to_sync_web_v1: {
    customEngines: [
      "bookmarks",
      "passwords"
    ]
  }    
}

When new versions of choose what to sync are needed, a new capability will be created with a new name.

Capabilities are a way to query whether the given environment supports
a feature. The goal is to query Firefox to see which FxA features it supports.
With this PR, the `signup` capability is hard coded, without querying Firefox.

issue #2771
@shane-tomlinson
Copy link
Member Author

@shane-tomlinson shane-tomlinson commented Sep 29, 2015

@vladikoff - mind a re-review? Can you see #3077 (comment)

vladikoff added a commit that referenced this pull request Sep 29, 2015
feat(client): Add the internal capabilities API (no handshake) r=vladikoff
@vladikoff vladikoff merged commit 1fd420c into mozilla:master Sep 29, 2015
4 checks passed
4 checks passed
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.001%) to 98.898%
Details
@vladikoff
Copy link
Contributor

@vladikoff vladikoff commented Sep 29, 2015

So this PR is pretty much like last time I reviewed it, Good start!

@shane-tomlinson shane-tomlinson deleted the shane-tomlinson:issue-2771-capabilities branch Feb 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants