# Project plan — task-ledger-api

Evidence date: 2026-10-01.

Source repository: `git@bitbucket.org:overdrive/task-ledger-api.git`.

Inspected revision: `main` at `8ab244e` (2026-01-03, maanie, "fix: update connection string to use LocalDB and add retry logic"). The scan-host path `~/projects/sonar_scan/repos/task-ledger-api` was not on this machine. The tree below was read from that git revision.

This plan describes what the repository contains. It does not decide what the product should become.

There is no README, product brief, or issue tracker in the source repository, and there was no prior Silicon Ark set for this directory. `cursor.rules.md` is a coding-agent instruction file, not a product plan. Where a commit message describes work that no source file contains, the source file is the implemented behaviour.

## Product

**Inferred** from the solution name `TaskLedger.Api`, the entity comment "a task entity in the TaskLedger system", and the two HTTP operations that create and list tasks.

What the code actually does is an ASP.NET Core Web API on .NET 8 that stores tasks in SQL Server through Entity Framework Core. A caller can create a task and can list every task. The stored row has a completion flag. No operation sets that flag.

No written statement of product purpose, owner, audience, or deployment target was found.

## Branch reality

| Line | Tip | Date | What it is |
|---|---|---|---|
| `main` (default; `origin/HEAD`) | `8ab244e` | 2026-01-03 | Current tree. LocalDB connection string and SQL retry |
| `development` | `8ab244e` | 2026-01-03 | Same commit as `main` |
| `feature/ef-core` | `0c1c087` | 2026-01-02 | Ancestor of `main`. No commits that `main` lacks |
| `feature/task-service` | `0c1c087` | 2026-01-02 | Same tip as `feature/ef-core` |

Nothing in git is dated after 2026-01-03. Whether the API is running anywhere is **Unknown / Requires Confirmation**.

| Commit | Date | Author | Subject |
|---|---|---|---|
| `e12e94a` | 2026-01-01 | maanie | chore: initial project setup with EF Core packages |
| `310c137` | 2026-01-01 | maanie | feat: add EF Core support with SQL Server and Task entity |
| `22a5d61` | 2026-01-01 | maanie | feat: implement Task repository and service layer |
| `98c614a` | 2026-01-01 | maanie | feat: introduce service layer for tasks |
| `8f0658b` | 2026-01-01 | maanie | feat: enhance task management with additional service methods |
| `a7a3fa1` | 2026-01-02 | maanie | Add .gitignore for .NET build artifacts |
| `bfb72e9` | 2026-01-02 | maanie | Remove obj build artifacts from source control |
| `9d51d05` | 2026-01-02 | maanie | Merge feature/task-service into development |
| `dfb6a3a` | 2026-01-02 | maanie | Remove obj and bin folders from source control |
| `5cb931a` | 2026-01-02 | maanie | Remove build artifacts from Git |
| `88a7add` | 2026-01-02 | maanie | Add .gitignore to ignore build artifacts |
| `3b07ed4` | 2026-01-02 | Abdurahmaan Ismail | Merged development into main |
| `0c1c087` | 2026-01-02 | maanie | Merge development into main |
| `8ab244e` | 2026-01-03 | maanie | fix: update connection string to use LocalDB and add retry logic |

Git author email on the maanie commits is `maanie@overdrive.co.za`. Thirteen commits are by maanie. One merge commit is by Abdurahmaan Ismail.

## Objectives

No objectives file exists. The behaviour the commits introduced, checked against the files they changed:

1. `e12e94a` — .NET 8 web project, test project, `cursor.rules.md`, weather-forecast template endpoint, `Task` entity with `CreatedAt` and `UpdatedAt`, `TaskLedgerDbContext`, migration `20260101145453_InitialCreate`. Build outputs were committed with the source.
2. `310c137` — Context renamed to `AppDbContext`. `UpdatedAt` removed. `CreatedAt` renamed to `CreatedUtc`. Migration replaced by `20260101150955_InitialCreate` and idempotent `Migrations/InitialCreate.sql`.
3. `22a5d61` — Message says a `TaskRepository` and `TaskService` were added. The diff only changes generated assembly-info files under `obj/`. No repository class exists in any commit. **Discrepancy.**
4. `98c614a` — `ITaskService`, `TaskService`, `TasksController`, and `TaskServiceTests` added. Create and list only.
5. `8f0658b` — Message says `UpdateTaskAsync` and `DeleteTaskAsync` were added, with tests. The diff only deletes `bin/` outputs. Those method names do not appear in any `.cs` file in history. **Discrepancy.**
6. `a7a3fa1` through `88a7add` — `.gitignore` for `bin/`, `obj/`, and Visual Studio user files. Build artifacts removed from the tree.
7. `8ab244e` — Connection string changed from `Server=localhost` to SQL Server LocalDB. Same string added to `appsettings.Development.json`. `EnableRetryOnFailure` added (5 attempts, 30 second max delay).

