Build1 distinct publisher3 min readUpdated
An auth package author wrote 238 tests against code he had already reviewed line by line. The bugs that mattered only appeared when tests ran the real dependency chain.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
The author of the TypeScript package Beaver-Auth says he had put every module through multiple rounds of deliberate review before he wrote any tests, covering enumeration protection, hashed tokens, refresh rotation and TOTP replay defense [1]. Then 238 tests against the actual code turned up real bugs, and the two he documents in detail surfaced only because a test exercised the real dependency chain instead of a hand-built mock of his own logic [3][5].
The mechanism he describes is the useful part, because it is a claim you can check against your own repository. Passing tests prove only that the code does what the tests expect; if the tests were written from the same mental model as the code, both agree on the same wrong assumption and the suite happily certifies a bug as correct behaviour [4]. More assertions do not move that. Different inputs do.
The dispatcher bug is the clean case. Beaver-Auth defines a TaskDispatcher interface whose dispatch method takes taskName, payload, handler, and an optional onFailure [6]. The default implementation had drifted to a three-parameter version with payload missing entirely [7]. Callers still passed four arguments in the interface's order, so the payload object landed in the handler slot, the real handler function landed in onFailure's slot, and the real onFailure was silently dropped [8]. Calling handler() then throws TypeError: handler is not a function on every dispatch, in every deployment using the default dispatcher, which is the zero-config default [9]. That means every verification email and every password reset email [10].
According to the author, tsc --noEmit reported zero errors and no warnings, because TypeScript checks method parameters bivariantly by default and a parameter typed unknown structurally accepts anything [11]. A compiling signature was not evidence that the shapes agreed at the call site. The correction was one line, plus a regression test that runs the path through the real dispatcher rather than a test double [12].
The second bug is a reachability failure. LoginEngine exposed logoutJwtSession(familyId), which revokes a refresh-token family, and it was well tested in isolation [13]. But no public API path ever returned a familyId to a caller: login returned a status, the user, an accessToken and a refreshToken [14]. The feature was fully implemented and completely unreachable [15]. A unit test cannot find this, because writing one means handing the function a familyId you already have, which is precisely what a real consumer cannot do [16]. An integration test that role-played a consumer, logging in and then trying to log out with only what the login response provided, hit the gap on the first run [17]. The fix threads familyId through the LoginResult type [18].
One caution about the source itself: its headline says 238 tests found 4 real bugs, while the body of the same post says 8 [2][3]. Those cannot both be right [19], so treat the count as unverified. The two defects described in detail do not depend on it.
Worth watching in your own code: whether any test in the suite is constructed from a value the public API never hands out, and whether the zero-config default path, the one most users will run, is covered by a test that touches the real implementation rather than a double [9][12].
Follow any of these and your For You feed starts watching them — no settings page required.
Ranked by verification strength, evidence, and original report placement.
Before writing tests for Beaver-Auth, the author had put every module through multiple rounds of deliberate review, covering enumeration protection, hashed tokens, refresh rotation and TOTP replay defense.
Passing tests only tell you the code does what the tests expect; if the tests were written from the same mental model as the code, they will confirm a bug as correct behavior because code and test share the same wrong assumption.
The fix was not writing more tests but testing against the real, integrated system rather than a hand-built mock of the author's own logic or modules isolated from what calls them; several bugs surfaced only because a test exercised the real dependency chain.
The TaskDispatcher interface declares dispatch(taskName: string, payload: unknown, handler: () => Promise<void>, onFailure?: (error: unknown) => Promise<void> | void): Promise<void>.
The default TaskDispatcher implementation had drifted to a signature missing the payload parameter entirely: dispatch(taskName, handler, onFailure?).
Every caller still invoked dispatch with all four arguments matching the interface shape, so positionally the payload object landed in the handler slot, the real handler landed in onFailure's slot, and the real onFailure was silently dropped.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Detailed but self-reported and unverified
The post supplies unusually specific, checkable technical detail: two contrasting dispatch signatures, the positional argument misalignment, the exact TypeError, the TypeScript bivariance-plus-unknown explanation, and the login result shape lacking familyId. All of it, however, comes from one self-published author writing about his own package, with no repository link, commit, diff, CI output, issue tracker or independent reproduction, and the post contradicts itself on how many bugs were found.
No adoption data supplied
Nothing in the supplied material reports releases, versions, downloads, dependents, stars, deployments or any third-party use of Beaver-Auth, and the claimed 'every deployment' impact is an inference about the default configuration rather than an observed installed base. No adoption observation can be grounded.
Severity framing runs ahead of the record
The engineering lessons are stated soberly and the fixes are modest, which keeps the gap small. It is positive rather than zero because absolute severity language — 'literally every dispatch, in every deployment', 'silently, forever' — is asserted without any deployment or incident evidence, and because the headline and body disagree on the bug count, so the topline number is unreliable in one direction or the other.
Author writes about his own package
The post is a first-person account by the author of Beaver-Auth, self-published on dev.to, describing bugs he found and fixed in his own code. That structure creates dual incentives — visibility for the package and credibility for the author's engineering rigor — while also giving him sole control over which defects, counts and severities are disclosed. No third-party editing, review or disclosure obligation is evident in the supplied material.
Single self-reported source, one internal contradiction
Confidence is limited by structure, not by implausibility: one publisher, one author, no corroboration, no linked code, and a bug count that the post itself states two different ways. The mechanisms described are coherent and consistent with known TypeScript behaviour, which keeps this above the floor, but the specific defects, severities and fixes cannot be checked from the supplied material.
build
Allow-list the closed set, block-list the open one: 193 thin geo pages, one gate1 distinct publisher
build
A GAN beauty filter is a device budget allocation, not a feature toggle1 distinct publisher
build
A cleanup commit deleted the sanitizer. Five days later a scanner cashed it in.1 distinct publisher
build
Your inference bill is an architecture defect: declare the task before you call the model1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 18, 2026