Heimdall Gitea / Detect CI scope (push) Successful in 6s
Heimdall Gitea / Build and tests (push) Successful in 19m19s
Heimdall Gitea / Publish versioned release (push) Skipped
Heimdall Gitea / Build and scan server image (push) Successful in 6m13s
Heimdall Gitea / Build and scan agent image (push) Successful in 14m44s
Heimdall Gitea / Publish Docker Hub latest tags (push) Successful in 1m48s
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Successful in 19m9s
Heimdall Gitea / CI policy (push) Successful in 10s
Merge pull request #138 Co-authored-by: Arnaud Dartois <admin@tordais.cc>
2.8 KiB
2.8 KiB
name, description
| name | description |
|---|---|
| ef-core-persistence | Implement or review database persistence in Heimdall with Entity Framework Core, including SQLite Agent stores and PostgreSQL behavior. |
Heimdall EF Core persistence
Use this skill whenever changing how application or Agent data is read or written.
- Use EF Core LINQ and entity configurations for CRUD. Prefer projections, bounded result sets, asynchronous APIs, and
CancellationToken; useAsNoTrackingfor read-only entity queries. - Create a short-lived
DbContextper operation. Hosted services and concurrent workers should useIDbContextFactory<TContext>and dispose each context; never share a context across parallel work. - Evolve schemas through reviewed EF Core migrations. Preserve deployed data and test upgrades from every supported on-disk schema, including Agent-local SQLite outboxes.
- Verify PostgreSQL translation, transaction boundaries, concurrency and deletion semantics against PostgreSQL integration tests when those behaviors matter. Do not use EF InMemory as proof of relational behavior.
- Do not issue CRUD through ADO.NET or hand-written SQL. Raw SQL through EF is an exception for database-specific capabilities that LINQ cannot express or for measured performance needs. Keep it parameterized, add an adjacent
EF Core exception:comment with the reason, and add a test for its behavior. - Migrations, test database setup, PostgreSQL maintenance/partition DDL, and locks with no portable EF equivalent are valid exceptions. Keep provider-specific code in Infrastructure or a dedicated adapter; do not spread it into use cases.
- When adding an approved raw EF operation, add its exact source path and a short capability rationale to
scripts/ci/check-efcore-usage.py'sEF_CORE_EXCEPTIONSallowlist, keep an adjacentEF Core exception:comment, and cover the behavior with a relational test. The scanner intentionally ignores comments when locating a call; a comment alone does not allowlist a new production source. - Never enable sensitive-data logging in production. Do not log connection strings or persisted secret values.
Before editing, inspect this repository's AGENTS.md, todo.md, model configuration, latest migration, and callers. After editing, run the relevant suite and CI persistence policy check, then update the corresponding TODO item with evidence and remaining deployment checks.