Smaller than it was

On 27 September the gym's movement library lost 4,724 lines and gained one field. What came out was a theory of how movements relate. What replaced it was a trainer writing the relation down.

3 min readMicroGym · Library stage

Every other part of the platform reads the library. A workout is a list of movements from it, a session runs those movements against the members in the room, and the assessment engine decides which members should do something else. So the library is less a list than a vocabulary, and on this platform the vocabulary had grown a theory. Each movement belonged to a body area and a set of target areas, each gym could define its own of both, and a table of suggested substitutions said what to do instead of each movement. Around them sat a service meant to infer the rest: read a member's assessment, work out what they should not do, and propose what they should.

What came out

On 27 September 2026 one commit removed body areas, target areas, the substitution editor, the links between movements and assessments, and the screens that managed them: 4,724 lines out, 142 in. What went in was one table and one column. Each gym gets a list of movement patterns, seeded with eight (squat, hinge, push, pull, lunge, carry, rotation, mobility), and a movement may name one. The migration is additive. The old columns stay and nothing reads them, so undoing the change means putting screens back, not recovering data.

Why one field was enough

Body areas existed to answer a question the platform had stopped asking: given that this member has a sore shoulder, which movements are like this one? By September the answer lived somewhere else. A trainer attaches a rule to a movement: when a member answers this assessment question this way, swap to that movement, or keep the movement and use a named variation. The rule is written by the person who knows the member and the gym, on the movement's own form, and it is applied when a session's roster is built. Production holds 32 of them. Once the swap was a sentence a trainer wrote, the taxonomy that was meant to let software infer it had no job left except labelling, and a label needs one field. Of the 80 movements in production, 55 have no pattern yet, and nothing depends on it.

What the cut missed

The commit deleted the screens and hooks. It did not delete the service underneath them. The last 901 of its 1,541 lines hold eight exported functions that nothing outside the file calls. Seven never were: they arrived on 29 June 2025 in a commit called New assessment system wip and stayed when the system went another way. The eighth fed a member's strength tab until 24 July 2026, when point-in-time assessments were replaced. One of the seven is the fallback for a movement with no written substitution: if the member's level is one or two, offer three easier alternatives. The query behind it takes any three movements from the gym other than the original, in no order, with nothing that measures easier. It never ran, which is the only good thing about it.

The old substitution table is in the same state. It holds 36 rows. Since September no screen can add one. The only code that still writes to it copies rows when a movement is duplicated, and the only code that reads it is either unreachable or a log line before a delete.

Why it belongs on this page

Dead code is not harmless because it does not run. It is a description of the system that nobody checks. The next person to open that file, or the next model asked how substitutions work, reads a fallback that hands a beginner three random movements, and nothing in the file says it is fiction. The September commit was right about what to remove, and it stopped at the edge of what the screens could show. What remains is a deletion of about nine hundred lines and one table, and it is written down.

More notes
  • The webhook that credits twiceA payment processor delivers every result at least once. The interesting engineering is in what happens when your side fails halfway through.
  • A ledger you can edit from a route handler is not a ledgerWhy every movement of value on the payments platform goes through a Postgres function, and what it costs to keep it that way.
  • Four rows that were not theirsHardening multi-tenant row-level security in four reversible phases, verified by impersonating a member and counting what they could see.
  • The bug inside the fixA payout race, the fix for it, the bug inside that fix, and why it is the best argument I have for one person owning the whole path.
  • The sale that arrives with no referrerA creator shares a link on Instagram, the buyer taps it, installs the app and purchases. Nothing in that chain carries the creator's name across. Here is what does.
  • The minimum that belongs to someone elseHeld commissions are released to creators once a brand's payout minimum is met. Group the money by creator, the obvious way, and one brand's minimum ends up holding another brand's money.
  • The commission that must not mint twiceA buyer pays and the platform owes a creator a commission. Between those two facts sit a colluding pair, a call that arrives twice, and a cart with three items on one payment.
  • The rule that has to be written twiceFirestore security rules do not cascade to subcollections. Forget that in one place and a single query returns every private message on the platform.
  • Thirty days in the ledgerSplitting a payment at charge time is simpler and wrong: a refund after the creator is paid is a clawback nobody enjoys. Holding the money creates a different set of problems, and each piece of machinery around the hold answers one of them.
  • Arbitrary but consistentA gym's assessment answers become rules that swap an exercise for a member before a session. Two rules can disagree about the same movement. The code says who wins, and the comment admits how.
  • The number that ducked every thresholdA deposit arrives from a browser carrying two numbers. The platform scored one of them and charged the other, and every limit it had was measuring the wrong figure.
  • The second one tells you the shapeHigh-risk merchants get dropped by processors, so the platform cannot be welded to one. The interface that makes a processor swappable could not be designed before the second one existed.
  • A key you did not makeA device fingerprint is a hash the browser computes and the server has to take on faith. The useful question is not whether to trust it, but what a server does once it accepts that it cannot.
  • The template never learns your nameA trainer builds a workout once and runs it for a room of people who are not the same. The data model that survived is three tables with a one-way street between them, and the model it replaced was the obvious one.
  • The copy that heals itselfA marketplace that sells a brand's products keeps a copy of the brand's store. The same codebase keeps that copy two different ways, and the slower one is the one that is right by morning.
  • The ledger was rightA team sale splits one commission between two people. The split was recorded correctly everywhere a person could look, and the code that sent the money would have paid the wrong one.
  • Zero was not a ceilingA creator can write their own commission rate, so the server caps it at what the brand agreed to. For most of the catalogue the cap never ran, because those products carried no commission of their own.
  • The toast that could not fireA trainer taps Mark All and the whole room's round is recorded. From October 2025, if every one of those saves failed, the app said nothing, because a failed save and a deliberate skip had become the same value.
  • The ceiling is a thousand rowsA comment beside the member totals names their ceiling: tens of thousands of sets, and then it gets slow. The query under it has no range, and the API it calls stops at a thousand rows without saying so.
  • Spent, but not on anythingEvery deposit required a texted code, and each code could be spent once. Nothing recorded which deposit spent it, so the dispute packet that cited those codes was counting texts, not approvals. Now each spent code carries the checkout it approved.
  • No exceptions notedThe platform could generate a certificate of its own controls for underwriters, and every result in it was the same fixed string. Re-reading it for this page found that. It now counts what the guard actually decided.