From 3af2892c54f65438d7ac5b1be66a248891386c02 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 15:38:45 +0000 Subject: [PATCH 01/10] Apply Buffer.from before encodedRequest is passed to fetch as fetch expects the body field to have type BodyInit | null | undefined --- src/blobs/carrier.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blobs/carrier.ts b/src/blobs/carrier.ts index c3e3d959a..5eff293ca 100644 --- a/src/blobs/carrier.ts +++ b/src/blobs/carrier.ts @@ -60,7 +60,7 @@ export async function fetchUpdateConfig( log(`requestData: ${outFile}`) await fs.writeFile(outFile, JSON.stringify(Request.toJSON(requestData), null, 4)) } - const encodedRequest = Request.encode(requestData).finish() + const encodedRequest = Buffer.from(Request.encode(requestData).finish()) if (debug) { const reqFile = path.join(tmpDir, 'encodedRequestData') await fs.writeFile(reqFile, encodedRequest) From 05225a2aa7785dd2c0b9ebd26472a473aea0c9f1 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 15:51:32 +0000 Subject: [PATCH 02/10] Cast e to Error in src/commands/collect-state.ts runStateCollectionBuild to silence tsc error --- src/commands/collect-state.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/collect-state.ts b/src/commands/collect-state.ts index ed301e6a4..160d4e398 100644 --- a/src/commands/collect-state.ts +++ b/src/commands/collect-state.ts @@ -320,7 +320,7 @@ async function runStateCollectionBuild( break } catch (e) { logElapsedTime(buildStart, `${device} phase ${phase} state collection build failed in`) - let stderr = e.message as string + let stderr = (e as Error).message as string if (stderr !== undefined) { log(`\n${statusPrefix}stderr:\n` + stderr) } From fb7fb898f463c0617fdf313379128b352849dfc7 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 15:53:39 +0000 Subject: [PATCH 03/10] Fix yaml import in src/commands/fetch-build-index.ts --- src/commands/fetch-build-index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/fetch-build-index.ts b/src/commands/fetch-build-index.ts index 5b41e0884..2ba305464 100644 --- a/src/commands/fetch-build-index.ts +++ b/src/commands/fetch-build-index.ts @@ -1,5 +1,5 @@ import { Command, Flags } from '@oclif/core' -import { YAMLMap } from 'yaml/types' +import { YAMLMap } from 'yaml' import assert from 'assert' import YAML, { Document } from 'yaml' From b28277cad7fb535e49b14f18f509d3a595dda628 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 15:57:55 +0000 Subject: [PATCH 04/10] src/commands/update-carrier-settings.ts:run use util.inspect to convert updateConfig to string before calling log --- src/commands/update-carrier-settings.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/update-carrier-settings.ts b/src/commands/update-carrier-settings.ts index 614b68b68..61c67e2c2 100644 --- a/src/commands/update-carrier-settings.ts +++ b/src/commands/update-carrier-settings.ts @@ -1,4 +1,5 @@ import { Command, Flags } from '@oclif/core' +import util from 'util' import { downloadAllConfigs, fetchUpdateConfig, getCarrierSettingsUpdatesDir } from '../blobs/carrier' import { BUILD_VERSION_SDK_PROP, loadPartitionProps } from '../blobs/props' @@ -46,7 +47,7 @@ export default class UpdateCarrierSettings extends Command { ) let sdkVersion = mapGet(mapGet(stockProps, Partition.System), BUILD_VERSION_SDK_PROP) const updateConfig = await fetchUpdateConfig(config.device.name, buildId, sdkVersion, flags.debug) - if (flags.debug) log(updateConfig) + if (flags.debug) log(util.inspect(updateConfig, false, Infinity)) await downloadAllConfigs(updateConfig, outDir, flags.debug) } else { this.log(`${config.device.name} is not supported due to lack of cellular connectivity`) From ff54e5b8d46e0b8dc05a90550c712765cf3f3fa6 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:15:01 +0000 Subject: [PATCH 05/10] source.ts:_read use ReadOptionsWithBuffer for file read options --- src/frontend/source.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/frontend/source.ts b/src/frontend/source.ts index 96a1b98cc..482d38a50 100644 --- a/src/frontend/source.ts +++ b/src/frontend/source.ts @@ -1,5 +1,5 @@ import assert from 'assert' -import { createReadStream, promises as fs } from 'fs' +import { createReadStream, promises as fs, ReadOptionsWithBuffer } from 'fs' import { FileHandle, FileReadOptions } from 'fs/promises' import hasha from 'hasha' import path from 'path' @@ -584,11 +584,12 @@ class FdReader extends yauzl.Reader { // do not initialize buffer contents, assert below ensures that it's fully written out let buffer = Buffer.allocUnsafe(length) - let opts = { - buffer, - length, + let opts: ReadOptionsWithBuffer = { + buffer: buffer, + length: length, + offset: 0, position: this.off + start, - } as FileReadOptions + } assert((await this.fd.read(opts)).bytesRead === length) return buffer From acbbf852a4681fbdeb1a60c4a05dc5744d76f852 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:19:33 +0000 Subject: [PATCH 06/10] Fix Document import name collision in src/images/build-index.ts --- src/images/build-index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/images/build-index.ts b/src/images/build-index.ts index 911ce848f..7d00748a2 100644 --- a/src/images/build-index.ts +++ b/src/images/build-index.ts @@ -2,7 +2,7 @@ import assert from 'assert' import { JSDOM } from 'jsdom' import fetch from 'node-fetch' import path from 'path' -import { Document, YAMLMap } from 'yaml' +import { Document as YAMLDocument, YAMLMap } from 'yaml' import { loadAndMergeConfig } from '../config/config-loader' import { DeviceBuildId, DeviceConfig, makeDeviceBuildId } from '../config/device' @@ -108,7 +108,7 @@ async function fetchBuildIndexInner( } } - return new Document().createNode(buildIndex) as YAMLMap + return new YAMLDocument().createNode(buildIndex) as YAMLMap } function parseFactoryOrOtaPage(buildIndex: BuildIndex, pageType: string, dom: JSDOM, devices: Set) { From 3f9b54d56359909e37e7ea6684f45ef101977f9d Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:23:09 +0000 Subject: [PATCH 07/10] src/images/download.ts:downloadImageInner check for null resp.body before accessing resp.body --- src/images/download.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/images/download.ts b/src/images/download.ts index 5284fe1a6..703930d70 100644 --- a/src/images/download.ts +++ b/src/images/download.ts @@ -84,6 +84,10 @@ async function downloadImageInner( if (!resp.ok) { throw new Error(`${resp.status}: ${resp.statusText}; ${image.toString()} `) } + if (resp.body === null) { + throw new Error(`missing response body for ${image.toString()}`) + } + let downloaded = 0 let totalSizeStr: string | null From 7b992504b43efe875c2daebf85391fa313f04be6 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:28:59 +0000 Subject: [PATCH 08/10] src/util/exact-filter.ts:filterEntries2 change the bounds on the generic parameter T to extend Record --- src/util/exact-filter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/exact-filter.ts b/src/util/exact-filter.ts index 5f7e3aa8c..5bc877670 100644 --- a/src/util/exact-filter.ts +++ b/src/util/exact-filter.ts @@ -81,7 +81,7 @@ interface FilterEntries2Result { hasTransforms: boolean } -export function filterEntries2(cmd: EntryFilter2Cmd) { +export function filterEntries2>(cmd: EntryFilter2Cmd) { let unknownEntries: string[] = [] let filtered: [string, T][] = [] let hasTransforms = false From 1a9f7dbf1a46a892dec6423dbe878ea2cc0e9248 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:32:01 +0000 Subject: [PATCH 09/10] src/util/log.ts: update the type of pendingWrites to (string | Buffer | Uint8Array)[] --- src/util/log.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/log.ts b/src/util/log.ts index 8f5ff8a13..c2aea4297 100644 --- a/src/util/log.ts +++ b/src/util/log.ts @@ -69,7 +69,7 @@ function updateStatusLines() { } } -let pendingWrites: unknown[] = [] +let pendingWrites: (string | Buffer | Uint8Array)[] = [] let currentStatus: string | null = null let isClearPending = false From e14185c70a1766d4ef56455ead9eb129498081d0 Mon Sep 17 00:00:00 2001 From: rdevshp Date: Fri, 26 Jun 2026 16:37:56 +0000 Subject: [PATCH 10/10] src/util/log.ts: make the str parameter type match the input parameter type of write --- src/util/log.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/log.ts b/src/util/log.ts index c2aea4297..931a9aaf8 100644 --- a/src/util/log.ts +++ b/src/util/log.ts @@ -149,7 +149,7 @@ function write(str: string | Buffer | Uint8Array, callback?: () => void) { } } -export function log(str: string | Buffer | DataView) { +export function log(str: string | Buffer | Uint8Array) { if (currentStatus !== null) { clearStatusLines() write(str)