Skip to content

feat(aethermint): initialize platform services, holographic storage, and contract packing - #369

Open
SHEROSE0 wants to merge 258 commits into
AetherEdu:revert-112-feat/swagger-api-docsfrom
SHEROSE0:main
Open

feat(aethermint): initialize platform services, holographic storage, and contract packing#369
SHEROSE0 wants to merge 258 commits into
AetherEdu:revert-112-feat/swagger-api-docsfrom
SHEROSE0:main

Conversation

@SHEROSE0

Copy link
Copy Markdown
Contributor

#closes #287
Initializes the AetherMint decentralized learning platform workspace with core runtime implementations and technical documentation.

Changes Included:

  • Architecture Documentation: Added docs/aethermint-summary.md detailing platform capabilities and setup.
  • Backend Service: Added backend/src/services/holographicStorage.js for 3D spatial encoding simulation and compression.
  • Smart Contracts: Added contracts/src/storage_optimization.rs implementing slot-reduction and bit-packing patterns.
    #closes

Penielka and others added 30 commits June 21, 2026 17:03
- LoadingFallback: add Skeleton, SkeletonCard, SkeletonProfile, SkeletonList,
  SkeletonText, EmptyState, ErrorDisplay reusable components
- ErrorBoundary: use ErrorDisplay with collapsible details and retry
- ProfileHeader: add loading prop rendering SkeletonProfile skeleton
- CourseGrid: SkeletonCard loading, ErrorDisplay errors, EmptyState for empty results
- CredentialList: EmptyState with Add Credential CTA in compact and full views
- AchievementDisplay: EmptyState with clear-filters CTA in compact and full views
- ProgressChart/CompletionStats/TimeAnalysis: replace inline pulse skeletons
  with Skeleton, ErrorDisplay (retry), EmptyState
- demo/page.tsx: error banner, loading skeleton, ErrorBoundary wrapper
- campus/page.tsx: WebGL detection for unsupported state, skeleton via dynamic
  import, ErrorDisplay for runtime errors
- profile/page.tsx: replace inline Loader2/RefreshCw with SkeletonProfile,
  ErrorDisplay, EmptyState
…tates-skeleton-ui

feat(frontend): add loading states and skeleton UI for async components
…cycle-events-issue-25

feat(contracts): add credential lifecycle events (AetherEdu#25)
- Sanitization middleware :

- Strips/encodes script tags, HTML entities, and SQL/NoSQL patterns in backend/src/middleware/sanitizer.ts
- Added MAX_STRING_LENGTH enforcement and proper trimming of all string inputs
- Database queries :

- Verified services like userService.ts , EnrollmentService.ts have no raw string concatenation
- All database access follows safe patterns
- File uploads :

- backend/src/middleware/upload.ts already validates MIME types and file extensions for uploads
- All routes protected :

- Sanitization and pattern detection middleware are applied globally in index.ts , covering all routes
- CSP headers :

- Added cspMiddleware and securityHeadersMiddleware in backend/src/middleware/security.ts
- Applied globally in index.ts with other security headers
- Security tests :

- Added security.test.ts with tests for XSS, SQL injection, and NoSQL injection attacks
All requirements have been implemented.
Closes AetherEdu#134
…#139)

Resolves the remaining gaps in issue AetherEdu#139 ("Implement Offline-First
Capabilities with Service Worker"), assigned to Moonwalker-rgb.

Bug fix: frontend/public/sw.js failed to parse
----------------------------------------------------
The previously shipped service worker had its `self.addEventListener(
'message', (event) => { ... })` arrow function missing its closing
`});` brace. The next three listener registrations (sync, push,
notificationclick) were silently nested inside the message handler
body and would only register on the first SKIP_WAITING message; the
file itself failed to parse as JavaScript so the SW never installed.
Re-verified with `node --check frontend/public/sw.js`.

New wiring
----------
- frontend/src/components/PWA/PWAClientShell.tsx (new): client-only
  wrapper that mounts ServiceWorkerManager, OfflineIndicator and the
  react-hot-toast portal via `next/dynamic(..., { ssr: false })` so
  App Router SSR never reads `navigator.onLine` or `IndexedDB`.
- frontend/src/components/PWA/ServiceWorkerManager.tsx (new): registers
  /sw.js through the existing typed helper and surfaces a non-blocking
  "new version available" toast. The "Update now" button posts
  SKIP_WAITING and waits for `controllerchange` (one-shot) before
  reloading — replacing the previous arbitrary timeout race.
- frontend/src/hooks/useOfflineData.ts (new): `useOfflineCourses`
  hook wrapping IDB courses + a `clearAll` action. Together the
  banner drives both the sync queue (`useOfflineSync`) and the
  IndexedDB stores through a single entry point.
- frontend/src/utils/offlineDB.ts: adds `clearStore()` and
  `deleteOfflineCourse()` helpers used by the hook.

Banner upgrade
--------------
frontend/src/components/PWA/OfflineIndicator.tsx now:
- shows a pending-action count chip from `useOfflineSync()`,
- offers a \"Clear\" -> \"Confirm\" two-step flow (no `window.confirm`,
  jsdom-friendly) that wipes the IDB stores,
