2012-10-02

r2d2b2g implementation details

Over at Mozilla Hacks, I just blogged about r2d2b2g (ratta-datta-batta-ga), an experimental prototype test environment for Firefox OS that makes it drop-dead simple to test your app in B2G Desktop.

r2d2b2g is an addon, but it bundles B2G Desktop nightly builds, which are native executables, and thus the addon is platform-specific, with packages available for Mac, Linux 32-bit, and Windows (caveat: B2G Desktop for Windows currently crashes on startup due to bug 794662 795484).

The packages are large, 50-60MB each, partly because of the executables, but mostly because they also bundle Gaia profiles, including all default apps. (It's probably worth bundling a few of these, for demonstration purposes, but we could make the packages much smaller by removing the rest.)

r2d2b2g uses the Add-on SDK as its addon framework and relies on several third-party addon modules (subprocess, menuitems) along with some Python utilities (mozdownload, mozbase) to download and unpack B2G Desktop builds. Plus Gaia, although recent work to bundle Gaia profiles with B2G Desktop builds may break that dependency.

I've demoed the project to a variety of folks over the last couple weeks, and I've received a bunch of positive feedback about it. B2G Desktop combines approachability with phoneliness and is the best existing test environment for Firefox OS. But its configuration is a challenge, and it provides no obvious affordances for installing and testing your own app. r2d2b2g shows that these problems are tractable (even if it doesn't yet solve them all) and demonstrates a promising product path.

After seeing r2d2b2g, Kevin Dangoor drafted a PRD for a Firefox OS Simulator that I'll use to guide further development. Interested in participating? Clone the code from its GitHub repository and contribute your improvements!

2012-03-07

Next/Previous Tab on Mac Consistent At Last

After blogging about the inconsistency of keyboard shortcuts for Next/Previous Tab on Mac last year, I found out that Firefox, Thunderbird, and Komodo also support Command + Option + LeftArrow|RightArrow, and Adium has a General > "Switch tabs with" pref that I can set to the same chord.

(Later, I switched IM clients from Adium to InstantBird, which also supports that combination.)

That left Terminal, which I couldn't figure out how to configure to support the same shortcut. Until now.

I'm not sure if it's because I have since upgraded to Mac OS X 10.7 (Lion). I could've sworn I tried something like this back when I wrote that previous blog post, and it didn't work.
  1. Go to System Preferences > Keyboard > Keyboard Shortcuts > Application Shortcuts.
  2. Press the + (plus) button.
  3. Select "Other..." from the Application menu and select Utilities > Terminal from the file picker dialog.
  4. Enter "Select Next Tab" (without the quotes) into the Menu Title field.
  5. Focus the Keyboard Shortcut field and press Command + Option + RightArrow to set the keyboard shortcut, which will appear as ⌥⌘→.
  6. Press the Add button.

Repeat steps 4-6 with "Select Previous Tab" and Command + Option + LeftArrow, which will appear as ⌥⌘←.

Those shortcuts should now work in Terminal.

With this change, all five of my current primary productivity applications on Mac (Firefox, Thunderbird, Instantbird, Komodo, and Terminal) support a consistent pair of keyboard shortcuts for Next/Previous Tab, which are two of the most common commands I issue in all of those apps.

Woot!

generating a fingerprint for an SSH key

After recently discovering a security vulnerability that allows an attacker to add an SSH key to a GitHub user account, GitHub is requiring all users to audit their SSH keys. Its audit page lists one's keys by type and fingerprint, but it doesn't say how it generated the fingerprint or how to generate one for your local copy of a key to compare it with. Nor does it let you see the whole key.

And since I don't generate such fingerprints very often, I didn't know how to do it. So I tried cksum, md5, and shasum on my Mac, but none of their checksums matched. Turns out the tool to use is ssh-keygen:

    ssh-keygen -l -f path/to/keyfile

2011-10-17

Mozilla Status Board Text is Markdown

It isn't documented anywhere that I can find, but Benjamin Smedberg's handy Mozilla Status Board tool parses status text as Markdown, which is how I added a Didn't header to the Done section of my status update with all the things I planned to do last week but didn't make happen. (The Done, Next, and Coordination headers are all H4s, so I prepended four hash marks to #### Didn't to make it the same size).

(Note that [Markdown-style links](http://daringfireball.net/projects/markdown/basics) don't work and cause the entire section in which they appear to remain unparsed. However angle-bracketed URLs, as recommended by RFC 3986 <http://labs.apache.org/webarch/uri/rfc/rfc3986.html#delimiting>, work when added to the ends of lines. And "bug ###" references are auto-linkified.)

2011-09-16

to all the bugs I've filed before

The first bug I filed was marked as duplicate; the second was worksforme (although Chris Petersen could reproduce it before he couldn't anymore); and the third was invalid (it was the spec, not the code, that was errant). The fourth is the first that was fixed.

2011-09-09

"Next/Previous Tab" Keyboard Shortcuts on Windows

On my Windows laptop, I use the following four programs with tabbed interfaces on a regular basis:
  • Firefox
  • Thunderbird
  • Instantbird
  • Komodo IDE
(I'd love to have tabs in my Windows terminal app of choice, Mintty, but its developer thinks tabs should be implemented at the window manager level.)

Unlike on my Mac, all those programs implement the same keyboard shortcut for switching to the previous/next tab, and it's a simple one with just a two-key chord: Control + PageUp / PageDown.

Ha!

2011-09-08

"Next/Previous Tab" Keyboard Shortcuts on Mac

On my Mac, I use the following five programs with tabbed interfaces on a regular basis:
  • Firefox
  • Thunderbird
  • Adium
  • Terminal
  • Komodo IDE

And those programs implement the following five different keyboard shortcuts for switching to the previous/next tab:
  • Control + PageUp / PageDown (Firefox, Thunderbird)
  • Command + LeftArrow / RightArrow (Adium)
  • Command + PageUp / PageDown (Komodo IDE)
  • Command + Shift + [ / ] (Terminal)
  • Command + Shift + LeftArrow / RightArrow (Terminal)
Hrm.

2011-09-07

gitflow vs. the SDK

gitflow is a model for developing and shipping software using Git. Add-on SDK uses Git, and it too has a model, which is similar to gitflow in some ways and different in others. Here's a comparison of the two and some thoughts on why they vary.

First, some similarities: both models use multiple branches, including an ongoing branch for general development and another ongoing branch that is always ready for release (their names vary, but that's a trivial difference). Both also permit development on temporary feature (topic) branches and utilize a branch for stabilization of the codebase leading up to a release. And both accommodate the occasional hotfix release in similar ways.

(Aside: gitflow appears to encourage feature branches, but I tend to agree with Martin Fowler through Paul Julius that continuously integrating with a central development branch is preferable.)

Second, some differences: the SDK uses a single ongoing stabilization branch, while gitflow uses multiple short-lived stabilization branches, one per release. And in the SDK, stabilization fixes land on the development branch and then get cherry-picked to the stabilization branch; whereas in gitflow, stabilization fixes land on the stabilization branch and then get merged to the development branch.

(Also, the SDK releases on a regular time/quality-driven "train" schedule similar to Firefox's, while gitflow may anticipate an irregular feature/quality-driven release schedule, although it can be applied to projects with train schedules, like BrowserID.)

A benefit of gitflow's approach to stabilization is that its change graph includes only distinct changes, whereas cherry-picking adds duplicate, semi-associated changes to the SDK's graph. However, a downside of gitflow's approach is that developers must attend to where they land changes, whereas SDK developers always land changes on its development branch, and its release manager takes on the chore of getting those changes onto the stabilization branch.

(It isn't clear what happens in gitflow if a change lands on the development branch while a release is being stabilized and afterward is identified as being wanted for the release. Perhaps it gets cherry-picked?)

Overall, these models seem fairly similar, and it wouldn't be too hard to make the SDK's be essentially gitflow. We would just need to stipulate that developers land stabilization fixes on the stabilization branch, and the release manager's job would then be to merge that branch back to the development branch periodically instead of cherry-picking in the other direction.

However, it isn't clear to me that such a change would be preferable. What do you think?

2011-08-21

Administer Git? Get a job!

As I mentioned recently, Git (on GitHub) has become a popular VCS for Mozilla-related projects.

GitHub is a fantastic tool for collaboration, and the site does a great job running a Git server, but given the importance of the VCS, and because Mozilla's automated test machines don't have access to servers outside the Mozilla firewall, Mozilla should run its own Git server (that syncs with GitHub, so developers can continue to use that site for collaboration).

Unfortunately, the organization doesn't have a great deal of in-house Git server administration experience, but we're hiring systems administrators, so if you grok Git hosting and meet the other requirements, send in your resume!

2011-08-11

Why the Add-on SDK Doesn't "Land in mozilla-central"

Various Mozillians sometimes suggest that the Add-on SDK should "land in mozilla-central" and wonder why it doesn't. Here's why.


The Add-on SDK depends on features of Firefox (and Gecko), and the SDK's development process synchronizes its release schedule with Firefox's. Nevertheless, the SDK isn't a component of Firefox, it's a distinct product with its own codebase, development process, and release schedule.

Mozilla makes multiple products that interact with Firefox (addons.mozilla.org, a.k.a. AMO, is another), and distinct product development efforts should generally utilize separate code repositories, to avoid contention between the projects regarding tree management, the stages of the software development lifecycle (i.e. when which branch is in alpha, beta, etc.), and the schedules for merging between branches.

There can be exceptions to that principle, for products that share a bunch of code, use the same development process, and have the same release schedule (cf. the Firefoxes for desktop and mobile). But the SDK is not one of those exceptions.


It shares no code with Firefox. Its process utilizes one fewer branch and six fewer weeks of development than the Firefox development process, to minimize the burden of branch management and stabilization build testing on its much smaller development team and testing community. And it merges its branches and ships its releases two weeks before Firefox, to give AMO and addon developers time to update addons for each new version of the browser.

Living in its own repository makes it possible for the SDK to have these differences in its process, and it also makes it possible for us to change the process in the future, for example to move up the branch/release dates one week, if we discover that AMO and addon developers would benefit from three weeks of lead time; or to ship twice as frequently, if we determine that doing so would get APIs for new Firefox features into developers' hands faster.

Finally, the Jetpack project has a vibrant community of contributors (including both organization staff and volunteers) who strongly prefer contributing via Git and GitHub, because they find it easier, more efficient, and more enjoyable, and for whom working in mozilla-central would mean taking too great a hit on their productivity, passion, and participation.

Mozilla Labs innovates not only on features and user experience but also on development process and tools, and while Jetpack didn't lead the way to GitHub, we were a fast follower once early experiments validated its benefits. And our experience since then has only confirmed our decision, as GitHub has proven to be a fantastic tool for branch management, code review/integration, and other software development tasks.

Other Mozillians agree: there are now almost two hundred members and over one hundred repositories (not counting forks) in the Mozilla organization on GitHub, with major initiatives like Open Web Apps and BrowserID being hosted there, not to mention all the Mozilla projects in user repositories, including Rust and Zamboni.


Even if we don't make mozilla-central the canonical repository for SDK development, however, we could still periodically drop a copy of the SDK source against which Firefox changes should be tested into mozilla-central. And doing so would theoretically make it easier for Firefox developers to run SDK tests when they discover that a Firefox change breaks the SDK, because they wouldn't have to get the SDK first.

But the benefit to Firefox developers is minimal. Currently, we periodically drop a reference to the SDK revision against which Firefox changes should be tested, and developers have to do the following to initiate testing:

  wget -i testing/jetpack/jetpack-location.txt -O addon-sdk.tar.bz2
  tar xjf addon-sdk.tar.bz2
  cd addon-sdk-[revision]
  source bin/activate
  cfx testall --binary path/to/Firefox/build

We can simplify this to:

  testing/jetpack/clone
  cd addon-sdk
  source bin/activate
  cfx testall --binary path/to/Firefox/build

Whereas if we dropped the source instead of just a reference to it, it would instead be the only slightly simpler:

  cd testing/jetpack/addon-sdk
  source bin/activate
  cfx testall --binary path/to/Firefox/build

Either of which can be abstracted to a single make target.

But if we were to drop source instead of a reference thereto, the drops would be larger and riskier changes. And test automation would still need to be updated to support Git (or at least continue to use brittle Git -> Mercurial mirroring), in order to run tests on SDK changes, which periodic source drops do not address.


Now, this doesn't mean that no SDK code will ever land in mozilla-central.

Various folks have discussed integrating parts of the SDK into core Firefoxincluding stable API implementations, the module loader, and possibly the bootstrapperto reduce the size of addon packages, improve addon startup times, and decrease addon memory consumption. I have written a very preliminary draft of a feature page describing this work, although I do not think it is a high priority at the moment, relative to the other priorities identified in the Jetpack roadmap.

And Dietrich Ayala recently suggested integrating the SDK into core Firefox for use by core features, by which he presumably also means the API implementations/module loader/bootstrapper rather than the command-line tool for testing and packaging addons.

Nevertheless, I am (and, I suspect, the whole Jetpack team is) even open to discussing integration of the command-line tool (or its replacement by a graphical equivalent), merging together the two products, and erasing the distinction between them, just as Firefox ships with core features for web development.  We've even drafted a feature page for converting the SDK into an addon, which is a big step in that direction.

But until that happens, farther on up the road, the SDK is its own product that we develop with its own process and ship on its own schedule. And it has good reason to live in its own repository, and a Git one at that, as do the many (and growing number of) other Mozilla projects using similar processes and tools, which our community-wide development, collaboration, and testing infrastructure must evolve to accommodate.