fix: remove 7 deprecated NoteTypes from enum #231

Merged
forgejo_admin merged 1 commit from 225-remove-deprecated-note-types into main 2026-03-28 04:13:19 +00:00

Summary

  • Remove 7 deprecated values from NoteType Literal and VALID_STATUSES: reference, incident, journal, post, todo, issue, milestone
  • Existing notes with old types remain queryable via GET (plain String column), but new creation/update is blocked by Pydantic validation
  • Plan and phase are FROZEN, not removed

Changes

  • src/pal_e_docs/schemas.py: Remove 7 values from NoteType Literal
  • src/pal_e_docs/routes/notes.py: Remove 7 entries from VALID_STATUSES dict
  • tests/test_note_type_enum.py: Rewrite with parametrized tests for removed types returning 422, legacy notes still queryable, frozen types still accepted
  • tests/test_note_decomposition.py: Remove issue/todo from valid_types and parametric status validation
  • tests/test_include_cold.py: Replace todo seed notes with phase/doc; insert legacy done-todo directly into DB for cold-status coverage
  • tests/test_blocks_compiled_pages.py: Replace todo with doc in parent-child hierarchy test
  • tests/test_board_sync.py: Replace todo with doc in non-phase child sync test

Test Plan

  • Tests pass locally -- 670 passed, 12 failed (pre-existing board_sync failures on main, unrelated)
  • Each removed type returns 422 on POST /notes and PUT /notes/{slug}
  • Legacy notes with old types queryable via GET /notes and GET /notes/{slug}
  • Plan and phase creation still works (frozen, not removed)
  • ruff format and ruff check pass clean

Review Checklist

  • Passed automated review-fix loop
  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #225
  • pal-e-api -- the project this work belongs to
## Summary - Remove 7 deprecated values from NoteType Literal and VALID_STATUSES: reference, incident, journal, post, todo, issue, milestone - Existing notes with old types remain queryable via GET (plain String column), but new creation/update is blocked by Pydantic validation - Plan and phase are FROZEN, not removed ## Changes - `src/pal_e_docs/schemas.py`: Remove 7 values from NoteType Literal - `src/pal_e_docs/routes/notes.py`: Remove 7 entries from VALID_STATUSES dict - `tests/test_note_type_enum.py`: Rewrite with parametrized tests for removed types returning 422, legacy notes still queryable, frozen types still accepted - `tests/test_note_decomposition.py`: Remove issue/todo from valid_types and parametric status validation - `tests/test_include_cold.py`: Replace todo seed notes with phase/doc; insert legacy done-todo directly into DB for cold-status coverage - `tests/test_blocks_compiled_pages.py`: Replace todo with doc in parent-child hierarchy test - `tests/test_board_sync.py`: Replace todo with doc in non-phase child sync test ## Test Plan - [x] Tests pass locally -- 670 passed, 12 failed (pre-existing board_sync failures on main, unrelated) - [x] Each removed type returns 422 on POST /notes and PUT /notes/{slug} - [x] Legacy notes with old types queryable via GET /notes and GET /notes/{slug} - [x] Plan and phase creation still works (frozen, not removed) - [x] ruff format and ruff check pass clean ## Review Checklist - [x] Passed automated review-fix loop - [x] No secrets committed - [x] No unnecessary file changes - [x] Commit messages are descriptive ## Related Notes - Closes #225 - `pal-e-api` -- the project this work belongs to
fix: remove 7 deprecated NoteTypes from enum and VALID_STATUSES
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
ecbcaf6110
Remove reference, incident, journal, post, todo, issue, and milestone
from the NoteType Literal and VALID_STATUSES dict. Existing notes with
old types remain queryable (plain String column), but new creation is
blocked by Pydantic validation. Plan and phase are frozen, not removed.

Closes #225

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Owner

QA Review

Scope check: 7 types removed (reference, incident, journal, post, todo, issue, milestone) from NoteType Literal and VALID_STATUSES. Plan/phase frozen, not removed. No alembic migration (correct -- plain String column). No frontend changes (correct -- different repo).

Test coverage:

  • Parametrized rejection tests for all 7 removed types on create and update (422)
  • Legacy queryability tests via direct DB insert + GET for all 7 removed types
  • Frozen type tests for plan and phase
  • Existing test files updated to replace removed types with active types (doc, phase)
  • 670 passed, 12 failed (pre-existing board_sync failures confirmed on main)