- surfaces a clear-failure inline so failed clears are not silent,
- uses `aria-live=\"assertive\"` when reporting an error so screen-
  reader users aren't caught off guard.

App Router wiring
-----------------
- frontend/src/app/layout.tsx: routes through PWAClientShell instead
  of the dead `void performanceMonitor` block; moves `themeColor` to
  a sibling `viewport` export (Next 14 best practice); preserves the
  side-effectful `performanceMonitor` import that auto-registers
  Web-Vitals observers.
- frontend/jest.config.js: fixes the `moduleNameMapping` typo so the
  `@/*` alias resolves and the existing `jest.setup.js` mock of
  `@/lib/performance-monitor` (and every other test in the project)
  can actually load.

Tests
-----
- frontend/src/components/PWA/__tests__/ServiceWorkerManager.test.tsx
  validates registration, the controllerchange-based update flow,
  online/offline toasts, and clean unmount.
- frontend/src/components/PWA/__tests__/OfflineIndicator.test.tsx
  updated for the new chip, two-step clear, and clear-error path.
- frontend/src/hooks/__tests__/useOfflineData.test.ts smoke-tests
  the hook via mocking the offlineDB module directly (no fake-
  indexeddb dependency added).

Verification
------------
`node --check frontend/public/sw.js` returns 0. Affected jest suites
(OfflineIndicator, ServiceWorkerManager, useOfflineData) all pass.

Out of scope / followups
------------------------
- `frontend/src/components/PWA/__tests__/serviceWorkerRegistration
  .test.ts` has 5 pre-existing failures on `main` that this PR does
  not introduce; recommend a separate fix-up.
- Suggested companion PR for issue AetherEdu#141 (Performance Optimization):
  lazily load heavy components referenced in the underlying layout
  tree (Metaverse, MixedReality, NeuralInterface, etc.) using
  `next/dynamic({ ssr: false })`, mirroring the client-side pattern
  introduced here.

Closes AetherEdu#139.
- Add next-bundle-analyzer wrapper and granular splitChunks groups
  (framework, three, charts, wallet, tensorflow, pyodide, monaco,
  framer-motion, stellar) so heavy vendor modules land in dedicated
  chunks instead of the initial page bundle.
- Introduce 'use client' page wrappers for the App Router /lab and
  /campus routes (LabClient.tsx, CampusClient.tsx) plus a layout-
  mirror skeleton (VirtualScienceLabSkeleton.tsx) so the heavy
  VirtualScienceLab and MetaverseCampus bundles are only fetched
  after hydration.
- Lazy-load the demo-features sections (AssessmentInterface,
  CredentialMarketplace, StakingDashboard, CredentialBridge), the
  /bci-dashboard top-level component, and the /ConsciousnessPage
  ConsciousnessUpload. Each uses next/dynamic with ssr:false plus
  a LoadingFallback placeholder.
