Update docs, sprint plans, and compose configuration
Add 12 new sprint files (Integrations, Graph, JobEngine, FE, Router, AdvisoryAI), archive completed scheduler UI sprint, update module architecture docs (router, graph, jobengine, web, integrations), and add Gitea entrypoint script for local dev. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# Database Coding Rules
|
||||
|
||||
**Version:** 1.0.0
|
||||
**Version:** 1.1.1
|
||||
**Status:** APPROVED
|
||||
**Last Updated:** 2025-11-28
|
||||
**Last Updated:** 2026-04-05
|
||||
|
||||
---
|
||||
|
||||
@@ -119,6 +119,56 @@ public sealed class SchedulerDataSource : IAsyncDisposable
|
||||
}
|
||||
```
|
||||
|
||||
### 2.1.1 Runtime Data Source Attribution
|
||||
|
||||
**RULE:** Every runtime `NpgsqlDataSource` MUST set a stable PostgreSQL `application_name`.
|
||||
|
||||
```csharp
|
||||
// ✓ CORRECT
|
||||
var connectionStringBuilder = new NpgsqlConnectionStringBuilder(options.ConnectionString)
|
||||
{
|
||||
ApplicationName = "stellaops-policy"
|
||||
};
|
||||
var dataSource = new NpgsqlDataSourceBuilder(connectionStringBuilder.ConnectionString).Build();
|
||||
|
||||
// ✓ CORRECT - shared infrastructure path
|
||||
var connectionString = PostgresConnectionStringPolicy.Build(options, "stellaops-policy");
|
||||
var dataSource = new NpgsqlDataSourceBuilder(connectionString).Build();
|
||||
|
||||
// ✗ INCORRECT - anonymous session attribution
|
||||
var dataSource = NpgsqlDataSource.Create(options.ConnectionString);
|
||||
```
|
||||
|
||||
**RATIONALE:** Anonymous PostgreSQL sessions make runtime triage and CPU/churn attribution materially harder. `application_name` is mandatory for steady-state service code.
|
||||
|
||||
### 2.1.2 Runtime Data Source Construction
|
||||
|
||||
**RULE:** Runtime services MUST reuse a singleton/module-scoped `NpgsqlDataSource` or a module DataSource wrapper. Ad hoc `NpgsqlDataSource.Create(...)` is forbidden in steady-state service code.
|
||||
|
||||
Allowed exceptions:
|
||||
- tests and fixtures
|
||||
- migration runners and schema bootstrap hosts
|
||||
- CLI/admin/setup commands
|
||||
- one-shot diagnostics explicitly documented in the sprint
|
||||
|
||||
```csharp
|
||||
// ✓ CORRECT
|
||||
services.AddSingleton<MyModuleDataSource>();
|
||||
services.AddScoped<IMyRepository, PostgresMyRepository>();
|
||||
|
||||
// ✗ INCORRECT
|
||||
public async Task<Item?> GetAsync(CancellationToken ct)
|
||||
{
|
||||
await using var dataSource = NpgsqlDataSource.Create(_connectionString);
|
||||
await using var conn = await dataSource.OpenConnectionAsync(ct);
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
**RULE:** Raw `new NpgsqlConnection(...)` is forbidden in steady-state runtime code unless the call site is an explicit allowlisted exception (CLI/setup, migrations, diagnostics, or a sprint-documented blocker).
|
||||
|
||||
**RULE:** When a module cannot yet move off raw `NpgsqlConnection`, its connection string MUST still flow through a stable `ApplicationName`, and the exception MUST be called out in sprint Decisions & Risks.
|
||||
|
||||
### 2.2 Connection Disposal
|
||||
|
||||
**RULE:** All NpgsqlConnection instances MUST be disposed via `await using`.
|
||||
@@ -881,5 +931,5 @@ These rules are enforced by:
|
||||
|
||||
---
|
||||
|
||||
*Document Version: 1.0.0*
|
||||
*Last Updated: 2025-11-28*
|
||||
*Document Version: 1.1.1*
|
||||
*Last Updated: 2026-04-05*
|
||||
|
||||
Reference in New Issue
Block a user