@prohost/cli 0.10.3 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/usage/scanner.d.ts +2 -0
- package/dist/usage/scanner.js +4 -0
- package/dist/usage/service.js +7 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ Versions follow [semver](https://semver.org/). Publishing is automated: merging
|
|
|
4
4
|
a version bump to `main` triggers `.github/workflows/npm-publish-cli.yml`, which
|
|
5
5
|
builds via `prepack`, runs the suite, publishes, and tags `cli-v<version>`.
|
|
6
6
|
|
|
7
|
+
## 0.10.4
|
|
8
|
+
|
|
9
|
+
- **A day's rebuilt totals wait for its 0.10.1 rows to land.** If the server
|
|
10
|
+
takes the rows 0.10.1 never uploaded only in part (a throttle, or a partial
|
|
11
|
+
acceptance), the rebuilt rows for that (day, login) are held back until those
|
|
12
|
+
rows are accepted or permanently skipped. Sending the rebuild first could let
|
|
13
|
+
the stale rows, retried on a later tick, overwrite the right total.
|
|
14
|
+
|
|
7
15
|
## 0.10.3
|
|
8
16
|
|
|
9
17
|
Two fixes to the 0.10.2 repository attribution.
|
package/dist/usage/scanner.d.ts
CHANGED
|
@@ -147,6 +147,8 @@ export declare function scanUsage(accounts: ScanAccount[], state: ScanState, opt
|
|
|
147
147
|
export declare function rowsForDays(state: ScanState, days: Iterable<string>): TokenRow[];
|
|
148
148
|
/** The version-1 rows not yet uploaded ({@link ScanState.legacyUnsent}), in upload shape. */
|
|
149
149
|
export declare function legacyUnsentRows(state: ScanState): TokenRow[];
|
|
150
|
+
/** The day/account pairs ({@link pendingKey}) that still have version-1 rows to upload, zero-token ones aside. */
|
|
151
|
+
export declare function legacyUnsentPairs(state: ScanState): Set<string>;
|
|
150
152
|
/** The rows for the given `day|accountKey` pairs, in upload shape. */
|
|
151
153
|
export declare function rowsForPending(state: ScanState, pairs: Iterable<string>): TokenRow[];
|
|
152
154
|
/** One `POST /v1/usage/token-totals` body's rows, and what it says about each (day, account) pair. */
|
package/dist/usage/scanner.js
CHANGED
|
@@ -495,6 +495,10 @@ export function rowsForDays(state, days) {
|
|
|
495
495
|
export function legacyUnsentRows(state) {
|
|
496
496
|
return bucketRows(state.legacyUnsent, () => true);
|
|
497
497
|
}
|
|
498
|
+
/** The day/account pairs ({@link pendingKey}) that still have version-1 rows to upload, zero-token ones aside. */
|
|
499
|
+
export function legacyUnsentPairs(state) {
|
|
500
|
+
return new Set(legacyUnsentRows(state).map((r) => pendingKey(r.day, r.accountKey)));
|
|
501
|
+
}
|
|
498
502
|
function bucketRows(buckets, include) {
|
|
499
503
|
const rows = [];
|
|
500
504
|
for (const [key, totals] of Object.entries(buckets)) {
|
package/dist/usage/service.js
CHANGED
|
@@ -17,7 +17,7 @@ import { Backoff } from './backoff.js';
|
|
|
17
17
|
import { resolveUsageKey, usageStateDir, writePrivateFile } from './config.js';
|
|
18
18
|
import { accountConfigDir } from './discovery.js';
|
|
19
19
|
import { buildReportFrame, defaultProber, probeAccounts } from './quota.js';
|
|
20
|
-
import { loadScanState, pendingAccount, pendingDay, legacyUnsentRows, pendingKey, rebuildFellShort, rowsForPending, saveScanState, scanUsage, uploadBatches, } from './scanner.js';
|
|
20
|
+
import { loadScanState, pendingAccount, pendingDay, legacyUnsentPairs, legacyUnsentRows, pendingKey, rebuildFellShort, rowsForPending, saveScanState, scanUsage, uploadBatches, } from './scanner.js';
|
|
21
21
|
export const REPORTS_PATH = '/v1/usage/reports';
|
|
22
22
|
export const TOKEN_TOTALS_PATH = '/v1/usage/token-totals';
|
|
23
23
|
/** Tick cadence. */
|
|
@@ -257,6 +257,12 @@ export class UsageService {
|
|
|
257
257
|
saveScanState(scanStatePath(this.env), scan);
|
|
258
258
|
return 0;
|
|
259
259
|
}
|
|
260
|
+
// A pair whose version-1 rows are still pending (throttled, partly accepted, or waiting for a
|
|
261
|
+
// report) holds its rebuilt rows back: sent now, they could be overwritten by those stale rows
|
|
262
|
+
// landing on a later tick. They stay dirty and go once the legacy rows settle.
|
|
263
|
+
const heldByLegacy = legacyUnsentPairs(scan);
|
|
264
|
+
if (heldByLegacy.size > 0)
|
|
265
|
+
ready = ready.filter((r) => !heldByLegacy.has(pendingKey(r.day, r.accountKey)));
|
|
260
266
|
const legacyReady = new Set(ready.map((r) => pendingKey(r.day, r.accountKey)).filter((pair) => scan.legacy[pair] !== undefined));
|
|
261
267
|
if (legacyReady.size > 0) {
|
|
262
268
|
if (!(await this.serverReplacesDays(api, machineId, machine))) {
|
package/dist/version.d.ts
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `package.json`, so a release bump that forgets this file fails the suite
|
|
8
8
|
* instead of shipping a `User-Agent` that lies about which build is calling.
|
|
9
9
|
*/
|
|
10
|
-
export declare const CLI_VERSION = "0.10.
|
|
10
|
+
export declare const CLI_VERSION = "0.10.4";
|
|
11
11
|
/** Sent on every HTTP request the CLI makes back into ProhostAI. */
|
|
12
|
-
export declare const USER_AGENT = "prohost-cli/0.10.
|
|
12
|
+
export declare const USER_AGENT = "prohost-cli/0.10.4";
|
package/dist/version.js
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
* `package.json`, so a release bump that forgets this file fails the suite
|
|
8
8
|
* instead of shipping a `User-Agent` that lies about which build is calling.
|
|
9
9
|
*/
|
|
10
|
-
export const CLI_VERSION = '0.10.
|
|
10
|
+
export const CLI_VERSION = '0.10.4';
|
|
11
11
|
/** Sent on every HTTP request the CLI makes back into ProhostAI. */
|
|
12
12
|
export const USER_AGENT = `prohost-cli/${CLI_VERSION}`;
|