- Standardise loading state for the in-place dynamics inside
  MetaverseCampus (CampusScene) and VirtualScienceLab (LabScene3D,
  LabReactionSim) onto the global LoadingFallback component so CLS
  across the app is consistent.
- Document the page-wrapper lazy-load pattern in
  lib/performance-optimization.ts.

Part of 'Implement Performance Optimization with Code Splitting and
Lazy Loading' (Closes AetherEdu#141).
- Create ErrorFallback.tsx with 4 error variants and Try Again button - Enhance ErrorBoundary.tsx with onError callback, resetKey prop, and monitoring logging - Create RootErrorBoundary for App Router layout with Toaster - Wrap layout.tsx in RootErrorBoundary for page-level error catching - Add toast notifications to WalletConnector for wallet/network errors - Add toast notifications to PaymentProcessor for payment/network errors - Fix jest config module mapping for stellar-wallets-kit stub - Fix ErrorBoundary test console suppression
…erEdu#117, AetherEdu#122)

Implements two issues in one change set, plus the minimal fix needed to
restore the contract build.

Build fix:
- Re-enable `pub mod user_profile;`. credentials.rs calls
  `crate::user_profile::add_credential`, but the module was commented out, so
  `cargo build --target wasm32v1-none --release` (and CI) failed on main. The
  module's `#[contract]` is already disabled and it only depends on the active
  utils::storage, so re-enabling restores the wasm build with no conflict.

