Saltar a contenido

Goals

Measurable success criteria for the CyberEco Hub Data Layer. Each goal has a clear pass/fail test.

Build & Quality

  • All 4 packages build successfully from a clean clone: npm ci && npm run build
  • All packages pass type checking: npm run type-check returns zero errors
  • All tests pass: npm run test with no Firebase emulators required
  • Zero any types in public API signatures (enforced by ESLint rule)
  • All public functions and interfaces have JSDoc documentation
  • Bundle analysis: @cyber-eco/types adds 0 bytes to a production build (types-only)

Architecture

  • @cyber-eco/services has zero imports from firebase/* — verified by grep -r "firebase" packages/services/src/ returning no results
  • MockStorageAdapter enables full test coverage of all domain services without Firebase emulators or network calls
  • createDataLayer() factory produces a fully wired data layer instance with a single function call
  • The DataLayerService orchestrator correctly executes: permission check -> cache lookup -> adapter fetch -> cache set -> return (for reads) and permission check -> adapter write -> cache invalidate -> sync broadcast -> webhook emit (for writes)
  • All domain services (SharedData, Permission, Dashboard, Export, Notification) receive IDataLayerService via constructor injection — no module-level state

Test Coverage

  • @cyber-eco/services core services: >90% line coverage
  • @cyber-eco/services domain services: >80% line coverage
  • @cyber-eco/firebase adapter: >80% line coverage (with mocked Firebase)
  • @cyber-eco/auth utilities and services: >70% line coverage (migrated from existing tests)

Compatibility

  • The monorepo (cybereco-monorepo) can install the published packages and replace current libs/ imports with zero runtime behavior changes
  • Hub app builds and passes its existing test suite after migration
  • JustSplit app builds and passes its existing test suite after migration
  • Website app builds after migration (it has minimal data layer usage)

Developer Experience

  • A new developer can understand the architecture by reading docs/ARCHITECTURE.md alone
  • A new CyberEco app can integrate the data layer by following a 10-step guide in the README
  • npm run build completes in under 30 seconds on a modern machine (Turborepo caching)
  • Adding a new domain service requires creating one file and registering it in the factory — no other changes needed

Publishing

  • All 4 packages published to GitHub Packages under @cyber-eco scope
  • Changesets workflow: changeset -> version PR -> merge -> auto-publish works end-to-end
  • All packages share the same version number (fixed versioning)
  • Pre-release versions (0.x.0-alpha.N) can be published for testing

MCP Server

  • MCP server starts without errors: cd mcp-server && uv run cybereco-mcp
  • All 7 tools respond with valid JSON when invoked
  • All resources return documentation content
  • All prompts generate valid integration/debugging guides
  • MCP server can be installed via uvx --from ./mcp-server cybereco-mcp

Tokenomics (2027-2030)

  • CYE token specification complete with supply model, distribution, and vesting schedule
  • Governance model defined: quadratic voting, proposal lifecycle, quorum requirements
  • Incentive mechanisms specified: data hosting rewards, network healing, uptime staking, compute contribution
  • Fee structure defined with free tier and fee distribution model
  • Integration path documented: TokenizedStorageAdapter wrapping existing adapters

P2P & Multi-Network (2026-2030)

  • TransportAdapter interface defined in @cyber-eco/types
  • At least 2 transport implementations prototyped (WiFi Direct + Internet)
  • P2PStorageAdapter passes the same test suite as MockStorageAdapter
  • CRDT-based conflict resolution handles concurrent offline edits correctly
  • MultiTransportManager routes messages across available transports automatically
  • Store-and-forward delivers messages across network partitions

Encrypted Computation (2025-2030)

  • Phase A: Client-side AES-256-GCM encryption of sensitive fields via EncryptedStorageAdapter
  • Phase B: TEE-based permission evaluation on compatible hardware
  • Phase C: FHE batch analytics on encrypted financial data
  • Phase D: MPC protocol for private group expense splitting
  • Key management: per-user key hierarchy with secure storage on each platform