Skip to content

feat(ensi): T-004 — SurrealDB 3.0 embedded init + SCHEMAFULL schema (Week 1)#74

Closed
renatobardi wants to merge 1 commit intomainfrom
agent/backend-dev/e4ee5296
Closed

feat(ensi): T-004 — SurrealDB 3.0 embedded init + SCHEMAFULL schema (Week 1)#74
renatobardi wants to merge 1 commit intomainfrom
agent/backend-dev/e4ee5296

Conversation

@renatobardi
Copy link
Copy Markdown
Owner

Story

REN-16 / T-004: ensi-db — SurrealDB 3.0 embedded init + SCHEMAFULL schema

Includes prerequisites T-001/T-002/T-003 (no prior implementation existed).

What was implemented

T-001 — Cargo workspace scaffold

  • ensi/Cargo.toml workspace manifest with 8 member crates and shared [workspace.dependencies]
  • Stub Cargo.toml + entry files for all 8 crates (ensi-core, ensi-db, ensi-events, ensi-pipeline, ensi-server, ensi-daemon, ensi-frontend, ensi-cli)
  • .env.example and .gitignore

T-002 — ensi-core: domain entities

  • 12 domain structs: Workspace, Member, Agent, Project, Issue, PipelineState, Task, TaskMessage, Artifact, Comment, Pat, DaemonToken
  • CoreError enum via thiserror
  • No external deps (pure types as spec requires)

T-003 — ensi-core: port traits

  • 14 async traits: IssueRepository, ProjectRepository, WorkspaceRepository, MemberRepository, AgentRepository, TaskRepository, ArtifactRepository, PipelineRepository, EventPublisher, AgentExecutor, ArtifactStore, DaemonTokenRepository, PatRepository, CommentRepository
  • All return Result<_, CoreError>

T-004 — ensi-db: SurrealDB 3.0 embedded init + schema

  • DbClient::connect(DbConfig) — opens SurrealDB 3.0 embedded (kv-surrealkv) at ~/ensi_data/
  • DbConfig::from_env() — reads ENSI_DATA_PATH, ENSI_DB_USER, ENSI_DB_PASS
  • Idempotent migration runner via _migration table
  • V001__initial_schema.surql — SCHEMAFULL schema for all 12 tables with field assertions, indexes, and constraints matching the architecture spec
  • DbClient::health_check() — called at boot, panics on failure (unrecoverable startup error)

Acceptance criteria coverage

  • SurrealDB 3.0 initializes in embedded mode at ~/ensi_data/
  • SCHEMAFULL schema for all 12 tables defined
  • Startup passes without errors (cargo check, cargo test)
  • DB health check on boot

Tests

3 integration tests in ensi-db:

  1. test_db_connect_and_health_check — connect + health check roundtrip
  2. test_migrations_are_recorded_once — migration table has exactly 1 entry after init
  3. test_schema_defines_all_12_tablesINFO FOR TABLE succeeds for all 12 tables

All pass: cargo test -p ensi-db → 3 passed, 0 failed.

…ain/ports + ensi-db SurrealDB embedded init

- T-001: Cargo workspace with 8 crates (ensi-core, ensi-db, ensi-events, ensi-pipeline,
  ensi-server, ensi-daemon, ensi-frontend, ensi-cli) and shared workspace.dependencies
- T-002: ensi-core domain entities — Workspace, Member, Agent, Project, Issue,
  PipelineState, Task, TaskMessage, Artifact, Comment, PAT, DaemonToken
- T-003: ensi-core port traits — IssueRepository, ProjectRepository, WorkspaceRepository,
  MemberRepository, AgentRepository, TaskRepository, ArtifactRepository, PipelineRepository,
  EventPublisher, AgentExecutor, ArtifactStore, DaemonTokenRepository, PatRepository, CommentRepository
- T-004: ensi-db SurrealDB 3.0 embedded init (~/ensi_data/ via kv-surrealkv),
  SCHEMAFULL schema for all 12 tables, idempotent migration runner via _migration table,
  DB health check on boot. Integration tests: connect+healthcheck, migration recorded once,
  all 12 tables present in schema. cargo check passes with zero warnings.
@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant