Skip to content

fix: persist the template description sent to PUT /templates/{id} - #735

Merged
marcvergees merged 2 commits into
fireform-core:developmentfrom
Anandb71:fix-template-description-on-update
Oct 24, 2026
Merged

marcvergees merged 2 commits into
fireform-core:developmentfrom
Anandb71:fix-template-description-on-update

Conversation

@Anandb71

Copy link
Copy Markdown
Contributor

Description

PUT /api/v1/templates/{id} is a partial update: only the keys sent are changed. TemplateResponse returns a description, and TemplateCreate accepts one, but TemplateUpdate only had name and fields. Pydantic ignores extras, so:

PUT /api/v1/templates/2
{"description": "Wildfire comms plan"}

returns 200 with the old description unchanged.

That leaves the description frozen after create:

This accepts description on TemplateUpdate and writes it when it is sent, the same way as name. A name-only PUT still leaves the description alone.

Independent of #734 (create). That PR only changes create_template; this one changes TemplateUpdate and update_template. They share no hunks.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Repro on development (5e79f14) with the same in-memory SQLite setup the tests use. Insert a template whose description is "Original radio plan", then:

PUT /api/v1/templates/1 {"description": "Updated ICS 205 radio plan"}
-> 200, "description": "Original radio plan"
GET /api/v1/templates -> "description": "Original radio plan"

With the change both return the updated description. A name-only PUT still keeps "Original radio plan".

  • New test_update_template_description: PUT with only description updates it and leaves name/fields alone. Fails on development (assert 'Original radio plan' == 'Updated ICS 205 radio plan').
  • New test_update_keeps_description_when_omitted: a name-only PUT must not clear the description.
  • New test_fill_form_uses_description_from_update: PUT a description, fill the form, and check the filler gets that text. Fails on development (assert '' == 'Incident radio communications plan').

All three fail on development and pass with the change.
python -m pytest tests/ → 305 passed. ruff check app/ → All checks passed.

Test Configuration:

  • Python version: 3.11.17
  • Docker/Compose version: not needed (the suite uses in-memory SQLite and mocks)
  • OS: Linux

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (none needed)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • The Lint workflow check passes on this PR ✅
  • The Tests workflow check passes on this PR ✅

TemplateUpdate accepted only name and fields, so a description in the
PUT body was ignored. The Studio description editor and the fill prompt
could never pick up a corrected description after create.

Accept description on update the same way as name, and assert it in the
update and update-then-fill API tests.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@marcvergees
marcvergees merged commit 00ad04a into fireform-core:development Oct 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants