chore: add CI workflow and fix build/lint/test failures - #1124
Merged
Conversation
No .github/workflows existed at all, so CI/CD never ran on this repo - every merged PR skipped lint, build, and test verification. This adds a GitHub Actions workflow (lint/build/test on push+PR to main) and fixes everything that workflow surfaces: Build (tsc): - Exclude test files from the production tsc build (vitest doesn't type-check them; keeps strict prod-code checks while dropping ~130 pre-existing test-only type errors that never blocked anything before). - Fix real bugs: Notification.tsx leftover merge-conflict duplicate code, Analytics.tsx missing Skeleton import, VaultDetail.tsx missing ReactNode/CSSProperties imports, RequireWallet.tsx missing useNavigate/useRef/useEffect imports, VerifierDashboard.tsx missing ChipStatus import, NotificationBell/Icon using a non-existent `unreadCount` store field instead of the existing useUnreadCount() selector, vaultValidation.ts re-exporting instead of importing isValidStellarAddress (so it was unbound), VerifierMetrics.tsx and PendingValidations.tsx never calling useCurrentTime() despite using `now`, horizon.ts returning an `unknown`-typed balance field, and CommandPalette.tsx shadowing the DOM KeyboardEvent type with React's. - Wire up Analytics.tsx's unused bestPeriod/currentStreak computations into the Behavioral Insights cards instead of hardcoded "5"/"June" text. - CreateVault.tsx: narrow an over-wide error-field-order type and satisfy Milestone's required `description` field. Lint (eslint): - Scope the root ESLint config to the app (design-system/ has its own separate .eslintrc/tsconfig/jest setup and was never meant to be linted here; coverage/ output dirs are excluded too). - Allow `_`-prefixed intentionally-unused args/vars and relax no-explicit-any for test files (standard conventions). - Fix real issues: unused imports/vars, `catch (e)` with an unused binding, @ts-ignore -> @ts-expect-error, an intentional control-regex security check now has a scoped eslint-disable with a comment. Tests (vitest, 1689 tests / 124 files, previously ~183 failing): - Most failures were pre-existing, unrelated to any change in this PR - stale assertions against fixtures/copy that had since evolved (hardcoded vault deadlines/counts, old validation copy, old relative- time format, obsolete component props), wrong ARIA roles (menuitem vs button), missing ThemeProvider/localStorage-isolation in test setup, and a few real bugs the tests correctly caught: - WalletContext: `isAllowed()` resolves `{ isAllowed: boolean }`, but the code checked truthiness of the whole object, so it always auto-reconnected regardless of the actual permission state. - ValidationDetail: whitespace-only notes were persisted as a draft instead of being treated as empty. - Layout: the "Vaults" nav link was also marked active on /vaults/create, which has its own nav item. - Vaults.tsx: the default export used react-router's <Link> with no guaranteed Router ancestor when used standalone. - PendingValidations was missing a "View History" link entirely. - Deleted 2 test cases testing intentionally-removed or never-wired features per the "prioritize green CI" guidance: NotificationTypeMaps test file (tests exports removed by a previous, already-merged PR) and a Dashboard.test.tsx memoization test built around a `summary` prop that no longer exists now that Dashboard fetches vault data itself. All fixes are either straightforward corrections or minimal, targeted production fixes - nothing was silently skipped or weakened.
pnpm/action-setup errors out when both an explicit `version` input and package.json's `packageManager` field are present. Drop the input and let the action read the pinned version from packageManager instead.
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.
Summary
This repo had no
.github/workflowsat all, so CI/CD never actually ran on any PR — lint, build, and tests were never verified before merge. That let a large number of pre-existing bugs and stale tests accumulate. This PR:.github/workflows/ci.yml— three jobs (lint,build,test) on push/PR tomain, using pnpm.pnpm run lint,pnpm run build, andpnpm run testall pass cleanly.No paid/licensed service credentials are needed for any of these checks — everything runs against local mock data.
What was fixed vs. deleted
Build (
tsc -b)Notification.tsx: leftover duplicate/dead code from a bad merge (redeclaredpagination,handleDismiss,handleClearAll, referenced a nonexistentcurrentNotificationvariable).Analytics.tsx: missingSkeletonimport (used 3×, would have crashed at runtime).VaultDetail.tsxmissingReactNode/CSSPropertiesimports,RequireWallet.tsxmissinguseNavigate/useRef/useEffectimports,VerifierDashboard.tsxmissingChipStatusimport,NotificationBell/NotificationIconreading a nonexistentunreadCountstore field instead of the existinguseUnreadCount()selector,vaultValidation.tsre-exportingisValidStellarAddressinstead of importing it (so it was unbound where used),VerifierMetrics.tsx/PendingValidations.tsxusingnowwithout ever callinguseCurrentTime(),horizon.tsreturning anunknown-typed balance, andCommandPalette.tsxshadowing the nativeKeyboardEventtype with React's.Analytics.tsxalso had unusedbestPeriod/currentStreakcomputations sitting next to hardcoded"5"/"June"text in the UI — wired them up instead of just silencing the lint warning.Lint (
eslint)design-system/is a separate sub-package with its own.eslintrc.json/tsconfig/jest setup and was never meant to be linted from the root;coverage/output is excluded too._-prefixed intentionally-unused args (standard convention, used by an existing stub handler) and relaxedno-explicit-anyfor test files only.catch (e)with an unused binding,@ts-ignore→@ts-expect-error, and added a scoped, commentedeslint-disablefor one intentional control-character regex (a security check, not a bug).Tests (vitest — 1689 tests / 124 files, ~183 were failing before this PR)
The large majority were pre-existing failures unrelated to any change in this PR — stale assertions against fixtures/copy that had since evolved (hardcoded vault deadlines/counts, old validation error copy, an old relative-time format, obsolete component props), wrong ARIA roles (
menuitemvsbutton), and missingThemeProvider/localStorage isolation in test setup. A handful were genuine bugs the tests correctly caught:WalletContext:isAllowed()resolves{ isAllowed: boolean }, but the code checked truthiness of the whole object — so it always attempted to auto-reconnect regardless of the actual Freighter permission state.ValidationDetail: whitespace-only notes were persisted as a draft instead of being treated as empty.Layout: the "Vaults" nav link was also markedaria-current="page"on/vaults/create, which has its own separate nav item.Vaults.tsx: the default export rendered<Link>with no guaranteed Router ancestor when used standalone (only worked because it's always mounted underApp'sBrowserRouterin practice).PendingValidations: had no way to navigate to the history page at all — added a "View History" button matching the existing pattern inVerifierDashboard.Per the repo owner's guidance to prioritize a green CI over preserving every test, two test cases were deleted rather than deep-fixed:
NotificationTypeMaps.test.ts— testednotificationTypeIcons/notificationTypeColorsexports that a previous, already-merged PR (#1009) intentionally removed as dead code.Dashboard.test.tsxmemoization test built entirely around asummaryprop that no longer exists now thatDashboardfetches its own vault data internally — its premise no longer matches the component.Test plan
pnpm run lint— 0 errors (16 pre-existing warnings remain, non-blocking)pnpm run build— succeedspnpm run test— 124/124 files, 1689/1689 tests pass, coverage thresholds met