Skip to content

Conversation

@benya7
Copy link
Contributor

@benya7 benya7 commented Jul 31, 2025

This PR represents a major evolution of the application, touching three critical areas: data fetching architecture, developer operations (CI/CD and testing), and codebase modernization. It introduces a robust hybrid data loading strategy, completely revamps the CI pipeline for better reliability and speed, and executes a significant app-wide refactor to align with updated dependencies and improve code quality.

🚀 Part 1: Architectural Overhaul - Data Loading & Initialization

This is the headline feature, designed to deliver an instant loading experience when possible, while gracefully degrading to a P2P-only model when necessary.

  • API-First Pre-fetching (plugins/router.ts): A new global router.beforeEach guard orchestrates all initial data loading. It performs a health check on a fast REST API; if healthy, it pre-fetches and seeds the TanStack Query cache, providing a near-instantaneous UI render.
  • Graceful P2P Fallback (App.vue, composables/lensInitialization.ts): If the API is unavailable, pre-fetching is skipped. App.vue displays a smart loading screen that only appears while waiting for the P2P network to initialize and provide data.
  • Non-Blocking P2P Initialization (composables/lensInitialization.ts): The lensService initialization now runs in the background via the useLensInitialization composable, preventing it from blocking the UI. Dialing logic has also been refined for better logging.
  • Route-Specific Guards (plugins/router.ts): New beforeEnter guards on /upload, /admin, and /release/:id handle route protection and pre-fetching for direct navigation.
  • Dynamic API URL (plugins/router.ts): A getApiUrl function now robustly parses the VITE_LENS_NODE multiaddr to construct the correct API URL for any environment.

⚙️ Part 2: Developer Operations & Testing Overhaul

This PR completely modernizes the CI/CD pipeline and testing strategy for improved feedback loops, reliability, and clarity.

  • Consolidated CI Workflow (.github/workflows/ci.yml):
    • Replaced multiple, fragmented workflow files (lint.yml, tests.yml, typechecking.yml, etc.) with a single, unified ci.yml.
    • The new workflow is structured with parallel jobs for fast feedback (Lint & Type-Check, Unit Tests) and a final dependent job for comprehensive testing (Build & E2E Tests).
    • This ensures that slower, more resource-intensive E2E tests only run if the basic quality checks and unit tests pass.
  • Modernized Testing Framework:
    • Removed old Vitest-based E2E tests and benchmark files (tests/*.spec.ts).
    • Introduced Playwright for modern E2E testing with a new playwright.config.ts and a basic smoke test in tests/e2e/.
    • Updated package.json scripts to separate test:unit and test:e2e commands.
    • Moved utils.spec.ts into a dedicated tests/unit/ directory.
  • Improved ESLint Configuration (eslint.config.js):
    • The ESLint config has been rewritten for clarity, explicitly defining separate configurations for Browser/Vue files and Node.js/config files.
    • Added more specific ignores to prevent linting of build artifacts and test reports.
  • Updated Dependencies (package.json, pnpm-lock.yaml):
    • Upgraded key dependencies, most notably @riffcc/lens-sdk (from 0.1.25 to 0.1.32) and @playwright/test.
    • This brings in the latest features, bug fixes, and security patches.

🧹 Part 3: App-wide Refactoring & UI Enhancements

These changes align the codebase with the new architecture, dependency updates, and improve overall quality.

  • Type Standardization & SDK Alignment (types.ts, plugins/lensService/hooks.ts):
    • The application's core data types (ReleaseItem, FeaturedReleaseItem, etc.) have been standardized to align with the latest lens-sdk contracts.
    • All data hooks and mutations have been updated to match new SDK method signatures, data structures, and property names (e.g., endTime, to).
    • Removed outdated static data fallbacks (composables/staticData.ts).
  • Enhanced UI & Permissions (views/accountPage.vue, components/layout/appBar.vue):
    • The Account Page has been completely redesigned to be more informative, now displaying user roles and a human-readable list of permissions, with a skeleton loader for a better UX.
    • The App Bar now uses detailed, computed permission checks (canUpload, canAccessAdminPanel) to accurately control the visibility of UI elements like the "Upload" and "Admin" links.
  • Component & Logic Simplification:
    • HomePage.vue: The logic for creating content sections (activeSections) has been significantly simplified and made more performant.
    • Minor Fixes: Corrected icon paths in vuetify.ts, fixed category matching in releasePage.vue and categoryPage.vue, and removed the unused RegisterForm.vue.
    • Code Cleanup: Removed AnyObject types, unused SDK property imports, and updated props/state across numerous components to use the new standardized types.
  • Configuration & Scripts (package.json, docs/lens_nginx.conf):
    • Streamlined package.json scripts for clarity, separating dev, build, test, and Electron-specific commands.
    • Updated the Nginx configuration template with the correct API port.

@benya7 benya7 requested a review from Zorlin July 31, 2025 19:50
@benya7
Copy link
Contributor Author

benya7 commented Jul 31, 2025

Ignore the failed gh workflows for now, they're symbolic. We'll get them fixed in further PR.

@Zorlin Zorlin merged commit 23ba253 into main Aug 1, 2025
1 of 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.

3 participants