## Scope

### In scope of `main` at `8ab244e`

- Solution `TaskLedger.Api.sln` (Visual Studio 17): projects `TaskLedger.Api` and `TaskLedger.Api.Tests`.
- HTTP API: `POST /api/Tasks` and `GET /api/Tasks`, plus the template `GET /weatherforecast`.
- SQL Server database `TaskLedgerDb` via connection string `DefaultConnection`. Both committed appsettings files point at `(localdb)\mssqllocaldb` with Windows trusted connection.
- EF Core model: table `Tasks` (`Id`, `Title`, `Description`, `IsCompleted`, `CreatedUtc`).
- One idempotent SQL script, `TaskLedger.Api/Migrations/InitialCreate.sql`. Startup does not apply it.
- xUnit tests for `TaskService` against the EF Core in-memory provider. One empty template test remains.
- `cursor.rules.md` constraints for whoever edits this repository.

### Out of scope of this tree

- Update, delete, get-by-id, or mark-complete operations. Claimed in the `8f0658b` message and absent from source.
- A repository class. Claimed in the `22a5d61` message and absent from source.
- Authentication, users, roles, or task ownership.
- A client application. None is in this repository.
- Deployment, CI, containers, health checks, queues, or monitoring configuration.
- `sonar-project.properties` and `sonarqube_scan.bat`. The 2026-09-28 discovery snapshot listed them beside the solution. They are not in git at `8ab244e` and do not appear in any commit. **Unknown / Requires Confirmation** whether they exist only as untracked files on the scan host.

## Architecture

```text
HTTP caller
    |
    |  POST /api/Tasks , GET /api/Tasks
    v
TasksController          (also GET /weatherforecast, no task data)
    |
    v
TaskService              (title required, trim, CreatedUtc = UtcNow, IsCompleted = false)
    |
    v
AppDbContext             (EF Core 8, SQL Server, retry on failure)
    |
    v
SQL Server LocalDB       database TaskLedgerDb, table Tasks
```

Swagger UI is registered only when the environment is Development. HTTPS redirection is always on. No authentication middleware is registered.

## Dependencies known from the repository

| Dependency | Where | Role |
|---|---|---|
| .NET 8 (`net8.0`) | both `.csproj` files | Runtime |
| ASP.NET Core | `Microsoft.NET.Sdk.Web` | HTTP host |
| Entity Framework Core 8.0.0 | API project | ORM |
| EF Core SQL Server 8.0.0 | API project | SQL Server provider |
| EF Core Tools 8.0.0 | API project, private assets | Migration design-time tools |
| Swashbuckle.AspNetCore 6.4.0 | API project | Swagger |
| Microsoft.AspNetCore.OpenApi 8.0.5 | API project | OpenAPI metadata on the weather endpoint |
| SQL Server LocalDB | connection strings | Database. Not created by this repo at startup |
| xUnit 2.5.3 | test project | Tests |
| EF Core InMemory 8.0.0 | test project | Test database |
| Moq 4.20.72 | test project | Referenced. No test file uses it |
| coverlet.collector 6.0.0 | test project | Coverage collector. No threshold or CI job uses it |
| Microsoft.NET.Test.Sdk 17.8.0 | test project | Test host |

No NuGet lock file is committed. No `Dockerfile`, `bitbucket-pipelines.yml`, or other pipeline file is in the tree.

## Current status

Implemented and present on `main`: create a task, list tasks ordered by `CreatedUtc`, persist them to SQL Server, generate an idempotent create-table script, retry transient SQL failures, and unit-test the service.

Not implemented, despite commit messages: repository layer, update, delete.

Not present: README, authentication, completion workflow, deployment, CI.

Last source change is 2026-01-03. Activity after that date is **Unknown / Requires Confirmation**.

## Implementation notes that are process rules, not product milestones

`cursor.rules.md` tells a coding agent to keep SQL Server local, never apply migrations automatically, generate idempotent scripts, avoid `DROP DATABASE` and `TRUNCATE`, require unit tests, use conventional commits, and open pull requests instead of pushing to `main`. The running API does not enforce those process rules. The git history does contain merge commits into `main`. Whether those merges went through pull requests is **Unknown / Requires Confirmation**.
