Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript 5.7 and fix coverage CI #10561

Merged
merged 6 commits into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/after-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: generate test coverage report
run: ./scripts/ci/generage-test-coverage-report.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I should have noticed this one. 😛

run: ./scripts/ci/generate-test-coverage-report.sh
- uses: actions/upload-artifact@v4
with:
name: coverage
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@google-cloud/monitoring": "^4.1.0",
"@jessie.js/eslint-plugin": "^0.4.1",
"@types/express": "^4.17.17",
"@types/node": "^22.0.0",
"@types/node": "^22.9.0",
"ava": "^5.3.0",
"c8": "^10.1.2",
"conventional-changelog-conventionalcommits": "^4.6.0",
Expand All @@ -36,7 +36,7 @@
"type-coverage": "^2.27.1",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.1",
"typescript": "^5.6.2",
"typescript": "~5.7.1",
"typescript-eslint": "^7.18.0"
},
"resolutions": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ workerLog(`supervisor started`);

function makeNetstringReader({ fd, encoding }) {
const input = Buffer.alloc(32 * 1024);
/** @type {Buffer<ArrayBufferLike>} */
let buffered = Buffer.alloc(0);
let decoded = [];

Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"rimraf": "^5.0.0",
"tsd": "^0.31.1",
"tsimp": "^2.0.11",
"typescript": "~5.6.2"
"typescript": "~5.7.1"
},
"dependencies": {
"@endo/base64": "^1.0.9",
Expand Down
10 changes: 10 additions & 0 deletions packages/inter-protocol/src/provisionPoolKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ const FIRST_LOWER_NEAR_KEYWORD = /^[a-z][a-zA-Z0-9_$]*$/;
* @import {Bank, BankManager} from '@agoric/vats/src/vat-bank.js'
*/

// XXX when inferred, error TS2742: cannot be named without a reference to '../../../node_modules/@endo/exo/src/get-interface.js'. This is likely not portable. A type annotation is necessary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this error but explicit return values is totally acceptable anyway

/**
* @typedef {{
* machine: any;
* helper: any;
* public: any;
* }} ProvisionPoolKit
*/

/**
* @typedef {import('@agoric/zoe/src/zoeService/utils.js').Instance<
* import('@agoric/inter-protocol/src/psm/psm.js').start
Expand Down Expand Up @@ -506,6 +515,7 @@ export const prepareProvisionPoolKit = (
* @param {object} opts
* @param {Brand<'nat'>} opts.poolBrand
* @param {ERef<StorageNode>} opts.storageNode
* @returns {Promise<ProvisionPoolKit>}
*/
const makeProvisionPoolKit = async ({ poolBrand, storageNode }) => {
const fundPurse = await E(poolBank).getPurse(poolBrand);
Expand Down
6 changes: 4 additions & 2 deletions packages/inter-protocol/src/reserve/params.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import { CONTRACT_ELECTORATE, ParamTypes } from '@agoric/governance';

const makeReserveTerms = (poserInvitationAmount, timer) => ({
timer,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to the runtime behavior. A new chain will now no longer have the timer in the reserve terms where before that it would have. What is the motivation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Motivation is the caller never provided the argument and it's now detected. The runtime impact is that property will be omitted from the return instead of being undefined. I don't see anything checking for the key presence specifically.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given lack of value at the caller site, that change sounds reasonable

/**
* @param {InvitationAmount} poserInvitationAmount
*/
const makeReserveTerms = poserInvitationAmount => ({
governedParams: harden({
[CONTRACT_ELECTORATE]: {
type: ParamTypes.INVITATION,
Expand Down
2 changes: 1 addition & 1 deletion packages/inter-protocol/test/psm/setupPsm.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ export const setupPsm = async (
brand.produce.IST.resolve(istBrand);
issuer.produce.IST.resolve(istIssuer);

// @ts-expect-error mock
space.produce.provisionPoolStartResult.resolve({
// @ts-expect-error mock
creatorFacet: Far('dummy', {
initPSM: () => {
t.log('dummy provisionPool.initPSM');
Expand Down
1 change: 1 addition & 0 deletions packages/internal/src/netstring.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function decode(data, optMaxChunkSize) {
*/
// input is a byte pipe, output is a sequence of Buffers
export function netstringDecoderStream(optMaxChunkSize) {
/** @type {Buffer<ArrayBufferLike>} */
let buffered = Buffer.from('');
/**
* @param {Buffer} chunk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ const meterControl = makeMeterControl();
/**
* Wrap byte-level protocols with tagged array codec.
*
* @param {(cmd: ArrayBuffer) => ArrayBuffer} issueCommand as from xsnap
* @param {(cmd: ArrayBufferLike) => ArrayBuffer} issueCommand as from xsnap
* @typedef { [unknown, ...unknown[]] } Tagged tagged array
*/
function managerPort(issueCommand) {
/** @type { (item: Tagged) => ArrayBuffer } */
/** @type { (item: Tagged) => ArrayBufferLike } */
const encode = item => {
let txt;
try {
Expand Down
2 changes: 1 addition & 1 deletion packages/xsnap/src/avaXS.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function runTestScript(
/**
* Handle callback "command" from xsnap subprocess.
*
* @type { (msg: ArrayBuffer) => Promise<ArrayBuffer> }
* @type { (msg: ArrayBuffer) => Promise<Uint8Array<ArrayBufferLike>> }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a significant change of type. New one looks right but I'm surprised we didn't have an error before.

*/
async function handleCommand(message) {
/**
Expand Down
4 changes: 2 additions & 2 deletions packages/xsnap/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
declare var issueCommand: (msg: ArrayBuffer) => ArrayBuffer;
declare var issueCommand: (msg: ArrayBufferLike) => ArrayBuffer;

namespace global {
declare var issueCommand: (msg: ArrayBuffer) => ArrayBuffer;
declare var issueCommand: (msg: ArrayBufferLike) => ArrayBuffer;
}
18 changes: 15 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3774,7 +3774,14 @@
dependencies:
"@types/node" "*"

"@types/node@*", "@types/[email protected]", "@types/node@>=13.7.0", "@types/node@^22.0.0":
"@types/node@*", "@types/node@>=13.7.0", "@types/node@^22.9.0":
version "22.9.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.9.0.tgz#b7f16e5c3384788542c72dc3d561a7ceae2c0365"
integrity sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==
dependencies:
undici-types "~6.19.8"

"@types/[email protected]":
version "22.7.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.5.tgz#cfde981727a7ab3611a481510b473ae54442b92b"
integrity sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==
Expand Down Expand Up @@ -12172,7 +12179,7 @@ typescript-eslint@^7.18.0, typescript-eslint@^7.3.1:
"@typescript-eslint/parser" "7.18.0"
"@typescript-eslint/utils" "7.18.0"

"[email protected] - 5.6.x", typescript@^5.4.5, typescript@^5.6.2, typescript@~5.6.2, typescript@~5.6.3:
"[email protected] - 5.6.x", typescript@~5.6.3:
version "5.6.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==
Expand All @@ -12182,6 +12189,11 @@ typescript-eslint@^7.18.0, typescript-eslint@^7.3.1:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

typescript@^5.4.5, typescript@~5.7.1:
version "5.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.2.tgz#3169cf8c4c8a828cde53ba9ecb3d2b1d5dd67be6"
integrity sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==

uc.micro@^2.0.0, uc.micro@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-2.1.0.tgz#f8d3f7d0ec4c3dea35a7e3c8efa4cb8b45c9e7ee"
Expand All @@ -12202,7 +12214,7 @@ unbox-primitive@^1.0.2:
has-symbols "^1.0.3"
which-boxed-primitive "^1.0.2"

undici-types@~6.19.2:
undici-types@~6.19.2, undici-types@~6.19.8:
version "6.19.8"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.19.8.tgz#35111c9d1437ab83a7cdc0abae2f26d88eda0a02"
integrity sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==
Expand Down
Loading