Repository navigation
Harden token resolution, clear lint, and gate CI on typecheck, lint and build - #33
Merged
Merged
Conversation
…t misses The contract-id check accepted only SP/SM principals, so on a testnet build (the default when NEXT_PUBLIC_NETWORK is unset) the mock token could never resolve and every stream showed as unverifiable. Ids from both networks are now well formed; contractIdNetwork() says which network one belongs to, and the resolver, the curated list and the token search are scoped to the network the app runs on. Pasting a contract from the other network now says so instead of failing as "could not verify". The resolver cached failures for the life of the instance, so one 429 or timeout from the node marked a valid token unverifiable until a cold start. Hits are still cached forever (decimals, symbol and asset name are fixed at deploy); misses now expire after 60s, and concurrent lookups share one request. The API routes had a second, separately cached copy of the decimals and symbol readers; they now use the same resolver. Also removes verifySelection's two unused parameters, corrects its comment about mismatched listings (it refuses, it does not hand back chain values), and replaces the literal NUL byte in token-metadata.test.ts with "\0" so git stops treating the file as binary and PR diffs show it.
toRawAmount truncates extra fractional digits so it never sends more than was typed, but doing that silently still sends less than was typed. The create, top-up and claim forms now stop and say how many decimal places the token supports.
Replaces the remaining `any` types at the Clarity JSON and API boundaries with narrow types, types the wallet call options (getNetwork now returns the "mainnet" | "testnet" literal), and drops unused imports. useStreamProgress read Date.now() during render and set state synchronously inside effects. It now derives the value: the animation frame is tagged with the snapshot it extrapolates from and only shown while it matches, so a stale frame can never overwrite a new snapshot. eslint: 18 problems (14 errors, 4 warnings) -> 0.
Three property tests drew from Math.random instead of the seeded RNG, so a failure printed a FUZZ_SEED that could not reproduce it. All now use the seed. "multi-cycle pause, claimable frozen" failed for durations of 10-13 and 20-23 blocks. Each pause pushes accrual past end-block, and pause-stream is refused once end-block passes (ERR-STREAM-ENDED, by design). The test ignored the refusal and asserted a freeze that never started. It now stops the cycle on that refusal, the same guard the sibling "returns to ACTIVE" test already had. Contract unchanged.
SKILL.md told the assistant every amount has 8 decimals, the same mistake that showed a 1.2 USDA deposit as 0.012, and that blocks take 10 minutes (about 5 seconds since Nakamoto). It now uses the tokenDecimals field the API returns. The read API exists as Next route handlers and as the Express service that self-hosted skills run. A parity test pins their formatting helpers to the same output so the two copies cannot drift.
CI ran only the root vitest suite, so a type error, a lint error or a broken production build in either app could merge. Adds a frontend job (tsc, lint, webpack build) and a service typecheck, installs both apps' dependencies for the root suite (it imports their sources), and cancels superseded runs.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
From the Oct 2 code review.
NEXT_PUBLIC_NETWORKis unset) could not resolve its own mock token.anyis gone at the Clarity JSON boundaries, anduseStreamProgressno longer reads the clock during render or sets state inside effects.pause-streamhad correctly refused (ERR-STREAM-ENDED). The contract is unchanged.SKILL.mdno longer tells the assistant that every token has 8 decimals or that blocks take 10 minutes. A new parity test pins the Express service and the hosted API to the same output.token-metadata.test.tsis replaced, so git shows the file as text again.Verified locally
npx vitest run: 206 passed (was 191)tsc,npm run lint(0 problems), andnpm run build(webpack, mainnet): cleantsc: cleanCI will not start until the GitHub billing lock on the account is cleared.