refactor: add TaskFlow.Contracts for error codes and enums

Open
#399 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
43/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp, docker

Research direction

Start by checking #398, which blocks this issue, then inspect TaskRuleErrors.cs, TaskItemsController, ToolGuard, and TaskFlow.Api/Dockerfile to confirm the existing error codes and project references. Review the API and MCP project files and deployment workflow to identify required changes. Done when the reflection test covers every code, the API image builds, npm run gen:api produces no unwanted changes, changes to TaskFlow.Contracts trigger API deployment, and plugin/bin contains no EF Core assemblies.

Written by the indexing model from the issue text.

Description

tech-debt

Part of #397. Blocked by #398.

Problem

The API has about 18 distinct machine-readable error codes (from a pattern search; confirm the list when centralising them). ToolGuard maps 5. Only 3 are in TaskRuleErrors.cs; others, such as TASK_START_NOT_ALLOWED, are defined in TaskItemsController. A new code reaches users with no specific guidance, and nothing flags it.

Scope

  • Add a TaskFlow.Contracts project at the repo root, referenced by TaskFlow.Api and TaskFlow.Mcp. It has no EF Core or ASP.NET dependencies.
  • Move every error code into it as a constant. Leave the response bodies in the API.
  • Move Status and Priority into it. Decide whether the MCP server adopts the enums or keeps strings, based on the size of that migration.
  • Add a reflection test: each code must be mapped in ToolGuard or appear on an explicit "no message needed" list.
  • Update TaskFlow.Api/Dockerfile to copy the new project before restore and publish.

Out of scope

Sharing DTOs and business rules such as IsBlockable.

Acceptance criteria

  1. Adding a new error code without a mapping or list entry fails a test.
  2. The API image builds, and the generated web client has no unwanted changes after npm run gen:api.
  3. A change to TaskFlow.Contracts deploys the API, because it sits outside the assistant/** ignore.
  4. plugin/bin contains no EF Core assemblies.
Dominant language
C#
Stars
1
Forks
0
Avg merge
2h 2m
Merged PRs (30d)
98

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nevridge/TaskFlow

All issues in nevridge/TaskFlow

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.