Skip to content

Commit 49499e3

Browse files
committed
test: pin three-pass dedup convergence chain
Review follow-up: the original replay only needed two shrinking passes; this chain exercises one merge per matching tier (email, then refresh, then unique-id) so the fixpoint loop is pinned as a real loop rather than a hardcoded second pass. https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB
1 parent ba1a1b8 commit 49499e3

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

test/property/account-identity.property.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,35 @@ describe("deduplicateAccounts properties", () => {
222222
expect(deduplicated).toStrictEqual([relogin]);
223223
});
224224

225+
// Longer chain needing three shrinking passes, one per matching tier: the
226+
// super record first absorbs the email-only record (email tier), the
227+
// replacement then matches the refresh-only record (refresh tier), and
228+
// that replacement finally matches the emailless accountId record
229+
// (unique-id tier). Pins that the fixpoint loop is a real loop, not a
230+
// hardcoded second pass.
231+
it("converges across chains that need more than two passes", () => {
232+
const idOnly = {
233+
accountId: "acc-1",
234+
refreshToken: "rt-9",
235+
lastUsed: 1_000,
236+
};
237+
const refreshOnly = { refreshToken: "rt-1", lastUsed: 2_000 };
238+
const emailOnly = { email: "carol@example.com", lastUsed: 3_000 };
239+
const superRecord = {
240+
accountId: "acc-1",
241+
email: "carol@example.com",
242+
refreshToken: "rt-1",
243+
lastUsed: 4_000,
244+
};
245+
const deduplicated = deduplicateAccounts([
246+
idOnly,
247+
refreshOnly,
248+
emailOnly,
249+
superRecord,
250+
]);
251+
expect(deduplicated).toStrictEqual([superRecord]);
252+
});
253+
225254
it("returns a subset of the input accounts and is idempotent", () => {
226255
fc.assert(
227256
fc.property(arbPoolWithPermutation, ({ pool }) => {

0 commit comments

Comments
 (0)