Code quality:

  • ruff format and ruff check pass clean
  • Minimal diff, no unnecessary changes
  • Comments updated to reflect new context (issue #225 references)

No issues found.

VERDICT: APPROVE

## QA Review **Scope check:** 7 types removed (reference, incident, journal, post, todo, issue, milestone) from NoteType Literal and VALID_STATUSES. Plan/phase frozen, not removed. No alembic migration (correct -- plain String column). No frontend changes (correct -- different repo). **Test coverage:** - Parametrized rejection tests for all 7 removed types on create and update (422) - Legacy queryability tests via direct DB insert + GET for all 7 removed types - Frozen type tests for plan and phase - Existing test files updated to replace removed types with active types (doc, phase) - 670 passed, 12 failed (pre-existing board_sync failures confirmed on main) **Code quality:** - ruff format and ruff check pass clean - Minimal diff, no unnecessary changes - Comments updated to reflect new context (issue #225 references) **No issues found.** VERDICT: APPROVE
Author
Owner

PR #231 Review

DOMAIN REVIEW

Tech stack: Python / FastAPI / SQLAlchemy / Pydantic / pytest

This PR removes 7 deprecated values from the NoteType Literal (reference, incident, journal, post, todo, issue, milestone) and the corresponding VALID_STATUSES entries. The enforcement strategy is sound:

  • Pydantic-layer enforcement only: NoteCreate and NoteUpdate use NoteType (the strict Literal), so new creation/update with removed types returns 422. No DB migration required because note_type is a plain String column (models.py:102), not a DB-level enum.
  • Backward compatibility preserved: NoteOut.note_type is str | None (schemas.py:137), so old values serialize fine on reads. GET query params are str | None (routes/notes.py:366,433,566), so ?note_type=todo still works for filtering legacy data.
  • Frozen types (plan, phase): Correctly kept in the Literal -- not removed. Explicit tests verify this.

The 5 test files are updated consistently. All references to removed types in test seed data are replaced with valid types (doc, phase). Where cold-status coverage requires a "done" note, the test correctly inserts directly into DB via TestingSessionLocal to simulate pre-existing legacy data.

DRY check: _VALID_STATUSES in test_note_decomposition.py is a duplicate of the route's VALID_STATUSES dict (minus newer types). This pre-dates this PR and is not introduced here -- not a blocker.

BLOCKERS

None.

  • Test coverage: All 7 removed types are tested for 422 on both POST and PUT (parametrized). Legacy queryability is tested for all 7 via direct DB insert + GET by slug + GET by filter. Frozen types (plan, phase) have explicit acceptance tests.
  • Input validation: Pydantic Literal handles validation; no raw SQL or unvalidated paths.
  • No secrets: No credentials, API keys, or .env files in the diff.
  • No DRY violation in auth/security paths: N/A -- this is schema/enum work.

NITS

  1. test_include_cold.py:113 comment says "All 10 notes" -- the seed function creates 9 notes via API + 1 via direct DB insert = 10 total. Count is correct, but it would be slightly clearer to add a comment noting the DB-inserted note. Very minor.

  2. test_note_decomposition.py _VALID_STATUSES drift risk: This dict (test_note_decomposition.py:752) does not include board, review, architecture, validation, or user-story. Those are covered elsewhere (test_note_type_enum.py), but the partial duplication of the route's VALID_STATUSES is a maintenance risk. Pre-existing, not introduced by this PR.

  3. Two removed comments in test_note_type_enum.py (lines 401, 410 in the diff -- # Setup: create project... and # Move to validation column): These were useful inline context. Removing them is fine but not necessary.

SOP COMPLIANCE

  • Branch named after issue (225-remove-deprecated-note-types -> issue #225)
  • PR body follows template (Summary, Changes, Test Plan, Review Checklist, Related)
  • Related section references issue #225 with "Closes #225"
  • No secrets committed
  • No unnecessary file changes (all 7 files are directly related to the enum removal)
  • Commit messages are descriptive

PROCESS OBSERVATIONS

  • Change failure risk: LOW. The enforcement is Pydantic-only, the DB column is unaffected, and backward compatibility for existing data is explicitly tested. This is the safest possible deprecation strategy -- old data reads fine, only new writes are blocked.
  • Deployment frequency: Clean, focused PR. No migration to coordinate. Can be deployed independently.
  • Test plan notes 12 pre-existing failures on main (board_sync tests) -- these are unrelated but should be tracked for resolution to avoid normalization of failure.

VERDICT: APPROVED

## PR #231 Review ### DOMAIN REVIEW **Tech stack**: Python / FastAPI / SQLAlchemy / Pydantic / pytest This PR removes 7 deprecated values from the `NoteType` Literal (reference, incident, journal, post, todo, issue, milestone) and the corresponding `VALID_STATUSES` entries. The enforcement strategy is sound: - **Pydantic-layer enforcement only**: `NoteCreate` and `NoteUpdate` use `NoteType` (the strict Literal), so new creation/update with removed types returns 422. No DB migration required because `note_type` is a plain `String` column (`models.py:102`), not a DB-level enum. - **Backward compatibility preserved**: `NoteOut.note_type` is `str | None` (`schemas.py:137`), so old values serialize fine on reads. GET query params are `str | None` (`routes/notes.py:366,433,566`), so `?note_type=todo` still works for filtering legacy data. - **Frozen types (plan, phase)**: Correctly kept in the Literal -- not removed. Explicit tests verify this. The 5 test files are updated consistently. All references to removed types in test seed data are replaced with valid types (doc, phase). Where cold-status coverage requires a "done" note, the test correctly inserts directly into DB via `TestingSessionLocal` to simulate pre-existing legacy data. **DRY check**: `_VALID_STATUSES` in `test_note_decomposition.py` is a duplicate of the route's `VALID_STATUSES` dict (minus newer types). This pre-dates this PR and is not introduced here -- not a blocker. ### BLOCKERS None. - **Test coverage**: All 7 removed types are tested for 422 on both POST and PUT (parametrized). Legacy queryability is tested for all 7 via direct DB insert + GET by slug + GET by filter. Frozen types (plan, phase) have explicit acceptance tests. - **Input validation**: Pydantic Literal handles validation; no raw SQL or unvalidated paths. - **No secrets**: No credentials, API keys, or .env files in the diff. - **No DRY violation in auth/security paths**: N/A -- this is schema/enum work. ### NITS 1. **`test_include_cold.py:113` comment says "All 10 notes"** -- the seed function creates 9 notes via API + 1 via direct DB insert = 10 total. Count is correct, but it would be slightly clearer to add a comment noting the DB-inserted note. Very minor. 2. **`test_note_decomposition.py` `_VALID_STATUSES` drift risk**: This dict (`test_note_decomposition.py:752`) does not include board, review, architecture, validation, or user-story. Those are covered elsewhere (`test_note_type_enum.py`), but the partial duplication of the route's `VALID_STATUSES` is a maintenance risk. Pre-existing, not introduced by this PR. 3. **Two removed comments in `test_note_type_enum.py`** (lines 401, 410 in the diff -- `# Setup: create project...` and `# Move to validation column`): These were useful inline context. Removing them is fine but not necessary. ### SOP COMPLIANCE - [x] Branch named after issue (`225-remove-deprecated-note-types` -> issue #225) - [x] PR body follows template (Summary, Changes, Test Plan, Review Checklist, Related) - [x] Related section references issue #225 with "Closes #225" - [x] No secrets committed - [x] No unnecessary file changes (all 7 files are directly related to the enum removal) - [x] Commit messages are descriptive ### PROCESS OBSERVATIONS - **Change failure risk: LOW**. The enforcement is Pydantic-only, the DB column is unaffected, and backward compatibility for existing data is explicitly tested. This is the safest possible deprecation strategy -- old data reads fine, only new writes are blocked. - **Deployment frequency**: Clean, focused PR. No migration to coordinate. Can be deployed independently. - **Test plan notes 12 pre-existing failures on main** (`board_sync` tests) -- these are unrelated but should be tracked for resolution to avoid normalization of failure. ### VERDICT: APPROVED
forgejo_admin deleted branch 225-remove-deprecated-note-types 2026-03-28 04:13:20 +00:00
Sign in to join this conversation.
No description provided.