AetherEdu#117 — Input validation guards:
- New shared module `utils/validation.rs` with a typed `ValidationError`
  (#[contracterror]) and reusable guards: string non-empty/length, positive and
  bounded u64, duration bounds, distinct addresses, and non-zero (burn) address.
  Includes a note on why "zero address" maps to the all-zero ed25519 account in
  Soroban, and unit tests for every validator.
- Applied across the active entry points before any state access: initialize,
  issue_credential, create_course (lib.rs); issue_credential_with_expiration,
  renew_credential (credential_registry.rs); mint_dynamic_nft, evolve_nft,
  fuse_nfts, transfer_nft (dynamic_nft.rs).

AetherEdu#122 — Attestation protocol:
- Replace the incomplete stub with a working free-function module
  (attestation_protocol.rs): register_attester, attest_credential,
  revoke_attestation, get_attestations, is_attested_by, get_attester,
  is_registered_attester, and admin-gated deactivate/reactivate_attester.
  Supports multiple attesters per credential and stores attester, timestamp,
  signature and metadata per attestation.
- Integrated into credential issuance flow via AetherMintContract wrappers in
  lib.rs and per-credential attestation-count tracking in credential_registry.rs.
- Full test suite: register, attest, verify, revoke, multi-attestation,
  duplicate/unregistered/inactive/non-existent failures, and unauthorized admin.

Notes:
- The modules listed in AetherEdu#117 that remain commented out in lib.rs
  (marketplace, vrf_system, tokenomics, time_lock_credential) are not part of
  the compiled contract, so validation was applied to all *active* entry points.
- A pre-existing, unrelated broken test build (orphaned *_test modules whose
  source modules are commented out) is left untouched; the new tests pass and
  the wasm release build is green.
…fline-first

feat(frontend): complete offline-first capabilities (closes AetherEdu#139)
…-138-accessibility-wcag-aa

feat(frontend): improve accessibility for WCAG AA
…plitting-issue-141

feat(frontend): code splitting & lazy-loading for AetherEdu#141
…ndaries-toast-notifications

feat(frontend): implement Error Boundaries with toast notifications
…estation-issues-117-122

feat(contracts): input validation guards + attestation protocol (AetherEdu#117, AetherEdu#122)
…tics-dashboard-ui-143

feat: implement comprehensive admin analytics dashboard with real-tim…
…etherEdu#142)

Resolves both issues assigned to @MicD746.

- AetherEdu#145 Add Real-Time Collaboration Whiteboard Persistence

  * Redis-backed session store (WhiteboardSessionStore) with in-memory fallback

  * Per-id mutex serialises concurrent saves; HTTP 409 surfaces serverOps on stale baseVersion

  * Read-only share tokens with 30-day TTL; /whiteboard/shared?token=... viewer

  * Frontend useWhiteboardPersistence hook (30s auto-save + manual save + share)

  * WhiteboardSessionList, WhiteboardShareDialog, WhiteboardSharedViewer components

  * PNG + SVG export helpers, deterministic op replay (drawOps)

- AetherEdu#142 Complete Internationalization (i18n) with Translation Coverage

  * New whiteboard.json namespace (en/es/fr), wired into next-i18next.config.js

  * New errors.json + validation namespaces (en/es), wired into next-i18next.config.js

  * fr/common.json completed (was missing language/header/footer/index)

  * i18nFormat helpers: formatCurrency / formatDate / formatNumber / formatRelativeTime

  * Locale-aware Intl.* over the active i18next language; Arabic RTL exercised

- Tests

  * backend whiteboardSessionStore + whiteboardSessionController (roundtrip, conflict, concurrency, share)

  * frontend i18nFormat + whiteboardExport (Intl formatters, RTL helpers, SVG geometry, escape)

- PR_DESCRIPTION.md contains the full PR body and DoD checklists.
- create_checkpoint(label): snapshots current DNA credential IDs with
  timestamp, data_size, and FNV hash; auto-verifies integrity on capture
- restore_checkpoint(id): verifies hash then removes post-checkpoint
  credentials and resets count
- list_checkpoints(): returns all CheckpointMeta in creation order
- delete_checkpoint(id): admin-only removal of checkpoint data
- verify_integrity(): scans all DNA credentials, returns IntegrityReport
  with valid/invalid counts and is_healthy flag
- MAX_CHECKPOINTS = 10 enforced on create
- Public contract entry points exposed in lib.rs (admin-auth guarded)
- Test coverage: create, restore, list, delete, max limit, metadata
  fields, integrity check, roundtrip no-data-loss
- New Migrator class with up/down/status commands
- Advisory lock prevents concurrent migration execution
- _migrations table tracks history including failures
- Migrations run inside database transactions
- Converted migration 001 from knex to raw pg SQL
- Added npm scripts: migrate:up, migrate:down, migrate:status
- Optional auto-run on startup via AUTO_MIGRATE env var
…y-states

Files Changed
ErrorBoundary.tsx — uses ErrorDisplay with retry + collapsible error details
Profile/ProfileHeader.tsx — loading prop renders SkeletonProfile
Discovery/CourseGrid.tsx — skeleton loading, error with retry, empty state with clear-filters CTA
CredentialList.tsx — EmptyState with "Add Credential" CTA in compact and full views
AchievementDisplay.tsx — EmptyState with "Clear filters" CTA in compact and full views
Analytics/ProgressChart.tsx — skeleton loading, error retry, empty state
Analytics/CompletionStats.tsx — skeleton loading, error retry, empty state
Analytics/TimeAnalysis.tsx — skeleton loading, error retry, empty state
app/demo/page.tsx — error banner, skeleton loading, ErrorBoundary wrapper
app/campus/page.tsx — WebGL detection for unsupported empty state, skeleton via dynamic import, error display
app/profile/page.tsx — SkeletonProfile, ErrorDisplay, EmptyState replace inline states
Definition of Done
 Reusable Skeleton component with variants (text, card, list, profile)
 Reusable EmptyState with icon, message, optional CTA
 Reusable ErrorDisplay with retry and details toggle
 Every listed page shows loading, error, and empty states
 Error states include actionable Try Again buttons
 Empty states include next-step guidance
 Loading skeletons match approximate layout (no layout shift)
 Responsive design maintained across all states
Closed AetherEdu#136
jobbykings and others added 30 commits July 28, 2026 09:21
- courseController.ts: Added next: NextFunction param to all handler functions
- errors.ts: ForbiddenError now accepts optional details parameter
- security.ts: Fixed read-only details assignment via constructor
- sanitizer.ts: Cast req as any for file/files multer properties
- assignmentController.ts: Cast req.files as any
- contentController.ts: Cast req.file properties as any
- upload.ts: Added @ts-ignore for multer type compatibility
- fileUploadService.ts: Replaced Express.Multer.File with any
- index.ts: Added @ts-ignore for sanitizeMiddleware import
- courseController.ts: Added next: NextFunction param to all handler functions
- errors.ts: ForbiddenError now accepts optional details parameter
- security.ts: Fixed read-only details assignment via constructor
- sanitizer.ts: Cast req as any for file/files multer properties
- assignmentController.ts: Cast req.files as any
- contentController.ts: Cast req.file properties as any
- upload.ts: Added @ts-ignore for multer type compatibility
- fileUploadService.ts: Replaced Express.Multer.File with any
- index.ts: Added @ts-ignore for sanitizeMiddleware import
…onents

Adds comprehensive test coverage for previously untested components:
- UI: Card, Badge
- Shared: Skeleton, ErrorBoundary/ErrorFallback, ProfileStats, EnrollmentForm
- Wallet: SecurityWarning, TransactionDemo
- Quiz: Timer, Results, QuestionCard, QuizPlayer
- Chat: ChatMessage, ChatInput, ChatSettings, TypingIndicator
- PWA: InstallPrompt, PWAClientShell

All tests follow existing patterns: React Testing Library with
userEvent, mocked external deps, and coverage of rendering,
interactions, error states, and accessibility.
- NotificationItem: rendering, read/unread states, priority, timestamps
- PreferencesPanel: category toggles, quiet hours, enabled/disabled states
- NotificationCenter: bell button, badge count, dropdown, filters, preferences
- EnrollmentFlow: step navigation, pricing, progress, prerequisites
- EnrollmentConfirmation: success header, badges, payment info, actions
- CredentialMarketplace.tsx: removed orphaned </ErrorBoundary> and extra paren
- WalletConnector.tsx: fixed ErrorBoundary/div closing tag order
- CredentialList.tsx: fixed ErrorBoundary/div closing tag order
- EnrollmentForm.tsx: added missing </ErrorBoundary>, removed orphaned one
…lippy)

Frontend:
- Remove orphaned </ErrorBoundary> and extra ); from CredentialMarketplace
- Fix ErrorBoundary/div closing tag order in enroll/[courseId]/page.tsx

Contracts:
- Remove unused MAX_SHORT_TEXT_LENGTH import
- Remove semicolons preventing return in get_profile_nft and owner_of
- Add turbofish annotations for never type fallback compatibility
- Replace symbol_short with Symbol::new for 'unverified'
Add URL-based API versioning middleware (apiVersion.ts). Mount all routes under /api/v1/ with X-API-Version response header. Add Sunset, Deprecation, and Link headers on legacy /api/ routes. Add /api/version endpoint. Define 6-month backward compatibility period. Add version negotiation documentation and tests.
…k-pr-checkout

Fix ci allow fork pr checkout
…atabase-indexing

feat(backend): implement comprehensive database indexing strategy (AetherEdu#168)
…timization

ci: speed up pipeline with parallel job execution and caching
…e-budget-check

perf(frontend): add gzipped first-load JS budget check and CI
…aching-offline-first

[Frontend] Optimize service worker caching strategy for offline-first experience
…e-and-scan-282

ci(docker): build images, enforce size budget, and scan final images with Trivy
…se-mechanism

fix(contracts): add pause/unpause mechanism across all contracts (AetherEdu#253)
…oxy-delegate-246

feat: implement upgradeable contract pattern using Soroban proxy delegates
…ent-guide-251

docs: create local development guide for Soroban contract iteration
…enomics-tests

test: add integration test suite for tokenomics distribution
…g-strategy

fix: AetherEdu#263 - Implement multi-tier caching strategy for read endpoints
…zation-middleware

fix: AetherEdu#265 - Add enhanced file upload validation to complement existing sanitizer
…-coverage-to-70

[Frontend] Increase component unit test coverage to 70%
…rategy

feat: implement API versioning strategy with deprecation headers
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.