Skip to content

chore: add CI workflow and fix build/lint/test failures - #1124

Merged
1nonlypiece merged 2 commits into
mainfrom
chore/ci-green
Jul 29, 2026
Merged

chore: add CI workflow and fix build/lint/test failures#1124
1nonlypiece merged 2 commits into
mainfrom
chore/ci-green

Conversation

@1nonlypiece

Copy link
Copy Markdown
Contributor

Summary

This repo had no .github/workflows at 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:

  1. Adds .github/workflows/ci.yml — three jobs (lint, build, test) on push/PR to main, using pnpm.
  2. Fixes everything needed to make pnpm run lint, pnpm run build, and pnpm run test all 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)

  • Excluded test files from the production tsc build (vitest doesn't type-check them anyway; this keeps strict checks on app code while dropping ~130 pre-existing test-only type errors that never blocked anything).
  • Fixed real production bugs uncovered by the build, including two called out explicitly:
    • Notification.tsx: leftover duplicate/dead code from a bad merge (redeclared pagination, handleDismiss, handleClearAll, referenced a nonexistent currentNotification variable).
    • Analytics.tsx: missing Skeleton import (used 3×, would have crashed at runtime).
    • Also: VaultDetail.tsx missing ReactNode/CSSProperties imports, RequireWallet.tsx missing useNavigate/useRef/useEffect imports, VerifierDashboard.tsx missing ChipStatus import, NotificationBell/NotificationIcon reading a nonexistent unreadCount store field instead of the existing useUnreadCount() selector, vaultValidation.ts re-exporting isValidStellarAddress instead of importing it (so it was unbound where used), VerifierMetrics.tsx/PendingValidations.tsx using now without ever calling useCurrentTime(), horizon.ts returning an unknown-typed balance, and CommandPalette.tsx shadowing the native KeyboardEvent type with React's.
    • Analytics.tsx also had unused bestPeriod/currentStreak computations sitting next to hardcoded "5"/"June" text in the UI — wired them up instead of just silencing the lint warning.

Lint (eslint)

  • Scoped the root ESLint config to the actual app: 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.
  • Allowed _-prefixed intentionally-unused args (standard convention, used by an existing stub handler) and relaxed no-explicit-any for test files only.
  • Fixed the remaining real issues: unused imports/vars, catch (e) with an unused binding, @ts-ignore@ts-expect-error, and added a scoped, commented eslint-disable for 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 (menuitem vs button), and missing ThemeProvider/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 marked aria-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 under App's BrowserRouter in practice).
  • PendingValidations: had no way to navigate to the history page at all — added a "View History" button matching the existing pattern in VerifierDashboard.

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 — tested notificationTypeIcons/notificationTypeColors exports that a previous, already-merged PR (#1009) intentionally removed as dead code.
  • One Dashboard.test.tsx memoization test built entirely around a summary prop that no longer exists now that Dashboard fetches 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 — succeeds
  • pnpm run test — 124/124 files, 1689/1689 tests pass, coverage thresholds met
  • CI checks green on this PR (will confirm after push)

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.
@1nonlypiece
1nonlypiece merged commit 68ad44f into main Jul 29, 2026
3 checks passed
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.

2 participants