Skip to content

Release v1.9.0 - #182

Closed
brunobar79 wants to merge 1 commit into
developfrom
v1.9.0
Closed

brunobar79 wants to merge 1 commit into
developfrom
v1.9.0

Conversation

@brunobar79

Copy link
Copy Markdown
Contributor

No description provided.

@brunobar79 brunobar79 closed this Nov 15, 2019
@brunobar79
brunobar79 deleted the v1.9.0 branch November 15, 2019 16:23
Mrtenz pushed a commit that referenced this pull request Oct 16, 2025
* Refactor function to get cache identifier

The function `cacheIdentifierForPayload` has been renamed to
`cacheIdentifierForRequest`, and refactored to accept a JSON-RPC
request rather than the `Payload` type.

The function `paramsWithoutBlockTag` has been updated to accept a JSON-
RPC request rather than a `Payload` as well. I noticed that this
function wasn't being used anywhere, so the `export` was removed as
well.

The `block-cache` and `inflight-cache` middleware required some
internal updates to accomodate these type changes. No functional
changes or external-facing type changes have been made.

Documentation and tests have been added. This brings test coverage for
`cache.ts` up to 100%.

Relates to #176 in that it helps unblock the necessary changes.

* Make `method` parameter mandatory for cache utility functions

The `method` parameter is now mandatory for the cache utility
functions. It was only made optional in the first place as a side-
effect of an erroneous type that was being used (`Payload`), which has
now been replaced.

* Remove leftover merge marger
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
Naz-Ovh pushed a commit to 0x-fork/metamask-core that referenced this pull request Sep 13, 2026
Top of stack MetaMask#315, on MetaMask#321.

`yarn test:types` runs bare `tsd`, which finds **no test files at all**.
It produces no output and exits 0 regardless, so the 460 lines of type
assertions across `src/*.test-d.ts` have not been checking anything.

Proof, before this change:

```
$ printf 'expectAssignable<Hex>(999);' >> src/hex.test-d.ts
$ yarn test:types
$ echo $?
0
```

Pointing tsd at the files explicitly reports it properly and exits 1:

```
✖  Argument of type 999 is not assignable to parameter of type `0x${string}`.
```

## Cause

tsd resolves test files relative to the `types` field, which has pointed
at `./dist/index.d.cts` since ts-bridge was adopted in MetaMask#182
(2024-04-23). tsd 0.29 does not resolve `.d.cts`, and the
`tsd.directory` setting does not compensate. **26 releases** have
shipped since, all with this check silently passing.

## Fix

```diff
- "test:types": "tsd"
+ "test:types": "tsd --files 'src/*.test-d.ts'"
```

Fixing the invocation rather than the `types` field, since the field is
correct for consumers and only tsd is confused by it.

All four files pass once actually executed, so none of them needed
changing. `yarn test:types` now exits 1 on a bad assertion and 0 when
clean.

## Relevance to the migration

This was found while working out what to do with tsd in Phase B, since
core has no way to run it. Worth knowing the honest baseline before
deciding: these assertions have been dormant for 17 months, so whatever
we do with them in core, we are not losing coverage we currently have.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Only the npm script for type testing changed; runtime package behavior
and public types are unchanged.
> 
> **Overview**
> **`yarn test:types` was a no-op:** bare `tsd` never picked up the
`src/*.test-d.ts` suites (because of how it resolves files vs the
package `types` entry), so type assertions could fail silently while CI
still exited 0.
> 
> The script now runs **`tsd --files 'src/*.test-d.ts'`**, so those
assertions actually execute and **`yarn test:types` fails when a type
check is wrong**. No changes to the test files themselves were required
once they were being run.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b934063cc9e2ede2681fbc74c00c571deb68ebbe. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant