Feature: Rename BoardItemType 'issue' to 'ticket' -- enum, schema, routes, migration #229

Open
opened 2026-03-28 04:00:26 +00:00 by forgejo_admin · 0 comments

Type

Feature

Lineage

Child of forgejo_admin/claude-custom#181 (parent decomposition ticket).
Deploy order: A of 4 -- this ships first. SDK (B), MCP (C), and hooks (D) depend on this.

Repo

forgejo_admin/pal-e-api

User Story

As a platform developer,
I want BoardItemType.ticket instead of BoardItemType.issue,
So that board items are semantically distinct from Forgejo issues and note-type "issue" tags.

Context

The BoardItemType enum uses issue as a value, but this collides with two other meanings: Forgejo issues (the ticket tracker) and the issue note type. The rename to ticket resolves this ambiguity across the full stack. This is the API-layer change that all downstream consumers (SDK, MCP, hooks) depend on.

The enum is stored as a non-native string column (Enum(BoardItemType, native_enum=False, length=20)), so the Alembic migration is a simple UPDATE on string values -- no Postgres enum ALTER needed.

During the transition period, the API must accept both "issue" and "ticket" so downstream consumers are not broken before they update.

File Targets

Files the agent should modify or create:

  • src/pal_e_docs/models.py line 37 -- rename issue = "issue" to ticket = "ticket"
  • src/pal_e_docs/schemas.py line 232 -- update BoardItemTypeType Literal to replace "issue" with "ticket"
  • src/pal_e_docs/routes/boards.py lines 131, 137, 372, 488, 564, 570, 643 -- all BoardItemType.issue references become BoardItemType.ticket
  • src/pal_e_docs/routes/boards.py validation endpoints (~lines 131, 564) -- add transition alias: accept "issue" as input, map to BoardItemType.ticket, log deprecation
  • New: alembic/versions/XXX_rename_board_item_type_issue_to_ticket.py -- UPDATE board_items SET item_type='ticket' WHERE item_type='issue'
  • tests/test_boards.py -- ~20 references to item_type="issue" in fixtures and assertions
  • tests/test_board_issue_sync.py -- ~7 references to item_type="issue" in query params and assertions
  • tests/test_pagination_activity.py line 49 -- "item_type": "issue"
  • New test: verify transition alias works (send "issue", get "ticket" back)

Files the agent should NOT touch:

  • src/pal_e_docs/routes/notes.py line 50 -- NoteType status map, not BoardItemType
  • tests/test_note_type_enum.py -- NoteType enum, not BoardItemType
  • tests/test_note_decomposition.py -- NoteType references, not BoardItemType
  • tests/test_template_renderer.py -- NoteType badge color map, not BoardItemType

Acceptance Criteria

  • BoardItemType.ticket is the canonical enum value in models.py
  • BoardItemTypeType Literal in schemas.py uses "ticket"
  • All BoardItemType.issue references in routes/boards.py are updated
  • Alembic migration converts all existing issue rows to ticket
  • API accepts both "issue" and "ticket" during transition
  • All existing tests pass with "ticket" substituted
  • alembic upgrade head succeeds on fresh and existing databases

Test Expectations

  • Unit test: all test_boards.py tests pass with "ticket" as the item_type
  • Unit test: all test_board_issue_sync.py tests pass with "ticket"
  • Unit test: new test sends item_type="issue" and verifies API accepts it and returns "ticket"
  • Integration test: alembic upgrade head then alembic downgrade -1 round-trips cleanly
  • Run command: pytest tests/test_boards.py tests/test_board_issue_sync.py tests/test_pagination_activity.py -v

Constraints

  • Non-native enum (string column) -- no Postgres ALTER TYPE needed, just UPDATE on data
  • Transition alias must map "issue" -> BoardItemType.ticket at the route validation layer, not in the enum itself
  • Do not add issue as a second enum member -- that defeats the purpose

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • Alembic migration reviewed
  • forgejo_admin/claude-custom#181 -- parent decomposition ticket
  • pal-e-docs -- project this affects
### Type Feature ### Lineage Child of `forgejo_admin/claude-custom#181` (parent decomposition ticket). Deploy order: **A of 4** -- this ships first. SDK (B), MCP (C), and hooks (D) depend on this. ### Repo `forgejo_admin/pal-e-api` ### User Story As a platform developer, I want `BoardItemType.ticket` instead of `BoardItemType.issue`, So that board items are semantically distinct from Forgejo issues and note-type "issue" tags. ### Context The `BoardItemType` enum uses `issue` as a value, but this collides with two other meanings: Forgejo issues (the ticket tracker) and the `issue` note type. The rename to `ticket` resolves this ambiguity across the full stack. This is the API-layer change that all downstream consumers (SDK, MCP, hooks) depend on. The enum is stored as a non-native string column (`Enum(BoardItemType, native_enum=False, length=20)`), so the Alembic migration is a simple `UPDATE` on string values -- no Postgres enum ALTER needed. During the transition period, the API must accept both `"issue"` and `"ticket"` so downstream consumers are not broken before they update. ### File Targets Files the agent should modify or create: - `src/pal_e_docs/models.py` line 37 -- rename `issue = "issue"` to `ticket = "ticket"` - `src/pal_e_docs/schemas.py` line 232 -- update `BoardItemTypeType` Literal to replace `"issue"` with `"ticket"` - `src/pal_e_docs/routes/boards.py` lines 131, 137, 372, 488, 564, 570, 643 -- all `BoardItemType.issue` references become `BoardItemType.ticket` - `src/pal_e_docs/routes/boards.py` validation endpoints (~lines 131, 564) -- add transition alias: accept `"issue"` as input, map to `BoardItemType.ticket`, log deprecation - New: `alembic/versions/XXX_rename_board_item_type_issue_to_ticket.py` -- `UPDATE board_items SET item_type='ticket' WHERE item_type='issue'` - `tests/test_boards.py` -- ~20 references to `item_type="issue"` in fixtures and assertions - `tests/test_board_issue_sync.py` -- ~7 references to `item_type="issue"` in query params and assertions - `tests/test_pagination_activity.py` line 49 -- `"item_type": "issue"` - New test: verify transition alias works (send `"issue"`, get `"ticket"` back) Files the agent should NOT touch: - `src/pal_e_docs/routes/notes.py` line 50 -- NoteType status map, not BoardItemType - `tests/test_note_type_enum.py` -- NoteType enum, not BoardItemType - `tests/test_note_decomposition.py` -- NoteType references, not BoardItemType - `tests/test_template_renderer.py` -- NoteType badge color map, not BoardItemType ### Acceptance Criteria - [ ] `BoardItemType.ticket` is the canonical enum value in `models.py` - [ ] `BoardItemTypeType` Literal in `schemas.py` uses `"ticket"` - [ ] All `BoardItemType.issue` references in `routes/boards.py` are updated - [ ] Alembic migration converts all existing `issue` rows to `ticket` - [ ] API accepts both `"issue"` and `"ticket"` during transition - [ ] All existing tests pass with `"ticket"` substituted - [ ] `alembic upgrade head` succeeds on fresh and existing databases ### Test Expectations - [ ] Unit test: all `test_boards.py` tests pass with `"ticket"` as the item_type - [ ] Unit test: all `test_board_issue_sync.py` tests pass with `"ticket"` - [ ] Unit test: new test sends `item_type="issue"` and verifies API accepts it and returns `"ticket"` - [ ] Integration test: `alembic upgrade head` then `alembic downgrade -1` round-trips cleanly - Run command: `pytest tests/test_boards.py tests/test_board_issue_sync.py tests/test_pagination_activity.py -v` ### Constraints - Non-native enum (string column) -- no Postgres `ALTER TYPE` needed, just `UPDATE` on data - Transition alias must map `"issue"` -> `BoardItemType.ticket` at the route validation layer, not in the enum itself - Do not add `issue` as a second enum member -- that defeats the purpose ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes - [ ] Alembic migration reviewed ### Related - `forgejo_admin/claude-custom#181` -- parent decomposition ticket - `pal-e-docs` -- project this affects
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/pal-e-api#229
No description provided.