Back to Feed
article 3m read

Letting the error tracker start the install lost track of who clicked

The connect flow now begins on the tracker's own page, so the signed stamp that said who started it is gone; I traced where its jobs went, found a cleanup write that can never change anything, and noticed new connections stopped being counted.

Article DepthPractice

Flow

Where the jobs went, and the weak spot in each

My reading of the diff, not a tested list

  1. 1Who started it

    Was the signed stamp; now whoever is logged in at setup.

  2. 2Saving

    Secret, then row, then tell the tracker; a middle failure leaves a gap.

  3. 3Disconnect

    Now the tracker's uninstall message; the app shows connected until it arrives.

  4. 4Write-back

    Writes the same id it searched by, so it never changes anything.

  5. 5Connect count

    No longer sent anywhere; only disconnects are counted.

The connect button for my error-tracker integration no longer asks my server for anything. It opens the tracker's install page in a popup and waits. That flip moved a handful of jobs around, and one move left behind cleanup code that does nothing.

The stamp I gave up

In the old flow, clicking connect asked my server for a link. My server signed a small "state" value with my user and team in it and put it on the link. When the browser came back, my callback checked that stamp and checked it matched whoever was signed in. Only then did it save anything. The stamp proved the request was mine, and it was my only record of who started it.

Where the work went

Now the tracker starts the install. It sends the browser back with a code and an installation id. My callback just passes those on to a setup page. That page calls a new endpoint that needs a signed-in user and team. The endpoint trades the code for tokens using my app's secret, asks the tracker to confirm the install, stores the tokens, saves one row per team, and tells the tracker it's done. It trusts the tracker's answer about the organization, not the label in the URL.

What the session can't tell me

With no stamp, whoever is signed in at setup gets the install. The code is meant to work once, and only my server can trade it, so forging one is hard. But a session tells me who is finishing, not who started. My guess is that if I opened someone else's fresh install link while signed in, their tracker would end up tied to my team. I haven't tried it, and the tracker may stop it. A one-time token saved when the user clicks connect, or a simple "link this organization?" prompt, would close that gap.

Disconnect moved out of my app

My own disconnect endpoint is gone. The button now links to the tracker's settings, and the uninstall webhook is the only thing that switches the integration off. It deletes the tokens, clears them from the row, and marks it inactive. As far as I can tell, my dashboard still says connected until that webhook shows up.

A write-back with nothing to write back

That handler also writes the installation id onto the row. But it found the row by that same id, so it always writes back the value that's already there. A same-day sibling version had a fallback search where this line made sense. The merged version kept the line but not the search.

The connect event went missing

The "install created" webhook used to send a "connected" analytics event. It now only logs, because it can arrive before the row exists. The comments say tracking moved to setup. Setup doesn't send it. Disconnects get counted and connects don't.

Three writes, nothing holding them together

Setup stores the secret, then the row, then tells the tracker, with nothing tying them together. A failure in the middle can leave a secret with no row, or a row the tracker still calls pending.

The popup and the double run

Popup messages now go only to my own site. The close timer gets cleaned up. And the setup page runs its exchange once, since a used code fails the second time.

No tests came with this. The uninstall webhook is now the only way out of the integration, so that's where my first test goes.

Keep reading

Pick up a connected idea or branch into a nearby one.

5 paths forward