<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tcsc</id>
	<title>MozillaWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.mozilla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tcsc"/>
	<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/Special:Contributions/Tcsc"/>
	<updated>2026-11-29T18:53:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188725</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188725"/>
		<updated>2018-02-08T16:11:33Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: /* Configuring Git */ m&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Trace&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Trace&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
 # Enable trace logging for engines&lt;br /&gt;
 services.sync.log.logger.engine Trace&lt;br /&gt;
 &lt;br /&gt;
 # (optional) Enable trace logging for all of sync (this is very verbose and will include all request bodies)&lt;br /&gt;
 services.sync.log.logger Trace&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
Sync code is almost exclusively JavaScript, and so you probably should build using an artifact build, as described [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds here].&lt;br /&gt;
&lt;br /&gt;
After setting this up, you&#039;ll do `mach build` to perform a build, `mach run` to run Firefox, and `mach xpcshell-test /services/sync/tests/unit` to run the sync unit test suite. There&#039;s also a separate end-to-end test suite, TPS, which is documented [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests here]. (For most changes its sufficient you run the unit tests)&lt;br /&gt;
&lt;br /&gt;
Depending on your OS, most changes will not require a rebuild to take effect, only restarting and rerunning via `mach run`.&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [http://hg.mozilla.org/mozilla-central mozilla-central].&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Note: This section may be outdated.&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to m-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course). It&#039;s recommended that you use autoland via mozreview, or flag bugs as having checkin-needed instead. &lt;br /&gt;
&lt;br /&gt;
=== Make sure mozilla-central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://treeherder.mozilla.org treeherder].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which mozilla-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained. The mozilla-central mirror is available at https://github.com/mozilla/gecko-dev, however we recommend that you use https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development to set up a local git repository that tracks mozilla central. If you already have a gecko-dev clone, you can use [https://github.com/glandium/git-cinnabar/wiki/Mozilla:-Using-a-git-clone-of-gecko%E2%80%90dev-to-push-to-mercurial this guide] to configure it to push to hg using git-cinnabar.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
 &lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
If you find you have a slow git prompt, you may find the instructions [https://gist.github.com/thomcc/4c23eeed3b248394bffa0bff04f5c00b here] beneficial as well.&lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. More information on bundles is available [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial/Bundles here].&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. Sync code used to live in a repository named services-central, however currently all client side sync code for Desktop Firefox and Firefox for Android lives in mozilla-central.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can push to try using `mach try`, which works for both `git` and `hg` users (assuming git users are using git cinnabar), and is recommended for both.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing]. Sync tests are located at [https://searchfox.org/mozilla-central/source/services/sync/tests/unit/ /services/sync/tests/unit]&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests TPS Tests]&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for FxA&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#fxa&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188724</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188724"/>
		<updated>2018-02-08T16:10:50Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: /* Make sure -central is open and green */ minor edit, fix a typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Trace&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Trace&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
 # Enable trace logging for engines&lt;br /&gt;
 services.sync.log.logger.engine Trace&lt;br /&gt;
 &lt;br /&gt;
 # (optional) Enable trace logging for all of sync (this is very verbose and will include all request bodies)&lt;br /&gt;
 services.sync.log.logger Trace&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
Sync code is almost exclusively JavaScript, and so you probably should build using an artifact build, as described [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds here].&lt;br /&gt;
&lt;br /&gt;
After setting this up, you&#039;ll do `mach build` to perform a build, `mach run` to run Firefox, and `mach xpcshell-test /services/sync/tests/unit` to run the sync unit test suite. There&#039;s also a separate end-to-end test suite, TPS, which is documented [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests here]. (For most changes its sufficient you run the unit tests)&lt;br /&gt;
&lt;br /&gt;
Depending on your OS, most changes will not require a rebuild to take effect, only restarting and rerunning via `mach run`.&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [http://hg.mozilla.org/mozilla-central mozilla-central].&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Note: This section may be outdated.&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to m-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course). It&#039;s recommended that you use autoland via mozreview, or flag bugs as having checkin-needed instead. &lt;br /&gt;
&lt;br /&gt;
=== Make sure mozilla-central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://treeherder.mozilla.org treeherder].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which mozilla-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained. The mozilla-central mirror is available at https://github.com/mozilla/gecko-dev, however we recommend that you use https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development to set up a local git repository that tracks mozilla central. If you already have a gecko-dev clone, you can use [https://github.com/glandium/git-cinnabar/wiki/Mozilla:-Using-a-git-clone-of-gecko%E2%80%90dev-to-push-to-mercurial this guide] to configure it to push to hg using git-cinnabar.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
 &lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
If you find you have a slow git prompt, you may find the instructions [https://gist.github.com/thomcc/4c23eeed3b248394bffa0bff04f5c00b here] beneficial as well.&lt;br /&gt;
&lt;br /&gt;
After setting up &lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. More information on bundles is available [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial/Bundles here].&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. Sync code used to live in a repository named services-central, however currently all client side sync code for Desktop Firefox and Firefox for Android lives in mozilla-central.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can push to try using `mach try`, which works for both `git` and `hg` users (assuming git users are using git cinnabar), and is recommended for both.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing]. Sync tests are located at [https://searchfox.org/mozilla-central/source/services/sync/tests/unit/ /services/sync/tests/unit]&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests TPS Tests]&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for FxA&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#fxa&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188723</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188723"/>
		<updated>2018-02-08T16:09:27Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: Various updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Trace&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Trace&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
 # Enable trace logging for engines&lt;br /&gt;
 services.sync.log.logger.engine Trace&lt;br /&gt;
 &lt;br /&gt;
 # (optional) Enable trace logging for all of sync (this is very verbose and will include all request bodies)&lt;br /&gt;
 services.sync.log.logger Trace&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
Sync code is almost exclusively JavaScript, and so you probably should build using an artifact build, as described [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds here].&lt;br /&gt;
&lt;br /&gt;
After setting this up, you&#039;ll do `mach build` to perform a build, `mach run` to run Firefox, and `mach xpcshell-test /services/sync/tests/unit` to run the sync unit test suite. There&#039;s also a separate end-to-end test suite, TPS, which is documented [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests here]. (For most changes its sufficient you run the unit tests)&lt;br /&gt;
&lt;br /&gt;
Depending on your OS, most changes will not require a rebuild to take effect, only restarting and rerunning via `mach run`.&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [http://hg.mozilla.org/mozilla-central mozilla-central].&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Note: This section may be outdated.&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to m-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course). It&#039;s recommended that you use autoland via mozreview, or flag bugs as having checkin-needed instead. &lt;br /&gt;
&lt;br /&gt;
=== Make sure -central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://treeherder.mozilla.org treeherder].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which mozilla-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained. The mozilla-central mirror is available at https://github.com/mozilla/gecko-dev, however we recommend that you use https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development to set up a local git repository that tracks mozilla central. If you already have a gecko-dev clone, you can use [https://github.com/glandium/git-cinnabar/wiki/Mozilla:-Using-a-git-clone-of-gecko%E2%80%90dev-to-push-to-mercurial this guide] to configure it to push to hg using git-cinnabar.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
 &lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
If you find you have a slow git prompt, you may find the instructions [https://gist.github.com/thomcc/4c23eeed3b248394bffa0bff04f5c00b here] beneficial as well.&lt;br /&gt;
&lt;br /&gt;
After setting up &lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. More information on bundles is available [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Source_Code/Mercurial/Bundles here].&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. Sync code used to live in a repository named services-central, however currently all client side sync code for Desktop Firefox and Firefox for Android lives in mozilla-central.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
Alternatively, you can push to try using `mach try`, which works for both `git` and `hg` users (assuming git users are using git cinnabar), and is recommended for both.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing]. Sync tests are located at [https://searchfox.org/mozilla-central/source/services/sync/tests/unit/ /services/sync/tests/unit]&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests TPS Tests]&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for FxA&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#fxa&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188721</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188721"/>
		<updated>2018-02-08T15:47:22Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: /* Building Sync */ Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Trace&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Trace&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
 # Enable trace logging for engines&lt;br /&gt;
 services.sync.log.logger.engine Trace&lt;br /&gt;
 &lt;br /&gt;
 # (optional) Enable trace logging for all of sync (this is very verbose and will include all request bodies)&lt;br /&gt;
 services.sync.log.logger Trace&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
Sync code is almost exclusively JavaScript, and so you probably should build using an artifact build, as described [https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds here].&lt;br /&gt;
&lt;br /&gt;
After setting this up, you&#039;ll do `mach build` to perform a build, `mach run` to run Firefox, and `mach xpcshell-test /services/sync/tests/unit` to run the sync unit test suite. There&#039;s also a separate end-to-end test suite, TPS, which is documented [https://developer.mozilla.org/en-US/docs/Mozilla/Projects/TPS_Tests here]. (For most changes its sufficient you run the unit tests)&lt;br /&gt;
&lt;br /&gt;
Depending on your OS, most changes will not require a rebuild to take effect, only restarting and rerunning via `mach run`.&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [https://hg.mozilla.org/services/services-central services-central], which is the Mercurial repository used for Services client work.&lt;br /&gt;
&lt;br /&gt;
On rare occasions it will make more sense to land work on [http://hg.mozilla.org/mozilla-central mozilla-central] instead — for example, if a change needs to propagate upstream before the regular [[Services/Process/MergingBetweenBranches|merge from services-central to mozilla-central]]. This might involve additional procedures (e.g., you need to request approval in addition to review.)&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
You can find the Services team&#039;s code repository at [http://hg.mozilla.org/services].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to s-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course).&lt;br /&gt;
&lt;br /&gt;
=== Make sure services-central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://tbpl.mozilla.org/?tree=Services-Central TBPL].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which services-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained.&lt;br /&gt;
&lt;br /&gt;
The Services team maintains a GitHub organization at https://github.com/mozilla-services. A mirror of services-central can be found at https://github.com/mozilla-services/services-central.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
&lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
= Android Sync =&lt;br /&gt;
&lt;br /&gt;
You should carefully read the previous sections on Git and landing patches on services-central.&lt;br /&gt;
&lt;br /&gt;
For the moment we assume that you have a working checkout of [http://github.com/mozilla-services/android-sync android-sync]. The rudiments of landing code are this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AS=~/moz/git/android-sync&lt;br /&gt;
SC=~/moz/hg/services-central&lt;br /&gt;
&lt;br /&gt;
# In your services-central checkout, create a new patch.&lt;br /&gt;
# Ensure that you&#039;re correctly carrying over the author from the Git commit.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg qnew -m &amp;quot;Bug 123456 - Part 1: frob the noo. r=foobar, a=blocking-fennec&amp;quot; --user &amp;quot;John Smith &amp;lt;theauthor@foo.com&amp;gt;&amp;quot; frob-noo&lt;br /&gt;
&lt;br /&gt;
# For each merged piece of work that you&#039;d like to land...&lt;br /&gt;
# Ensure you&#039;re on the correct git branch. That&#039;s typically develop, or an&lt;br /&gt;
# ancestor thereof if you&#039;ve merged multiple feature branches since your last landing.&lt;br /&gt;
cd $AS&lt;br /&gt;
git checkout develop&lt;br /&gt;
&lt;br /&gt;
# Run the appropriate copy-code script, targeting the correct upstream hg repository.&lt;br /&gt;
ANDROID=$SC/mobile/android SYNC=$SC/mobile/android/sync ./fennec-copy-code.sh&lt;br /&gt;
&lt;br /&gt;
# Refresh the patch, adding and removing any files.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg st&lt;br /&gt;
hg add any-missing-files.java&lt;br /&gt;
hg rm anything-removed.java&lt;br /&gt;
hg qref&lt;br /&gt;
&lt;br /&gt;
# Check that the patch is what you want to commit.&lt;br /&gt;
# You are responsible for anything that you land in the tree,&lt;br /&gt;
# so it behooves you to make sure you get this right.&lt;br /&gt;
less .hg/patches/frob-noo&lt;br /&gt;
&lt;br /&gt;
# Ensure that everything builds.&lt;br /&gt;
make -sj4 -C objdir-droid&lt;br /&gt;
&lt;br /&gt;
# And runs...&lt;br /&gt;
make -C objdir-droid package&lt;br /&gt;
adb install -r objdir-droid/dist/fennec-15.0a1.en-US.android-arm.apk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now follow the steps for a regular services-central landing.&lt;br /&gt;
&lt;br /&gt;
This is all eminently scriptable, of course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. The services-central bundle is [http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/services-central.hg here].&lt;br /&gt;
&lt;br /&gt;
== services-central ==&lt;br /&gt;
&lt;br /&gt;
[https://hg.mozilla.org/services/services-central services-central] is the clone of mozilla-central in which the Sync client (and other stable Services client-side projects) are developed.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* Built-in UI in browser/base/content/.&lt;br /&gt;
&lt;br /&gt;
== fx-sync ==&lt;br /&gt;
&lt;br /&gt;
Sync was primarily developed in the [https://hg.mozilla.org/services/fx-sync/ fx-sync] repository. The code there includes support for the Sync add-on; it&#039;s deprecated since Firefox 4.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* The Firefox Sync add-on in addon/*&lt;br /&gt;
&lt;br /&gt;
* The Firefox 3.x and Fennec 1.x UIs for the Sync add-on in ui/*&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. How mozilla-central is relevant to Sync:&lt;br /&gt;
&lt;br /&gt;
* services-central is [[Services/Process/MergingBetweenBranches|periodically merged into mozilla-central]].&lt;br /&gt;
&lt;br /&gt;
* The integrated UI for Firefox Sync lives in browser/base/*, along with the rest of the Firefox UI.&lt;br /&gt;
&lt;br /&gt;
* Firefox releases are spun from mozilla-central. Changes made to services-central don&#039;t directly reach users.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
Because Sync is developed in a clone of mozilla-central, you can use ordinary &amp;quot;try build&amp;quot; procedures to test your changes. (You don&#039;t always need to, though; one of the advantages of having an integration branch like services-central is that we&#039;re at liberty to break it!)&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing].&lt;br /&gt;
&lt;br /&gt;
==Python Functional Tests==&lt;br /&gt;
&lt;br /&gt;
In the services/ tree are a handful of HTTP servers implemented in JS. These are effectively lightweight clones of the services described by the specs at http://docs.services.mozilla.com/.&lt;br /&gt;
&lt;br /&gt;
The main implementations of these services are in Python. And, there exist a Python test suite that you can point at any HTTP endpoint and they will validate the functional behavior of the server. We use these Python functional tests to validate that the in-tree JS server implementations are functionally proper.&lt;br /&gt;
&lt;br /&gt;
To run these functional tests, you&#039;ll need a built Firefox source tree and will need to obtain the Python server code, which contains the tests.&lt;br /&gt;
&lt;br /&gt;
===Running JS Servers===&lt;br /&gt;
&lt;br /&gt;
There is Makefile magic in services/common/Makefile that can launch a standalone JS server instance. From your object directory:&lt;br /&gt;
&lt;br /&gt;
 make -C services/common storage-server&lt;br /&gt;
 make -C services/common aitc-server&lt;br /&gt;
&lt;br /&gt;
===Running Python Functional Tests===&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need to obtain the server source code, then launch the tests. For example:&lt;br /&gt;
&lt;br /&gt;
 git clone git://github.com/mozilla-services/server-syncstorage.git&lt;br /&gt;
 cd server-syncstorage&lt;br /&gt;
 make&lt;br /&gt;
 source bin/activate&lt;br /&gt;
 python syncstorage/tests/functional/test_storage.py http://localhost:8080&lt;br /&gt;
&lt;br /&gt;
If you see lots of errors like&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;syncstorage/tests/functional/test_storage.py&amp;quot;, line 52, in setUp&lt;br /&gt;
    super(TestStorage, self).setUp()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 36, in setUp&lt;br /&gt;
    self._authenticate()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 49, in _authenticate&lt;br /&gt;
    auth_policy = self.config.registry.getUtility(IAuthenticationPolicy)&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/lib/python2.7/site-packages/zope/interface/registry.py&amp;quot;, line 169, in getUtility&lt;br /&gt;
    raise ComponentLookupError(provided, name)&lt;br /&gt;
 ComponentLookupError: (&amp;lt;InterfaceClass pyramid.interfaces.IAuthenticationPolicy&amp;gt;, u&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
you may need to follow the instructions at https://mail.mozilla.org/pipermail/services-dev/2012-September/001564.html.&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for Identity&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#identity&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Team Meetings ==&lt;br /&gt;
&lt;br /&gt;
* Services Weekly Status: Every Tuesday at 9:15 PT in North Bridge (4th floor), [https://intranet.mozilla.org/Teleconferencing conference dial] in number is #8616. Meeting notes live under [https://wiki.mozilla.org/Services/Meetings/ Services/Meetings].&lt;br /&gt;
* [[WeeklyUpdates|Mozilla Weekly Updates]]: Every Monday at 11:00 PT in 10-Forward (you&#039;ll need to attend the first one in person since we want to show you off.)&lt;br /&gt;
* Out-of-office, PTO, and other kinds of availability is managed in a shared &amp;quot;Services Team Availability&amp;quot; calendar. See [https://intranet.mozilla.org/Calendar#Shared_Company_Calendars Shared Company Calenders] for details on how to set it up.&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188720</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188720"/>
		<updated>2018-02-08T15:41:23Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: /* Debugging Sync */ Update logging information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Trace&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Trace&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
 # Enable trace logging for engines&lt;br /&gt;
 services.sync.log.logger.engine Trace&lt;br /&gt;
 &lt;br /&gt;
 # (optional) Enable trace logging for all of sync (this is very verbose and will include all request bodies)&lt;br /&gt;
 services.sync.log.logger Trace&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
The party line to rebuild the tree after making changes is to run:&lt;br /&gt;
&lt;br /&gt;
 $ make -f client.mk&lt;br /&gt;
 or from the object directory:&lt;br /&gt;
 $ make -sj8&lt;br /&gt;
&lt;br /&gt;
However, this is slow. If you have simply changed a JS file in &#039;&#039;services/sync/&#039;&#039;, it is sufficient to run the following from your object directory:&lt;br /&gt;
&lt;br /&gt;
 $ make -sj8 -C services/sync&lt;br /&gt;
&lt;br /&gt;
The xpcshell tests will pick up changes immediately. However, if you launch Firefox, your changes &#039;&#039;&#039;won&#039;t&#039;&#039;&#039; be reflected. For that, you&#039;ll also need to rebuild the browser component:&lt;br /&gt;
&lt;br /&gt;
 $ make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser&lt;br /&gt;
&lt;br /&gt;
A handy alias to have around is:&lt;br /&gt;
&lt;br /&gt;
 $ alias sync-launch make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser &amp;amp;&amp;amp; dist/bin/firefox -no-remote -ProfileManager&lt;br /&gt;
&lt;br /&gt;
Or, on OS X:&lt;br /&gt;
&lt;br /&gt;
 $ alias sync-launch make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser &amp;amp;&amp;amp; dist/NightlyDebug.app/Contents/MacOS/ -no-remote -ProfileManager&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [https://hg.mozilla.org/services/services-central services-central], which is the Mercurial repository used for Services client work.&lt;br /&gt;
&lt;br /&gt;
On rare occasions it will make more sense to land work on [http://hg.mozilla.org/mozilla-central mozilla-central] instead — for example, if a change needs to propagate upstream before the regular [[Services/Process/MergingBetweenBranches|merge from services-central to mozilla-central]]. This might involve additional procedures (e.g., you need to request approval in addition to review.)&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
You can find the Services team&#039;s code repository at [http://hg.mozilla.org/services].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to s-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course).&lt;br /&gt;
&lt;br /&gt;
=== Make sure services-central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://tbpl.mozilla.org/?tree=Services-Central TBPL].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which services-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained.&lt;br /&gt;
&lt;br /&gt;
The Services team maintains a GitHub organization at https://github.com/mozilla-services. A mirror of services-central can be found at https://github.com/mozilla-services/services-central.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
&lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
= Android Sync =&lt;br /&gt;
&lt;br /&gt;
You should carefully read the previous sections on Git and landing patches on services-central.&lt;br /&gt;
&lt;br /&gt;
For the moment we assume that you have a working checkout of [http://github.com/mozilla-services/android-sync android-sync]. The rudiments of landing code are this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AS=~/moz/git/android-sync&lt;br /&gt;
SC=~/moz/hg/services-central&lt;br /&gt;
&lt;br /&gt;
# In your services-central checkout, create a new patch.&lt;br /&gt;
# Ensure that you&#039;re correctly carrying over the author from the Git commit.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg qnew -m &amp;quot;Bug 123456 - Part 1: frob the noo. r=foobar, a=blocking-fennec&amp;quot; --user &amp;quot;John Smith &amp;lt;theauthor@foo.com&amp;gt;&amp;quot; frob-noo&lt;br /&gt;
&lt;br /&gt;
# For each merged piece of work that you&#039;d like to land...&lt;br /&gt;
# Ensure you&#039;re on the correct git branch. That&#039;s typically develop, or an&lt;br /&gt;
# ancestor thereof if you&#039;ve merged multiple feature branches since your last landing.&lt;br /&gt;
cd $AS&lt;br /&gt;
git checkout develop&lt;br /&gt;
&lt;br /&gt;
# Run the appropriate copy-code script, targeting the correct upstream hg repository.&lt;br /&gt;
ANDROID=$SC/mobile/android SYNC=$SC/mobile/android/sync ./fennec-copy-code.sh&lt;br /&gt;
&lt;br /&gt;
# Refresh the patch, adding and removing any files.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg st&lt;br /&gt;
hg add any-missing-files.java&lt;br /&gt;
hg rm anything-removed.java&lt;br /&gt;
hg qref&lt;br /&gt;
&lt;br /&gt;
# Check that the patch is what you want to commit.&lt;br /&gt;
# You are responsible for anything that you land in the tree,&lt;br /&gt;
# so it behooves you to make sure you get this right.&lt;br /&gt;
less .hg/patches/frob-noo&lt;br /&gt;
&lt;br /&gt;
# Ensure that everything builds.&lt;br /&gt;
make -sj4 -C objdir-droid&lt;br /&gt;
&lt;br /&gt;
# And runs...&lt;br /&gt;
make -C objdir-droid package&lt;br /&gt;
adb install -r objdir-droid/dist/fennec-15.0a1.en-US.android-arm.apk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now follow the steps for a regular services-central landing.&lt;br /&gt;
&lt;br /&gt;
This is all eminently scriptable, of course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. The services-central bundle is [http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/services-central.hg here].&lt;br /&gt;
&lt;br /&gt;
== services-central ==&lt;br /&gt;
&lt;br /&gt;
[https://hg.mozilla.org/services/services-central services-central] is the clone of mozilla-central in which the Sync client (and other stable Services client-side projects) are developed.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* Built-in UI in browser/base/content/.&lt;br /&gt;
&lt;br /&gt;
== fx-sync ==&lt;br /&gt;
&lt;br /&gt;
Sync was primarily developed in the [https://hg.mozilla.org/services/fx-sync/ fx-sync] repository. The code there includes support for the Sync add-on; it&#039;s deprecated since Firefox 4.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* The Firefox Sync add-on in addon/*&lt;br /&gt;
&lt;br /&gt;
* The Firefox 3.x and Fennec 1.x UIs for the Sync add-on in ui/*&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. How mozilla-central is relevant to Sync:&lt;br /&gt;
&lt;br /&gt;
* services-central is [[Services/Process/MergingBetweenBranches|periodically merged into mozilla-central]].&lt;br /&gt;
&lt;br /&gt;
* The integrated UI for Firefox Sync lives in browser/base/*, along with the rest of the Firefox UI.&lt;br /&gt;
&lt;br /&gt;
* Firefox releases are spun from mozilla-central. Changes made to services-central don&#039;t directly reach users.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
Because Sync is developed in a clone of mozilla-central, you can use ordinary &amp;quot;try build&amp;quot; procedures to test your changes. (You don&#039;t always need to, though; one of the advantages of having an integration branch like services-central is that we&#039;re at liberty to break it!)&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing].&lt;br /&gt;
&lt;br /&gt;
==Python Functional Tests==&lt;br /&gt;
&lt;br /&gt;
In the services/ tree are a handful of HTTP servers implemented in JS. These are effectively lightweight clones of the services described by the specs at http://docs.services.mozilla.com/.&lt;br /&gt;
&lt;br /&gt;
The main implementations of these services are in Python. And, there exist a Python test suite that you can point at any HTTP endpoint and they will validate the functional behavior of the server. We use these Python functional tests to validate that the in-tree JS server implementations are functionally proper.&lt;br /&gt;
&lt;br /&gt;
To run these functional tests, you&#039;ll need a built Firefox source tree and will need to obtain the Python server code, which contains the tests.&lt;br /&gt;
&lt;br /&gt;
===Running JS Servers===&lt;br /&gt;
&lt;br /&gt;
There is Makefile magic in services/common/Makefile that can launch a standalone JS server instance. From your object directory:&lt;br /&gt;
&lt;br /&gt;
 make -C services/common storage-server&lt;br /&gt;
 make -C services/common aitc-server&lt;br /&gt;
&lt;br /&gt;
===Running Python Functional Tests===&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need to obtain the server source code, then launch the tests. For example:&lt;br /&gt;
&lt;br /&gt;
 git clone git://github.com/mozilla-services/server-syncstorage.git&lt;br /&gt;
 cd server-syncstorage&lt;br /&gt;
 make&lt;br /&gt;
 source bin/activate&lt;br /&gt;
 python syncstorage/tests/functional/test_storage.py http://localhost:8080&lt;br /&gt;
&lt;br /&gt;
If you see lots of errors like&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;syncstorage/tests/functional/test_storage.py&amp;quot;, line 52, in setUp&lt;br /&gt;
    super(TestStorage, self).setUp()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 36, in setUp&lt;br /&gt;
    self._authenticate()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 49, in _authenticate&lt;br /&gt;
    auth_policy = self.config.registry.getUtility(IAuthenticationPolicy)&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/lib/python2.7/site-packages/zope/interface/registry.py&amp;quot;, line 169, in getUtility&lt;br /&gt;
    raise ComponentLookupError(provided, name)&lt;br /&gt;
 ComponentLookupError: (&amp;lt;InterfaceClass pyramid.interfaces.IAuthenticationPolicy&amp;gt;, u&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
you may need to follow the instructions at https://mail.mozilla.org/pipermail/services-dev/2012-September/001564.html.&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for Identity&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#identity&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Team Meetings ==&lt;br /&gt;
&lt;br /&gt;
* Services Weekly Status: Every Tuesday at 9:15 PT in North Bridge (4th floor), [https://intranet.mozilla.org/Teleconferencing conference dial] in number is #8616. Meeting notes live under [https://wiki.mozilla.org/Services/Meetings/ Services/Meetings].&lt;br /&gt;
* [[WeeklyUpdates|Mozilla Weekly Updates]]: Every Monday at 11:00 PT in 10-Forward (you&#039;ll need to attend the first one in person since we want to show you off.)&lt;br /&gt;
* Out-of-office, PTO, and other kinds of availability is managed in a shared &amp;quot;Services Team Availability&amp;quot; calendar. See [https://intranet.mozilla.org/Calendar#Shared_Company_Calendars Shared Company Calenders] for details on how to set it up.&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188719</id>
		<title>Services/Sync/Getting Started</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=Services/Sync/Getting_Started&amp;diff=1188719"/>
		<updated>2018-02-08T15:37:16Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: /* Source Code */ Update repo link, mention /services/fxaccounts.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Hacking =&lt;br /&gt;
&lt;br /&gt;
== Source Code ==&lt;br /&gt;
&lt;br /&gt;
Once you have a copy of the Mozilla source tree (read below for how to obtain a copy), you can find the core Sync source code in:&lt;br /&gt;
&lt;br /&gt;
 /services/sync/&lt;br /&gt;
&lt;br /&gt;
You can view this online at https://hg.mozilla.org/mozilla-unified/file/default/services/sync&lt;br /&gt;
&lt;br /&gt;
This is just the core JavaScript APIs and logic. Additional Sync code for integration with Firefox lives in:&lt;br /&gt;
&lt;br /&gt;
 /browser/base/content&lt;br /&gt;
&lt;br /&gt;
Look for files with &#039;&#039;sync&#039;&#039; in their name. Files here define the integration between Firefox and Sync. This includes all the Sync UI.&lt;br /&gt;
&lt;br /&gt;
Additionally, Firefox Accounts specific code lives in&lt;br /&gt;
&lt;br /&gt;
 /services/fxaccounts&lt;br /&gt;
&lt;br /&gt;
== Debugging Sync ==&lt;br /&gt;
&lt;br /&gt;
If you are debugging Sync in your browser, the first thing you want to do is crank up the logging. In about:config, set the following preferences:&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to Error Console&lt;br /&gt;
 services.sync.log.appender.console Debug&lt;br /&gt;
&lt;br /&gt;
 # Enable logging to STDOUT&lt;br /&gt;
 services.sync.log.appender.dump Debug&lt;br /&gt;
&lt;br /&gt;
 # Log full sync logs on sync success (typically they are only saved on failure)&lt;br /&gt;
 services.sync.log.appender.file.logOnSuccess true&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve updated those settings, restart Firefox for them to take effect.&lt;br /&gt;
&lt;br /&gt;
If you are logging to STDOUT, you may want to set the environment variable &#039;&#039;MOZ_QUIET&#039;&#039; to silence a lot of spew from other parts of Firefox:&lt;br /&gt;
&lt;br /&gt;
 export MOZ_QUIET=1&lt;br /&gt;
&lt;br /&gt;
You can view full sync logs by opening &#039;&#039;&#039;about:sync-log&#039;&#039;&#039; in Firefox.&lt;br /&gt;
&lt;br /&gt;
== Building Sync ==&lt;br /&gt;
&lt;br /&gt;
The party line to rebuild the tree after making changes is to run:&lt;br /&gt;
&lt;br /&gt;
 $ make -f client.mk&lt;br /&gt;
 or from the object directory:&lt;br /&gt;
 $ make -sj8&lt;br /&gt;
&lt;br /&gt;
However, this is slow. If you have simply changed a JS file in &#039;&#039;services/sync/&#039;&#039;, it is sufficient to run the following from your object directory:&lt;br /&gt;
&lt;br /&gt;
 $ make -sj8 -C services/sync&lt;br /&gt;
&lt;br /&gt;
The xpcshell tests will pick up changes immediately. However, if you launch Firefox, your changes &#039;&#039;&#039;won&#039;t&#039;&#039;&#039; be reflected. For that, you&#039;ll also need to rebuild the browser component:&lt;br /&gt;
&lt;br /&gt;
 $ make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser&lt;br /&gt;
&lt;br /&gt;
A handy alias to have around is:&lt;br /&gt;
&lt;br /&gt;
 $ alias sync-launch make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser &amp;amp;&amp;amp; dist/bin/firefox -no-remote -ProfileManager&lt;br /&gt;
&lt;br /&gt;
Or, on OS X:&lt;br /&gt;
&lt;br /&gt;
 $ alias sync-launch make -sj8 -C services/sync &amp;amp;&amp;amp; make -sj8 -C browser &amp;amp;&amp;amp; dist/NightlyDebug.app/Contents/MacOS/ -no-remote -ProfileManager&lt;br /&gt;
&lt;br /&gt;
= Using Bugzilla =&lt;br /&gt;
&lt;br /&gt;
Every code change starts out as a bug in [https://bugzilla.mozilla.org Bugzilla] where the general approach can be discussed. The bug should eventually be assigned to somebody who will upload one or more patches for review. Code can only be reviewed by module owners and their peers; see [[Services/Code_Review|code review policy]] for more information. If the review has been granted and all review comments have been addressed, the patches may be checked into [https://hg.mozilla.org/services/services-central services-central], which is the Mercurial repository used for Services client work.&lt;br /&gt;
&lt;br /&gt;
On rare occasions it will make more sense to land work on [http://hg.mozilla.org/mozilla-central mozilla-central] instead — for example, if a change needs to propagate upstream before the regular [[Services/Process/MergingBetweenBranches|merge from services-central to mozilla-central]]. This might involve additional procedures (e.g., you need to request approval in addition to review.)&lt;br /&gt;
&lt;br /&gt;
For server code written in Python, Tarek has provided a useful tool called [https://bitbucket.org/tarek/flake8 flake8] which does Python style checks against your code. &lt;br /&gt;
&lt;br /&gt;
You probably also want to get up to speed on [http://bugzilla.mozilla.org Bugzilla] if you&#039;re not already.&lt;br /&gt;
* A good start is to go watch [http://vimeo.com/9205730 Jonath&#039;s &amp;quot;Bugzilla for Humans&amp;quot; video].&lt;br /&gt;
* Our bugs are currently under &amp;quot;Other Products&amp;quot;, &amp;quot;Mozilla Services&amp;quot; or just bookmark &amp;quot;[https://bugzilla.mozilla.org/enter_bug.cgi?product=Mozilla%20Services Add a bug]&amp;quot; and &amp;quot;[https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services Browse bugs]&amp;quot;.&lt;br /&gt;
* Don&#039;t forget to add a Bugzilla ID shortcut string to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=account account preferences].  The current standard practice is to append &amp;quot;&amp;lt;whitespace&amp;gt;[:irc_nick]&amp;quot; to your Real Name field.&lt;br /&gt;
* You also want to watch the components relevant to your work so you automatically get emails for all bug changes in those components. The easiest way to do this is to add the default QA contact for each component to the list of users your are watching in Bugzilla&lt;br /&gt;
** Open the [https://bugzilla.mozilla.org/describecomponents.cgi?product=Mozilla%20Services list of Services components]&lt;br /&gt;
** In another tab go to your Bugzilla [https://bugzilla.mozilla.org/userprefs.cgi?tab=email email preferences]&lt;br /&gt;
** At the bottom of the page under the &amp;lt;b&amp;gt;User Watching&amp;lt;/b&amp;gt; section there is an input form that takes a comma separated list of email addresses&lt;br /&gt;
** If you&#039;re working on server side components, you will want to add at least:&lt;br /&gt;
*** core-server@services.bugs&lt;br /&gt;
*** sync-server@services.bugs&lt;br /&gt;
* A useful Firefox add-on that makes life in Bugzilla a bit easier is [https://addons.mozilla.org/en-Us/firefox/addon/bugzilla-tweaks/ Bugzilla Tweaks]. Highly recommended!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Using Mercurial =&lt;br /&gt;
&lt;br /&gt;
Mozilla&#039;s development process is very much patch driven. [https://developer.mozilla.org/En/Developer_Guide/Source_Code Mozilla uses Mercurial] (as well as git for some projects) as the version control system. [https://developer.mozilla.org/en/Mercurial_queues Mercurial Patch Queues], although a bit awkward to use at times, fit this process rather well. It is recommended you familiarize yourself with them and use them.&lt;br /&gt;
&lt;br /&gt;
You can find the Services team&#039;s code repository at [http://hg.mozilla.org/services].&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
Marco Bonardo has some [http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed general purpose tips] for Mozilla developers on how to format patches before uploading them to Bugzilla.&lt;br /&gt;
&lt;br /&gt;
Essentially it is recommended you put the following in your ~/.hgrc:&lt;br /&gt;
&lt;br /&gt;
  [ui]&lt;br /&gt;
  username = Your Name &amp;lt;you@mozilla.com&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  [extensions]&lt;br /&gt;
  hgext.mq = &lt;br /&gt;
  &lt;br /&gt;
  [diff]&lt;br /&gt;
  git = 1&lt;br /&gt;
  unified = 8&lt;br /&gt;
  &lt;br /&gt;
  [defaults]&lt;br /&gt;
  diff = -pU8&lt;br /&gt;
  qdiff = -pU8&lt;br /&gt;
  qnew = -U&lt;br /&gt;
  qseries = -sv&lt;br /&gt;
&lt;br /&gt;
If you find yourself mixing up `hg qpush` (push a patch onto your queue) and `hg push` (irreversibly push your changes out into the world) try adding this:&lt;br /&gt;
&lt;br /&gt;
  [hooks]&lt;br /&gt;
  preoutgoing.confirm = read -p &#039;Are you sure you want to push to remote? (y/n): &#039;; echo $REPLY | grep -q &#039;y&#039;&lt;br /&gt;
&lt;br /&gt;
(Note from philikon: I consider this hook pretty much useless. Mercurial will warn and abort if you&#039;re trying to with patches applied. So if you have any applied patches, it&#039;s very hard to accidentally push them. If you don&#039;t have applied patches, you&#039;re most likely not to have anything the remote repo doesn&#039;t have either.)&lt;br /&gt;
&lt;br /&gt;
Also, useful path definitions:&lt;br /&gt;
&lt;br /&gt;
  [paths]&lt;br /&gt;
  try = ssh://hg.mozilla.org/try/&lt;br /&gt;
  places = ssh://hg.mozilla.org/projects/places/&lt;br /&gt;
  mc = ssh://hg.mozilla.org/mozilla-central/&lt;br /&gt;
&lt;br /&gt;
== Landing patches ==&lt;br /&gt;
&lt;br /&gt;
You have items in a patch queue that you&#039;d like to push to s-c. Here&#039;s the thorough set of steps to follow to get them into the tree (assuming you have commit access, of course).&lt;br /&gt;
&lt;br /&gt;
=== Make sure services-central is open and green ===&lt;br /&gt;
&lt;br /&gt;
Check [https://tbpl.mozilla.org/?tree=Services-Central TBPL].&lt;br /&gt;
&lt;br /&gt;
=== Make sure your tree is up to date ===&lt;br /&gt;
&lt;br /&gt;
  hg qpop --all&lt;br /&gt;
  hg pull -u&lt;br /&gt;
&lt;br /&gt;
===  Make sure that all the patches have a proper commit message ===&lt;br /&gt;
&lt;br /&gt;
For simple bugs, the format is&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
For bugs with several parts, you can do&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Bug Summary here. r=your_reviewers_IRC_nickname&lt;br /&gt;
  `&lt;br /&gt;
  Part X: Frobnicate the majiggaberator&lt;br /&gt;
&lt;br /&gt;
Or simply&lt;br /&gt;
&lt;br /&gt;
  Bug NNNNNN - Part X: Frobnicate the majiggaberator. r=your_reviewers_IRC_nickname&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;hg qser -sv&amp;lt;/tt&amp;gt; (omit the &amp;lt;tt&amp;gt;-sv&amp;lt;/tt&amp;gt; if you&#039;re using the config above). The output will look something like&lt;br /&gt;
&lt;br /&gt;
  0 U favicons-1a: Bug 675996 - Part 1: extend moz_favicons with GUID to support Sync. r=mak&lt;br /&gt;
  1 U favicons-1b: Bug 675996 - Part 2: adjust Places migration tests to expect current version, not v11; tests for GUIDs in favicons. r=mak&lt;br /&gt;
&lt;br /&gt;
If they don&#039;t, &amp;lt;tt&amp;gt;hg qpush&amp;lt;/tt&amp;gt; each one and edit the summary with &amp;lt;tt&amp;gt;hg qref -e&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Ensure that the only patches you have applied are the ones you want to push ===&lt;br /&gt;
&lt;br /&gt;
… and that they&#039;re the ones that were reviewed. You can reorder patches by &amp;lt;tt&amp;gt;hg qpop --all&amp;lt;/tt&amp;gt; then &amp;lt;tt&amp;gt;hg qpush --move $patchname&amp;lt;/tt&amp;gt;, or by manually reordering .hg/patches/series. &#039;&#039;Only edit the series file when all patches have been popped.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Applied patches are indicated by an &#039;A&#039; in the 2nd column of qseries. Unapplied are &#039;U&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Run tests ===&lt;br /&gt;
&lt;br /&gt;
Now is a great time to run tests, because this is the state in which services-central will be after you push. If you apply a &amp;lt;tt&amp;gt;tests&amp;lt;/tt&amp;gt; patch to re-enable disabled tests, &#039;&#039;make sure you pop it when you&#039;re done&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Finish the applied patches ===&lt;br /&gt;
&lt;br /&gt;
  hg qfinish --applied&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Verify what you&#039;re going to upload ===&lt;br /&gt;
  hg out&lt;br /&gt;
&lt;br /&gt;
If the command shows anything other than the patches you&#039;re expecting (or they&#039;re wrong in some way), &#039;&#039;stop&#039;&#039; and ask for help.&lt;br /&gt;
&lt;br /&gt;
=== Push! ===&lt;br /&gt;
&lt;br /&gt;
If all is good, push:&lt;br /&gt;
&lt;br /&gt;
  hg push&lt;br /&gt;
&lt;br /&gt;
= Using Git =&lt;br /&gt;
&lt;br /&gt;
Various projects exist as Git repositories instead of Mercurial repositories. Even when projects are officially hosted in Mercurial, Git mirrors are maintained.&lt;br /&gt;
&lt;br /&gt;
The Services team maintains a GitHub organization at https://github.com/mozilla-services. A mirror of services-central can be found at https://github.com/mozilla-services/services-central.&lt;br /&gt;
&lt;br /&gt;
== Configuring Git ==&lt;br /&gt;
&lt;br /&gt;
If this is your first time using Git, you&#039;ll need for perform some one-time configuration:&lt;br /&gt;
&lt;br /&gt;
 # Configure your global name and email. These will be used for commit info.&lt;br /&gt;
 $ git config --global user.name &amp;quot;John Doe&amp;quot;&lt;br /&gt;
 $ git config --global user.email &amp;quot;johndoe@mozilla.com&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Enable color output for all commands&lt;br /&gt;
 $ git config --global color.branch auto&lt;br /&gt;
 $ git config --global color.diff auto&lt;br /&gt;
 $ git config --global color.grep auto&lt;br /&gt;
 $ git config --global color.interactive auto&lt;br /&gt;
 $ git config --global color.status auto&lt;br /&gt;
 $ git config --global color.ui auto&lt;br /&gt;
&lt;br /&gt;
 # Highlight whitespace&lt;br /&gt;
 $ git config --global core.whitespace &amp;quot;trailing-space,space-before-tab,tab-in-indent&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 # Define your editor for commits, other tools&lt;br /&gt;
 $ git config --global core.editor vim&lt;br /&gt;
&lt;br /&gt;
= Android Sync =&lt;br /&gt;
&lt;br /&gt;
You should carefully read the previous sections on Git and landing patches on services-central.&lt;br /&gt;
&lt;br /&gt;
For the moment we assume that you have a working checkout of [http://github.com/mozilla-services/android-sync android-sync]. The rudiments of landing code are this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AS=~/moz/git/android-sync&lt;br /&gt;
SC=~/moz/hg/services-central&lt;br /&gt;
&lt;br /&gt;
# In your services-central checkout, create a new patch.&lt;br /&gt;
# Ensure that you&#039;re correctly carrying over the author from the Git commit.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg qnew -m &amp;quot;Bug 123456 - Part 1: frob the noo. r=foobar, a=blocking-fennec&amp;quot; --user &amp;quot;John Smith &amp;lt;theauthor@foo.com&amp;gt;&amp;quot; frob-noo&lt;br /&gt;
&lt;br /&gt;
# For each merged piece of work that you&#039;d like to land...&lt;br /&gt;
# Ensure you&#039;re on the correct git branch. That&#039;s typically develop, or an&lt;br /&gt;
# ancestor thereof if you&#039;ve merged multiple feature branches since your last landing.&lt;br /&gt;
cd $AS&lt;br /&gt;
git checkout develop&lt;br /&gt;
&lt;br /&gt;
# Run the appropriate copy-code script, targeting the correct upstream hg repository.&lt;br /&gt;
ANDROID=$SC/mobile/android SYNC=$SC/mobile/android/sync ./fennec-copy-code.sh&lt;br /&gt;
&lt;br /&gt;
# Refresh the patch, adding and removing any files.&lt;br /&gt;
cd $SC&lt;br /&gt;
hg st&lt;br /&gt;
hg add any-missing-files.java&lt;br /&gt;
hg rm anything-removed.java&lt;br /&gt;
hg qref&lt;br /&gt;
&lt;br /&gt;
# Check that the patch is what you want to commit.&lt;br /&gt;
# You are responsible for anything that you land in the tree,&lt;br /&gt;
# so it behooves you to make sure you get this right.&lt;br /&gt;
less .hg/patches/frob-noo&lt;br /&gt;
&lt;br /&gt;
# Ensure that everything builds.&lt;br /&gt;
make -sj4 -C objdir-droid&lt;br /&gt;
&lt;br /&gt;
# And runs...&lt;br /&gt;
make -C objdir-droid package&lt;br /&gt;
adb install -r objdir-droid/dist/fennec-15.0a1.en-US.android-arm.apk&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now follow the steps for a regular services-central landing.&lt;br /&gt;
&lt;br /&gt;
This is all eminently scriptable, of course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Repositories =&lt;br /&gt;
&lt;br /&gt;
Getting a checkout of a large Mercurial repository can be a pain if you&#039;re remote. Nobody wants to wait 6 hours while Python drools on its shoes. The answer is &#039;&#039;&#039;bundles&#039;&#039;&#039;. [https://developer.mozilla.org/en/Mozilla_Source_Code_%28Mercurial%29 Follow the directions]. The services-central bundle is [http://ftp.mozilla.org/pub/mozilla.org/firefox/bundles/services-central.hg here].&lt;br /&gt;
&lt;br /&gt;
== services-central ==&lt;br /&gt;
&lt;br /&gt;
[https://hg.mozilla.org/services/services-central services-central] is the clone of mozilla-central in which the Sync client (and other stable Services client-side projects) are developed.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* Built-in UI in browser/base/content/.&lt;br /&gt;
&lt;br /&gt;
== fx-sync ==&lt;br /&gt;
&lt;br /&gt;
Sync was primarily developed in the [https://hg.mozilla.org/services/fx-sync/ fx-sync] repository. The code there includes support for the Sync add-on; it&#039;s deprecated since Firefox 4.&lt;br /&gt;
&lt;br /&gt;
Things that live there:&lt;br /&gt;
&lt;br /&gt;
* The Services client libraries in services/crypto/ and services/sync.&lt;br /&gt;
&lt;br /&gt;
* The Firefox Sync add-on in addon/*&lt;br /&gt;
&lt;br /&gt;
* The Firefox 3.x and Fennec 1.x UIs for the Sync add-on in ui/*&lt;br /&gt;
&lt;br /&gt;
== mozilla-central ==&lt;br /&gt;
&lt;br /&gt;
mozilla-central is the repository for Firefox and the base repository for other Mozilla-based applications. How mozilla-central is relevant to Sync:&lt;br /&gt;
&lt;br /&gt;
* services-central is [[Services/Process/MergingBetweenBranches|periodically merged into mozilla-central]].&lt;br /&gt;
&lt;br /&gt;
* The integrated UI for Firefox Sync lives in browser/base/*, along with the rest of the Firefox UI.&lt;br /&gt;
&lt;br /&gt;
* Firefox releases are spun from mozilla-central. Changes made to services-central don&#039;t directly reach users.&lt;br /&gt;
&lt;br /&gt;
== Try server ==&lt;br /&gt;
&lt;br /&gt;
Because Sync is developed in a clone of mozilla-central, you can use ordinary &amp;quot;try build&amp;quot; procedures to test your changes. (You don&#039;t always need to, though; one of the advantages of having an integration branch like services-central is that we&#039;re at liberty to break it!)&lt;br /&gt;
&lt;br /&gt;
To push to try, teave your changes as applied mq patches. Then run:&lt;br /&gt;
&lt;br /&gt;
  hg push -f ssh://hg.mozilla.org/try/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Testing =&lt;br /&gt;
&lt;br /&gt;
[https://developer.mozilla.org/en/Writing_xpcshell-based_unit_tests Writing xpcshell-based unit testing].&lt;br /&gt;
&lt;br /&gt;
==Python Functional Tests==&lt;br /&gt;
&lt;br /&gt;
In the services/ tree are a handful of HTTP servers implemented in JS. These are effectively lightweight clones of the services described by the specs at http://docs.services.mozilla.com/.&lt;br /&gt;
&lt;br /&gt;
The main implementations of these services are in Python. And, there exist a Python test suite that you can point at any HTTP endpoint and they will validate the functional behavior of the server. We use these Python functional tests to validate that the in-tree JS server implementations are functionally proper.&lt;br /&gt;
&lt;br /&gt;
To run these functional tests, you&#039;ll need a built Firefox source tree and will need to obtain the Python server code, which contains the tests.&lt;br /&gt;
&lt;br /&gt;
===Running JS Servers===&lt;br /&gt;
&lt;br /&gt;
There is Makefile magic in services/common/Makefile that can launch a standalone JS server instance. From your object directory:&lt;br /&gt;
&lt;br /&gt;
 make -C services/common storage-server&lt;br /&gt;
 make -C services/common aitc-server&lt;br /&gt;
&lt;br /&gt;
===Running Python Functional Tests===&lt;br /&gt;
&lt;br /&gt;
You&#039;ll need to obtain the server source code, then launch the tests. For example:&lt;br /&gt;
&lt;br /&gt;
 git clone git://github.com/mozilla-services/server-syncstorage.git&lt;br /&gt;
 cd server-syncstorage&lt;br /&gt;
 make&lt;br /&gt;
 source bin/activate&lt;br /&gt;
 python syncstorage/tests/functional/test_storage.py http://localhost:8080&lt;br /&gt;
&lt;br /&gt;
If you see lots of errors like&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
  File &amp;quot;syncstorage/tests/functional/test_storage.py&amp;quot;, line 52, in setUp&lt;br /&gt;
    super(TestStorage, self).setUp()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 36, in setUp&lt;br /&gt;
    self._authenticate()&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/syncstorage/tests/functional/support.py&amp;quot;, line 49, in _authenticate&lt;br /&gt;
    auth_policy = self.config.registry.getUtility(IAuthenticationPolicy)&lt;br /&gt;
  File &amp;quot;/Users/ncalexan/Mozilla/server-syncstorage/lib/python2.7/site-packages/zope/interface/registry.py&amp;quot;, line 169, in getUtility&lt;br /&gt;
    raise ComponentLookupError(provided, name)&lt;br /&gt;
 ComponentLookupError: (&amp;lt;InterfaceClass pyramid.interfaces.IAuthenticationPolicy&amp;gt;, u&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
you may need to follow the instructions at https://mail.mozilla.org/pipermail/services-dev/2012-September/001564.html.&lt;br /&gt;
&lt;br /&gt;
= Collaboration =&lt;br /&gt;
&lt;br /&gt;
== IRC ==&lt;br /&gt;
&lt;br /&gt;
Being a geographically distributed group, we tend to hang out on IRC. One thing you may wish to consider is running an [http://quadpoint.org/articles/irssi irssi client in a screen] session on a shell host. Here&#039;s a truncated config file you can use to connect:&lt;br /&gt;
&lt;br /&gt;
 servers = (&lt;br /&gt;
  {&lt;br /&gt;
    address = &amp;quot;irc.mozilla.org&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
    port = &amp;quot;6697&amp;quot;;&lt;br /&gt;
    autoconnect = &amp;quot;yes&amp;quot;;&lt;br /&gt;
    use_ssl = &amp;quot;yes&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
  };&lt;br /&gt;
 chatnets = { type = &amp;quot;IRC&amp;quot;; }; &lt;br /&gt;
 &lt;br /&gt;
 channels = { &lt;br /&gt;
  {&lt;br /&gt;
    comment = &amp;quot;Public channel for Sync&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#sync&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
   {&lt;br /&gt;
    comment = &amp;quot;Public channel for Identity&amp;quot;;&lt;br /&gt;
    name = &amp;quot;#identity&amp;quot;;&lt;br /&gt;
    chatnet = &amp;quot;mozilla&amp;quot;;&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
== Team Meetings ==&lt;br /&gt;
&lt;br /&gt;
* Services Weekly Status: Every Tuesday at 9:15 PT in North Bridge (4th floor), [https://intranet.mozilla.org/Teleconferencing conference dial] in number is #8616. Meeting notes live under [https://wiki.mozilla.org/Services/Meetings/ Services/Meetings].&lt;br /&gt;
* [[WeeklyUpdates|Mozilla Weekly Updates]]: Every Monday at 11:00 PT in 10-Forward (you&#039;ll need to attend the first one in person since we want to show you off.)&lt;br /&gt;
* Out-of-office, PTO, and other kinds of availability is managed in a shared &amp;quot;Services Team Availability&amp;quot; calendar. See [https://intranet.mozilla.org/Calendar#Shared_Company_Calendars Shared Company Calenders] for details on how to set it up.&lt;br /&gt;
&lt;br /&gt;
= Miscellany =&lt;br /&gt;
&lt;br /&gt;
* You also want to grab a [http://nightly.mozilla.org/ Nightly] build of Firefox. Everybody in the company should be running a nightly build: it&#039;s a great way to find bugs before the code goes out to the general public. If you want to run against different profiles (which is useful for development), you will be interested in [https://developer.mozilla.org/en/Command_Line_Options two extra command flags]: &amp;quot;-P and --no-remote&amp;quot; &lt;br /&gt;
** -P forces the Profile Picker (You probably want to have more than one.)&lt;br /&gt;
** --no-remote allows multiple versions to run on one machine at the same time.&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=CloudServices/Sync/ReDash&amp;diff=1174428</id>
		<title>CloudServices/Sync/ReDash</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=CloudServices/Sync/ReDash&amp;diff=1174428"/>
		<updated>2017-06-22T17:58:22Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: failureReason was renamed to failure_reason as of https://github.com/mozilla/telemetry-batch-view/pull/205&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Table Described === &lt;br /&gt;
&lt;br /&gt;
The Sync team&#039;s telemetry goes through our data pipeline and lands in Presto to be explored in [https://sql.telemetry.mozilla.org/ Re:Dash]. Below is a description of the data available in the &#039;&#039;&#039;sync_summary&#039;&#039;&#039; table.  Further documentation on this data is available [https://github.com/mozilla/telemetry-batch-view/blob/master/docs/SyncSummary.md in the telemetry-batch-view repo], and in the [http://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/data/sync-ping.html general sync ping documentation].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Names!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| app_build_id || varchar || Firefox build ID (e.g. 20160801085519)&lt;br /&gt;
|-&lt;br /&gt;
| app_version || varchar || Firefox version (e.g. 50.0a2) - corresponds to the MOZ_APP_VERSION configure value&lt;br /&gt;
|-&lt;br /&gt;
| app_display_version || varchar || The application version as shown in the about dialog. Almost always identical to app_version. Corresponds to the  MOZ_APP_VERSION_DISPLAY configure value.&lt;br /&gt;
|-&lt;br /&gt;
| app_name || varchar || Will always be the string &amp;quot;Firefox&amp;quot; in desktop submitted pings.&lt;br /&gt;
|-&lt;br /&gt;
| app_channel || varchar || The update channel (e.g. &amp;quot;release&amp;quot;, &amp;quot;nightly&amp;quot;, etc) - corresponds to the  MOZ_UPDATE_CHANNEL config variable.&lt;br /&gt;
|-&lt;br /&gt;
| uid || varchar || Hashed Sync/FxA ID&lt;br /&gt;
|-&lt;br /&gt;
| deviceid || varchar || Hashed FxA device ID.&lt;br /&gt;
|-&lt;br /&gt;
| when || bigint || Unix timestamp of when sync occurred. Make sure to put in &amp;quot;quotes&amp;quot; since when is a reserved SQL word. Note that because this is taken from the client&#039;s clock, the time may be wildly inaccurate.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || Number of milli-seconds it took to Sync.&lt;br /&gt;
|-&lt;br /&gt;
| failure_reason || row(name varchar, value varchar) || Sync failure reason, or null if no failure.&lt;br /&gt;
|-&lt;br /&gt;
| status || row(sync varchar, service varchar) || The status of sync after completion, or null is both statuses record success.&lt;br /&gt;
|-&lt;br /&gt;
| why || varchar || Currently always null, but eventually should be the reason the sync was performed (eg, timer, button press, score update, etc)&lt;br /&gt;
|-&lt;br /&gt;
| devices || array(row(id varchar, os varchar, version varchar)) || Array of the other devices in this user&#039;s device constellation.&lt;br /&gt;
|-&lt;br /&gt;
| engines || array(engine_record) || A record of the engines that synced. Each element of the array is in the format of an [[#Engine Record|engine record]].&lt;br /&gt;
|-&lt;br /&gt;
| submission_date_s3 || varchar || The date this ping was submitted to the telemetry servers. Because a ping will typically be sent for a previous session immediately after a browser restart, this submission date may be later than the date recorded in the ping. Note also that this is a timestamp supplied by the server so is likely to be more reliable than the dates recorded in the ping itself.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Engine Record ====&lt;br /&gt;
&lt;br /&gt;
An engine record is defined as:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Name!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| name || varchar || The name of the engine.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || How many milliseconds this engine took to sync.&lt;br /&gt;
|-&lt;br /&gt;
| status || varchar || The status of this engine after sync completed, or null is the status reflects success.&lt;br /&gt;
|-&lt;br /&gt;
| failure_reason || row(name varchar, value varchar) || Details of any errors recorded during the sync of this engine, or null on success.&lt;br /&gt;
|-&lt;br /&gt;
| incoming || row(applied bigint, failed bigint, newFailed bigint, reconciled bigint) || Details of how many incoming records were applied, failed, failed for the first time in this sync, and reconciled.&lt;br /&gt;
|-&lt;br /&gt;
| outgoing || array(row(sent bigint, failed bigint))) || For each batch of records uploaded as part of a Sync, how many records were sent in that batch and how many failed.&lt;br /&gt;
|-&lt;br /&gt;
| validation || validation_record || Validation information for this engine. Null if validation cannot or did not run during this sync (common). If present, it&#039;s format is of a [[#Validation Record|validation record]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Validation Record =====&lt;br /&gt;
&lt;br /&gt;
A validation record is defined as:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Name!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| version || bigint || Version of the validator used to get this data.&lt;br /&gt;
|-&lt;br /&gt;
| checked || bigint || Number of records the validator checked in this engine.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || How long validation took for this engine.&lt;br /&gt;
|-&lt;br /&gt;
| problems || array(row(name varchar, count varchar)) || The problems identified. Problems with a count of 0 are excluded. Null on failure or if no problems occurred.&lt;br /&gt;
|-&lt;br /&gt;
| failure_reason || row(name varchar, value varchar) || Details of any errors recorded during the validation, or null if validation succeeded.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;FAQ&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1: In &#039;&#039;&#039;engines&#039;&#039;&#039;, we have &#039;&#039;&#039;status&#039;&#039;&#039; and &#039;&#039;&#039;failureReason&#039;&#039;&#039;, how are they different from the columns with the same names?&lt;br /&gt;
&lt;br /&gt;
A1: These are the exceptions and status for the engine itself, whereas the columns at the top-level of the table are for the entire sync. The error handling should be cleaned up, but in general, &#039;&#039;&#039;failureReason&#039;&#039;&#039; will be reporting bugs, whereas &amp;quot;status&amp;quot; is reporting when we explicitly decided that we couldn&#039;t apply a record.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Q2: Do we only log the &#039;&#039;&#039;engines&#039;&#039;&#039; array when we see &amp;quot;service&amp;quot;:&amp;quot;error.sync.failed_partial&amp;quot; in &#039;&#039;&#039;status&#039;&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
A2: I don&#039;t think that&#039;s true - eg, &amp;quot;select * from sync_summary where engines is not null and status is null limit 10&amp;quot; shows records.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Q3: What values are valid in the validation record&#039;s &#039;&#039;&#039;name&#039;&#039;&#039; field?&lt;br /&gt;
&lt;br /&gt;
A3: It&#039;s up to the engine and to the client. For desktop bookmarks, they&#039;re documented [https://dxr.mozilla.org/mozilla-central/source/services/sync/modules/bookmark_validator.js here] (or [https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/services/sync/modules/bookmark_validator.js#27-68 here] if that link breaks).&lt;br /&gt;
&lt;br /&gt;
=== Event Telemetry ===&lt;br /&gt;
&lt;br /&gt;
Sync will often write &amp;quot;events&amp;quot; to telemetry. These are made available via the sync_events_v1 table.&lt;br /&gt;
&lt;br /&gt;
==== Table Description ====&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Names!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| document_id || varchar || The document ID of the original ping this event is from.&lt;br /&gt;
|-&lt;br /&gt;
| app_build_id || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| app_display_version || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| app_name || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| app_version || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| app_channel || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| uid || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| why || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| deviceId || varchar || From the original ping&lt;br /&gt;
|-&lt;br /&gt;
| event_timestamp || bigint || Number of milliseconds since the process started when the event was created. (??)&lt;br /&gt;
|-&lt;br /&gt;
| event_category || varchar || Always the string &amp;quot;sync&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| event_method || varchar || The type of action taken on the object&lt;br /&gt;
|-&lt;br /&gt;
| event_object || varchar || The type of object being acted on&lt;br /&gt;
|-&lt;br /&gt;
| event_string_value || varchar || Additional data&lt;br /&gt;
|-&lt;br /&gt;
| event_map_values || map(varchar, varchar) || Additional data specific to this event.&lt;br /&gt;
|-&lt;br /&gt;
| event_flow_id || varchar || An ID used to identify a pair of commands which span multiple devices (todo: explain this!)&lt;br /&gt;
|-&lt;br /&gt;
| event_device_id || varchar || If this event is being targeted at a different sync device, this is the ID of the target.&lt;br /&gt;
|-&lt;br /&gt;
| event_device_version || varchar || If this event is being targeted at a different sync device, this is the Firefox version it is running.&lt;br /&gt;
|-&lt;br /&gt;
| event_device_os || varchar || If this event is being targeted at a different sync device, this is the OS it is running&lt;br /&gt;
|-&lt;br /&gt;
| submission_date_s3 || varchar || The date this ping was submitted.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Event Usage ====&lt;br /&gt;
&lt;br /&gt;
===== Commands sent between clients =====&lt;br /&gt;
&lt;br /&gt;
Sometimes Sync will send a &amp;quot;command&amp;quot; from one device to another. The most obvious example of this is &amp;quot;send tab&amp;quot;. Event telemetry is recorded both by the sending device and the receiving device.&lt;br /&gt;
&lt;br /&gt;
In all cases, the sending device will create a unique &amp;quot;flowID&amp;quot; which will appear in event_flow_id, and it will send this value as part of the command. The device receiving the command will record this flow ID in the event it creates - so both the sending and receiving device will record the same flowID.&lt;br /&gt;
&lt;br /&gt;
In all cases, the sending device will record in the event the ID of the device that is to receive the command. However, the receiving device does not record the device that sent the command.&lt;br /&gt;
&lt;br /&gt;
The sending device will record: event_object=&amp;quot;sendcommand&amp;quot;, event_method will be the specific command being sent (eg, &amp;quot;displayURI&amp;quot; for sendTab).&lt;br /&gt;
&lt;br /&gt;
The receiving device will record: event_object=&amp;quot;processcommand&amp;quot;, event_method will be the command being sent.&lt;br /&gt;
&lt;br /&gt;
===== Commands sent by the repair process =====&lt;br /&gt;
&lt;br /&gt;
Bookmark repair is fairly chatty when it comes to events - both the device initiating the repair and any other devices participating in the repair process record events, and they all use the same flowID - so it should be possible to reconstruct the repair process by looking for all events with the same flow ID.&lt;br /&gt;
&lt;br /&gt;
The general repair process is:&lt;br /&gt;
&lt;br /&gt;
# One device finds problems and starts a repair. It emits an event event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;started&amp;quot;.&lt;br /&gt;
# It then attempts to find other devices able to help with the repair - if it finds any, it will emit event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;request&amp;quot;, event_string_value=&amp;quot;upload&amp;quot;, and includes the device ID of the device it wants to respond - and waits.&lt;br /&gt;
# Hopefully the other device will see the repair request. If it finds any objects it can upload, it will emit an event event_object=&amp;quot;repairResponse&amp;quot;, event_method=&amp;quot;uploading&amp;quot;.&lt;br /&gt;
# Once the upload is complete, it will write an event event_object=&amp;quot;repairResponse&amp;quot;, event_method=&amp;quot;finished&amp;quot;.&lt;br /&gt;
# If the repair responder fails for some reason, it will emit event_object=&amp;quot;repairResponse&amp;quot;, event_method=&amp;quot;failed&amp;quot; or &amp;quot;aborted&amp;quot;&lt;br /&gt;
# If initial device that sent the repair request doesn&#039;t see a response from the other device it will emit event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;silent&amp;quot;. If the other device disappears completely, it will write event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;missing&amp;quot;.&lt;br /&gt;
# The initial device will then check to see if it is still missing items, and if so, attempt to find a new client. If it can, it jumps back to (2) above.&lt;br /&gt;
# The initial device will eventually run out of clients, or will find all of its IDs. At that time it will emit event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;finished&amp;quot; - or if it gives up due to some error it will emit event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;failed&amp;quot;&lt;br /&gt;
&lt;br /&gt;
whew! So in summary:&lt;br /&gt;
* every repair should emit event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;started&amp;quot; as it starts, and either event_object=&amp;quot;repair&amp;quot;, event_method=&amp;quot;finished/failed&amp;quot; as the last event.&lt;br /&gt;
* There may be any number of repairResponse events written (including zero events if there are no suitable devices). Each of these should result in a event_object=&amp;quot;repairResponse&amp;quot;, event_method=&amp;quot;finished/aborted&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Bookmark Validation Data Roll-ups ===&lt;br /&gt;
==== telemetry.sync_bmk_total_per_day ====&lt;br /&gt;
&lt;br /&gt;
This table is a roll-up of all bookmark validations (success and failures).&lt;br /&gt;
&lt;br /&gt;
This table is useful to calculate rates in conjunction with the &#039;&#039;telemetry.sync_bmk_validation_problems&#039;&#039; table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Column name !! Data format !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sync_day || integer (e.g. 20170518) || The day we ran validation on the user&lt;br /&gt;
|-&lt;br /&gt;
| total_bookmark_validations || integer || Number of times we ran bookmark validation per day. This includes successful validations.&lt;br /&gt;
|-&lt;br /&gt;
| total_validated_users || integer || Number of users we ran bookmark validation on for each day.&lt;br /&gt;
|-&lt;br /&gt;
| total_bookmarks_checked || integer || Number of bookmarks we checked for validation problems.&lt;br /&gt;
|-&lt;br /&gt;
| run_start_date || integer || Date we imported the data to Presto.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== telemetry.sync_bmk_validation_problems ====&lt;br /&gt;
This table was rolled-up using the following workbook:&lt;br /&gt;
https://gist.github.com/kitcambridge/364f56182f3e96fb3131bf38ff648609&lt;br /&gt;
&lt;br /&gt;
This table has a row for every validation problem detected during validation.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example:&#039;&#039;&#039;&lt;br /&gt;
If a user has 4 different validation problems, we will log each problem in their own row. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Logic used for format:&#039;&#039;&#039;&lt;br /&gt;
This choice was made to avoid having endless amounts of columns representing each validation problem checked (which would mostly all be null) and to avoid having to add columns as we detect new types of validation problems.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field name !! Data type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| app_build_id || varchar || Firefox build ID (e.g. 20160801085519)&lt;br /&gt;
|-&lt;br /&gt;
| app_version || varchar || Firefox version (e.g. 50.0a2) - corresponds to the MOZ_APP_VERSION configure value&lt;br /&gt;
|-&lt;br /&gt;
| app_display_version || varchar || The application version as shown in the about dialog. Almost always identical to app_version. Corresponds to the  MOZ_APP_VERSION_DISPLAY configure value.&lt;br /&gt;
|-&lt;br /&gt;
| app_name || varchar || Will always be the string &amp;quot;Firefox&amp;quot; in desktop submitted pings.&lt;br /&gt;
|-&lt;br /&gt;
| app_channel || varchar || The update channel (e.g. &amp;quot;release&amp;quot;, &amp;quot;nightly&amp;quot;, etc) - corresponds to the  MOZ_UPDATE_CHANNEL config variable.&lt;br /&gt;
|-&lt;br /&gt;
| uid || varchar || Hashed Sync/FxA ID&lt;br /&gt;
|-&lt;br /&gt;
| deviceid || varchar || Hashed FxA device ID.&lt;br /&gt;
|-&lt;br /&gt;
| submission_day || integer || Date data was added to Presto (e.g. 20170324)&lt;br /&gt;
|-&lt;br /&gt;
| sync_day || integer || Date of sync. (e.g. 20170320)&lt;br /&gt;
|-&lt;br /&gt;
| when || bigint || Unix timestamp of when sync occurred. Make sure to put in &amp;quot;quotes&amp;quot; since when is a reserved SQL word. Note that because this is taken from the client&#039;s clock, the time may be wildly inaccurate.&lt;br /&gt;
|-&lt;br /&gt;
| status || row(sync varchar, service varchar) || The status of sync after completion, or null is both statuses record success.&lt;br /&gt;
|-&lt;br /&gt;
| engine_name || varchar || Should always be &#039;&#039;&#039;bookmarks&#039;&#039;&#039; in this table.&lt;br /&gt;
|-&lt;br /&gt;
| engine_status || varchar || The status of this engine after sync completed, or null if the status reflects success.&lt;br /&gt;
|-&lt;br /&gt;
| engine_failure_reason || row(name varchar, value varchar) || Details of any errors recorded during the sync of this engine, or null on success.&lt;br /&gt;
|-&lt;br /&gt;
| engine_has_problems || true/false || engine_has_problems is always going to be true in sync_bmk_validation_problems. Used to filter results out of all_engine_validation_results&lt;br /&gt;
|-&lt;br /&gt;
| engine_validation_version || integer || Version of the validator used to get this data.&lt;br /&gt;
|-&lt;br /&gt;
| engine_validation_checked || bigint || Number of records the validator checked in this engine.&lt;br /&gt;
|-&lt;br /&gt;
| engine_validation_took || bigint || How long validation took for this engine.&lt;br /&gt;
|-&lt;br /&gt;
| engine_validation_problem_name || varchar || Name of error recorded during the validation. Will never be null since this table only includes validation problems.&lt;br /&gt;
|-&lt;br /&gt;
| engine_validation_problem_count || integer || Number of bookmarks afflicted by the problem during the validation check.&lt;br /&gt;
|-&lt;br /&gt;
| run_start_date || integer || Date added to presto. (e.g. 20170331)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Query Examples ===&lt;br /&gt;
&lt;br /&gt;
The example below demonstrates how to select data in JSON object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH errors AS (&lt;br /&gt;
  SELECT &lt;br /&gt;
  	failurereason.name AS name, &lt;br /&gt;
  	failurereason.value AS value &lt;br /&gt;
  FROM sync_summary &lt;br /&gt;
  WHERE failurereason IS NOT NULL&lt;br /&gt;
)&lt;br /&gt;
SELECT &lt;br /&gt;
	name, &lt;br /&gt;
	COUNT(value) &lt;br /&gt;
FROM errors &lt;br /&gt;
GROUP BY name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next example shows how to handle unix time stamps and how to use the Re:Dash date picker. It&#039;s important to either cast the date or to use the type constructor like below or you won&#039;t be able to use any operators on the date which is required for the date picker.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH syncs AS (&lt;br /&gt;
	SELECT&lt;br /&gt;
		/* convert date from unix timestamp */&lt;br /&gt;
		date_trunc(&#039;day&#039;, from_unixtime(&amp;quot;when&amp;quot;/1000)) AS day,&lt;br /&gt;
  		status.service AS service&lt;br /&gt;
	FROM&lt;br /&gt;
		sync_summary&lt;br /&gt;
)&lt;br /&gt;
SELECT day, status, volume&lt;br /&gt;
FROM (&lt;br /&gt;
  SELECT&lt;br /&gt;
    day,&lt;br /&gt;
    &#039;success&#039; as status,&lt;br /&gt;
    SUM(&lt;br /&gt;
      CASE &lt;br /&gt;
      WHEN service IS NULL THEN 1 &lt;br /&gt;
      ELSE 0 &lt;br /&gt;
      END&lt;br /&gt;
    ) AS volume&lt;br /&gt;
  FROM syncs&lt;br /&gt;
  GROUP BY day&lt;br /&gt;
&lt;br /&gt;
  UNION ALL&lt;br /&gt;
&lt;br /&gt;
  SELECT&lt;br /&gt;
    day,&lt;br /&gt;
    &#039;failed&#039; as status,&lt;br /&gt;
    SUM(&lt;br /&gt;
      CASE &lt;br /&gt;
      WHEN service IS NOT NULL THEN 1 &lt;br /&gt;
      ELSE 0 &lt;br /&gt;
      END&lt;br /&gt;
    ) AS volume&lt;br /&gt;
  FROM syncs&lt;br /&gt;
  GROUP BY day&lt;br /&gt;
)&lt;br /&gt;
/* date picker */&lt;br /&gt;
WHERE day &amp;gt;= timestamp &#039;{{start_date}}&#039; AND day &amp;lt;= timestamp &#039;{{end_date}}&#039;&lt;br /&gt;
&lt;br /&gt;
GROUP BY 1,2,3&lt;br /&gt;
ORDER BY 1,2,3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example is how you would unpack the engines array into it&#039;s own table to then query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH engine_errors AS (&lt;br /&gt;
  SELECT &lt;br /&gt;
  	uid, &lt;br /&gt;
  	date_trunc(&#039;day&#039;, from_unixtime(&amp;quot;when&amp;quot;/1000)) AS date,&lt;br /&gt;
  	engine&lt;br /&gt;
  FROM sync_summary&lt;br /&gt;
/* The CROSS JOIN UNNEST will join the array to each row */&lt;br /&gt;
  CROSS JOIN UNNEST(engines) AS t (engine)&lt;br /&gt;
  --LIMIT 1000000&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
SELECT &lt;br /&gt;
	engine.name AS engine_name,&lt;br /&gt;
	SUM(&lt;br /&gt;
      CASE&lt;br /&gt;
      WHEN engine.failureReason IS NOT NULL THEN 1&lt;br /&gt;
      ELSE 0&lt;br /&gt;
      END&lt;br /&gt;
    ) AS errors&lt;br /&gt;
FROM engine_errors&lt;br /&gt;
WHERE date &amp;gt;= timestamp &#039;{{start_date}}&#039; AND date &amp;lt;= timestamp &#039;{{end_date}}&#039;&lt;br /&gt;
GROUP BY engine.name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
	<entry>
		<id>https://wiki.mozilla.org/index.php?title=CloudServices/Sync/ReDash&amp;diff=1161667</id>
		<title>CloudServices/Sync/ReDash</title>
		<link rel="alternate" type="text/html" href="https://wiki.mozilla.org/index.php?title=CloudServices/Sync/ReDash&amp;diff=1161667"/>
		<updated>2017-02-01T20:21:36Z</updated>

		<summary type="html">&lt;p&gt;Tcsc: Document current data format more extensively.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Table Described === &lt;br /&gt;
&lt;br /&gt;
The Sync team&#039;s telemetry goes through our data pipeline and lands in Presto to be explored in [https://sql.telemetry.mozilla.org/ Re:Dash]. Below is a description of the data available in the &#039;&#039;&#039;sync_summary&#039;&#039;&#039; table.  Further documentation on this data is available [https://github.com/mozilla/telemetry-batch-view/blob/master/docs/SyncSummary.md in the telemetry-batch-view repo], and in the [http://gecko.readthedocs.io/en/latest/toolkit/components/telemetry/telemetry/data/sync-ping.html general sync ping documentation].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Names!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| app_build_id || varchar || Firefox build ID (e.g. 20160801085519)&lt;br /&gt;
|-&lt;br /&gt;
| app_version || varchar || Firefox version (e.g. 50.0a2) - corresponds to the MOZ_APP_VERSION configure value&lt;br /&gt;
|-&lt;br /&gt;
| app_display_version || varchar || The application version as shown in the about dialog. Almost always identical to app_version. Corresponds to the  MOZ_APP_VERSION_DISPLAY configure value.&lt;br /&gt;
|-&lt;br /&gt;
| app_name || varchar || Will always be the string &amp;quot;Firefox&amp;quot; in desktop submitted pings.&lt;br /&gt;
|-&lt;br /&gt;
| app_channel || varchar || The update channel (e.g. &amp;quot;release&amp;quot;, &amp;quot;nightly&amp;quot;, etc) - corresponds to the  MOZ_UPDATE_CHANNEL config variable.&lt;br /&gt;
|-&lt;br /&gt;
| uid || varchar || Hashed Sync/FxA ID&lt;br /&gt;
|-&lt;br /&gt;
| deviceid || varchar || Hashed FxA device ID.&lt;br /&gt;
|-&lt;br /&gt;
| when || bigint || Unix timestamp of when sync occurred. Make sure to put in &amp;quot;quotes&amp;quot; since when is a reserved SQL word. Note that because this is taken from the client&#039;s clock, the time may be wildly inaccurate.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || Number of milli-seconds it took to Sync.&lt;br /&gt;
|-&lt;br /&gt;
| failurereason || row(name varchar, value varchar) || Sync failure reason, or null if no failure.&lt;br /&gt;
|-&lt;br /&gt;
| status || row(sync varchar, service varchar) || The status of sync after completion, or null is both statuses record success.&lt;br /&gt;
|-&lt;br /&gt;
| why || varchar || Currently always null, but eventually should be the reason the sync was performed (eg, timer, button press, score update, etc)&lt;br /&gt;
|-&lt;br /&gt;
| devices || array(row(id varchar, os varchar, version varchar)) || Array of the other devices in this user&#039;s device constellation.&lt;br /&gt;
|-&lt;br /&gt;
| engines || array(engine_record) || A record of the engines that synced. Each element of the array is in the format of an [[#Engine Record|engine record]].&lt;br /&gt;
|-&lt;br /&gt;
| submission_date_s3 || varchar || The date this ping was submitted to the telemetry servers. Because a ping will typically be sent for a previous session immediately after a browser restart, this submission date may be later than the date recorded in the ping. Note also that this is a timestamp supplied by the server so is likely to be more reliable than the dates recorded in the ping itself.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Engine Record ====&lt;br /&gt;
&lt;br /&gt;
An engine record is defined as:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Name!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| name || varchar || The name of the engine.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || How many milliseconds this engine took to sync.&lt;br /&gt;
|-&lt;br /&gt;
| status || varchar || The status of this engine after sync completed, or null is the status reflects success.&lt;br /&gt;
|-&lt;br /&gt;
| failureReason || row(name varchar, value varchar) || Details of any errors recorded during the sync of this engine, or null on success.&lt;br /&gt;
|-&lt;br /&gt;
| incoming || row(applied bigint, failed bigint, newFailed bigint, reconciled bigint) || Details of how many incoming records were applied, failed, failed for the first time in this sync, and reconciled.&lt;br /&gt;
|-&lt;br /&gt;
| outgoing || array(row(sent bigint, failed bigint))) || For each batch of records uploaded as part of a Sync, how many records were sent in that batch and how many failed.&lt;br /&gt;
|-&lt;br /&gt;
| validation || validation_record || Validation information for this engine. Null if validation cannot or did not run during this sync (common). If present, it&#039;s format is of a [[#Validation Record|validation record]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===== Validation Record =====&lt;br /&gt;
&lt;br /&gt;
A validation record is defined as:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field Name!! Data Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| version || bigint || Version of the validator used to get this data.&lt;br /&gt;
|-&lt;br /&gt;
| checked || bigint || Number of records the validator checked in this engine.&lt;br /&gt;
|-&lt;br /&gt;
| took || bigint || How long validation took for this engine.&lt;br /&gt;
|-&lt;br /&gt;
| problems || array(row(name varchar, count varchar)) || The problems identified. Problems with a count of 0 are excluded. Null on failure or if no problems occurred.&lt;br /&gt;
|-&lt;br /&gt;
| failureReason || row(name varchar, value varchar) || Details of any errors recorded during the validation, or null if validation succeeded.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;big&amp;gt;&#039;&#039;&#039;FAQ&#039;&#039;&#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Q1: In &#039;&#039;&#039;engines&#039;&#039;&#039;, we have &#039;&#039;&#039;status&#039;&#039;&#039; and &#039;&#039;&#039;failureReason&#039;&#039;&#039;, how are they different from the columns with the same names?&lt;br /&gt;
&lt;br /&gt;
A1: These are the exceptions and status for the engine itself, whereas the columns at the top-level of the table are for the entire sync. The error handling should be cleaned up, but in general, &#039;&#039;&#039;failureReason&#039;&#039;&#039; will be reporting bugs, whereas &amp;quot;status&amp;quot; is reporting when we explicitly decided that we couldn&#039;t apply a record.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Q2: Do we only log the &#039;&#039;&#039;engines&#039;&#039;&#039; array when we see &amp;quot;service&amp;quot;:&amp;quot;error.sync.failed_partial&amp;quot; in &#039;&#039;&#039;status&#039;&#039;&#039;?&lt;br /&gt;
&lt;br /&gt;
A2: I don&#039;t think that&#039;s true - eg, &amp;quot;select * from sync_summary where engines is not null and status is null limit 10&amp;quot; shows records.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Q3: What values are valid in the validation record&#039;s &#039;&#039;&#039;name&#039;&#039;&#039; field?&lt;br /&gt;
&lt;br /&gt;
A3: It&#039;s up to the engine and to the client. For desktop bookmarks, they&#039;re documented [https://dxr.mozilla.org/mozilla-central/source/services/sync/modules/bookmark_validator.js here] (or [https://dxr.mozilla.org/mozilla-central/rev/1d025ac534a6333a8170a59a95a8a3673d4028ee/services/sync/modules/bookmark_validator.js#27-68 here] if that link breaks).&lt;br /&gt;
&lt;br /&gt;
=== Query Examples ===&lt;br /&gt;
&lt;br /&gt;
The example below demonstrates how to select data in JSON object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH errors AS (&lt;br /&gt;
  SELECT &lt;br /&gt;
  	failurereason.name AS name, &lt;br /&gt;
  	failurereason.value AS value &lt;br /&gt;
  FROM sync_summary &lt;br /&gt;
  WHERE failurereason IS NOT NULL&lt;br /&gt;
)&lt;br /&gt;
SELECT &lt;br /&gt;
	name, &lt;br /&gt;
	COUNT(value) &lt;br /&gt;
FROM errors &lt;br /&gt;
GROUP BY name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next example shows how to handle unix time stamps and how to use the Re:Dash date picker. It&#039;s important to either cast the date or to use the type constructor like below or you won&#039;t be able to use any operators on the date which is required for the date picker.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH syncs AS (&lt;br /&gt;
	SELECT&lt;br /&gt;
		/* convert date from unix timestamp */&lt;br /&gt;
		date_trunc(&#039;day&#039;, from_unixtime(&amp;quot;when&amp;quot;/1000)) AS day,&lt;br /&gt;
  		status.service AS service&lt;br /&gt;
	FROM&lt;br /&gt;
		sync_summary&lt;br /&gt;
)&lt;br /&gt;
SELECT day, status, volume&lt;br /&gt;
FROM (&lt;br /&gt;
  SELECT&lt;br /&gt;
    day,&lt;br /&gt;
    &#039;success&#039; as status,&lt;br /&gt;
    SUM(&lt;br /&gt;
      CASE &lt;br /&gt;
      WHEN service IS NULL THEN 1 &lt;br /&gt;
      ELSE 0 &lt;br /&gt;
      END&lt;br /&gt;
    ) AS volume&lt;br /&gt;
  FROM syncs&lt;br /&gt;
  GROUP BY day&lt;br /&gt;
&lt;br /&gt;
  UNION ALL&lt;br /&gt;
&lt;br /&gt;
  SELECT&lt;br /&gt;
    day,&lt;br /&gt;
    &#039;failed&#039; as status,&lt;br /&gt;
    SUM(&lt;br /&gt;
      CASE &lt;br /&gt;
      WHEN service IS NOT NULL THEN 1 &lt;br /&gt;
      ELSE 0 &lt;br /&gt;
      END&lt;br /&gt;
    ) AS volume&lt;br /&gt;
  FROM syncs&lt;br /&gt;
  GROUP BY day&lt;br /&gt;
)&lt;br /&gt;
/* date picker */&lt;br /&gt;
WHERE day &amp;gt;= timestamp &#039;{{start_date}}&#039; AND day &amp;lt;= timestamp &#039;{{end_date}}&#039;&lt;br /&gt;
&lt;br /&gt;
GROUP BY 1,2,3&lt;br /&gt;
ORDER BY 1,2,3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This example is how you would unpack the engines array into it&#039;s own table to then query:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WITH engine_errors AS (&lt;br /&gt;
  SELECT &lt;br /&gt;
  	uid, &lt;br /&gt;
  	date_trunc(&#039;day&#039;, from_unixtime(&amp;quot;when&amp;quot;/1000)) AS date,&lt;br /&gt;
  	engine&lt;br /&gt;
  FROM sync_summary&lt;br /&gt;
/* The CROSS JOIN UNNEST will join the array to each row */&lt;br /&gt;
  CROSS JOIN UNNEST(engines) AS t (engine)&lt;br /&gt;
  --LIMIT 1000000&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
SELECT &lt;br /&gt;
	engine.name AS engine_name,&lt;br /&gt;
	SUM(&lt;br /&gt;
      CASE&lt;br /&gt;
      WHEN engine.failureReason IS NOT NULL THEN 1&lt;br /&gt;
      ELSE 0&lt;br /&gt;
      END&lt;br /&gt;
    ) AS errors&lt;br /&gt;
FROM engine_errors&lt;br /&gt;
WHERE date &amp;gt;= timestamp &#039;{{start_date}}&#039; AND date &amp;lt;= timestamp &#039;{{end_date}}&#039;&lt;br /&gt;
GROUP BY engine.name&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tcsc</name></author>
	</entry>
</feed>