Vest: an account's name ends in the number the Vest app shows

Vest's app shows attempt_index + 1 ("Account 73"), padded below 10
("Account 01"); the name ended in attempt_index, one lower, so the
dashboard's V50K-E-D3-T10-73 was Vest's Account 74. It now ends in the
app's number, and 0 for an account Vest gives no attempt index (its
"Legacy Account"). Account types match on the prefix, and everything saved
locally is keyed by account id, so nothing else moves.

Reports mark a Vest firm vestAppNumbers. The master (634d52f) renames what
it saved under the old numbers on the first such report from a person, and
from then on leaves out a Vest firm reported under the old ones.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Li
2026-10-30 10:07:21 -05:00
co-authored by Claude Opus 5.5
parent 8a5b2a64e7
commit 8c863bdc1d
6 changed files with 59 additions and 18 deletions
+1 -1
View File
@@ -462,7 +462,7 @@ test("a passed evaluation doesn't hold the sync, and its funded account is asked
await client.requestSync();
assert.deepEqual(client.activatable(), []);
answer({ data: { account: funded } });
assert.deepEqual(await asking, { funded: 'V50K-F-D3-81' });
assert.deepEqual(await asking, { funded: 'V50K-F-D3-82' }); // attempt_index 81 = Account 82
assert.deepEqual(sent, [{ account: 'acc-2', body: { eval_account_id: 'acc-2' } }]);
// Answered: never asked again, while Vest's list is slow to move it
+22 -7
View File
@@ -11,7 +11,7 @@ import { test } from 'node:test';
import assert from 'node:assert/strict';
import {
isVestWalletAddress, vestAccountId, num, toMs, formatDecimal, vestDayOf, lastVestResetMs, parseCapitalAccount,
vestAccountName, parsePosition, awaitingLegs, parseOpenOrder, unrealizedPnl, parseTxn, bookTxns, txnKind, VEST_TXN,
vestAccountName, vestAccountNumber, parsePosition, awaitingLegs, parseOpenOrder, unrealizedPnl, parseTxn, bookTxns, txnKind, VEST_TXN,
hourlyVolatility, marketOpen, MIN_HOURLY_RETURNS, nextVestResetMs, resetSafeStop, parseHistoryPosition, jwtClaimStrings,
accountScopedToken, VestApiError, VestNotSentError, nothingWentIn, tokenForRequest, claimWithdrawal, settleClaims,
claimFundRows, readClaims, payoutDaysOf, payoutsSince, longClosure, unknownOpenFill, awaitingActivation, vestStatusName,
@@ -98,10 +98,11 @@ test('capital accounts parse, and are named for their rules', () => {
assert.equal(a.dailyLossFloor, 48500);
assert.equal(a.maxDailyLossPct, 0.03);
assert.equal(a.dailyResetAt, 1793035043842);
assert.equal(vestAccountName(a), 'V50K-E-D3-T10-34');
// attempt_index 34 is what the Vest app shows as Account 35.
assert.equal(vestAccountName(a), 'V50K-E-D3-T10-35');
assert.equal(vestAccountName(parseCapitalAccount({ ...evalAccount, stage: 2 })), 'V50K-F-D3-34');
assert.equal(vestAccountName(parseCapitalAccount({ ...evalAccount, max_daily_loss_pct: '0' })), 'V50K-E-D0-T10-34');
assert.equal(vestAccountName(parseCapitalAccount({ ...evalAccount, stage: 2 })), 'V50K-F-D3-35');
assert.equal(vestAccountName(parseCapitalAccount({ ...evalAccount, max_daily_loss_pct: '0' })), 'V50K-E-D0-T10-35');
assert.equal(vestAccountName(parseCapitalAccount({
...evalAccount, initial_capital: '5000.00000000', attempt_index: 12, stage: 2, steps_total: 2,
stages: [
@@ -109,18 +110,32 @@ test('capital accounts parse, and are named for their rules', () => {
{ ordinal: 2, kind: 'eval', profit_target: '250.00000000' },
{ ordinal: 3, kind: 'funded', profit_target: '' },
],
})), 'V5K-E-D3-T5-12');
})), 'V5K-E-D3-T5-13');
assert.equal(vestAccountName(parseCapitalAccount({
...evalAccount, plan_product_type: 'instant_funded', initial_capital: '25000.00000000', max_daily_loss_pct: '0', attempt_index: 7,
stages: [{ ordinal: 1, kind: 'funded', profit_target: '' }],
})), 'V25K-I-7');
})), 'V25K-I-08');
assert.equal(vestAccountName(parseCapitalAccount({
...evalAccount, plan_product_type: 'instant_funded', initial_capital: '500.00000000', attempt_index: 1,
stages: [{ ordinal: 1, kind: 'funded', profit_target: '' }],
})), 'V500-I-1');
})), 'V500-I-02');
assert.equal(parseCapitalAccount({ nope: true }), null);
});
test('an account is numbered as the Vest app numbers it', () => {
// The app: `Account ${attempt_index < 9 ? '0' : ''}${attempt_index + 1}`,
// and "Legacy Account" without an attempt index.
const numbered = (attempt) => vestAccountNumber(parseCapitalAccount({ ...evalAccount, attempt_index: attempt }));
assert.equal(numbered(0), '01');
assert.equal(numbered(8), '09');
assert.equal(numbered(9), '10');
assert.equal(numbered(72), '73');
assert.equal(numbered(-1), '0');
const { attempt_index: _, ...legacy } = evalAccount;
assert.equal(vestAccountNumber(parseCapitalAccount(legacy)), '0');
assert.equal(vestAccountName(parseCapitalAccount({ ...evalAccount, attempt_index: 72 })), 'V50K-E-D3-T10-73');
});
test('a passed evaluation waits on its funded account, as the Vest app decides', () => {
const passed = { ...evalAccount, status: VEST_STATUS.GOAL_PASSED };
const a = parseCapitalAccount(passed);