Skip to content

fix: Keep the model files a protocol-only generation refers to - #5894

Merged
FXschwartz merged 6 commits into
serverpod:mainfrom
FXschwartz:FXschwartz/under-serverpod-start-a-model-generated-in-a-fai
Oct 23, 2026
Merged

FXschwartz merged 6 commits into
serverpod:mainfrom
FXschwartz:FXschwartz/under-serverpod-start-a-model-generated-in-a-fai

Conversation

@FXschwartz

Copy link
Copy Markdown
Collaborator

Under serverpod start, a batch that adds a model and breaks an endpoint fails generation after the model files are written, and the stamp is only written on success. The next cycle, a protocol-only run after the endpoint is fixed, preserved model files from the stamp, so it deleted the new model's server and client files while protocol.dart still imported them. The server then failed to compile until the model file was saved again.

  • The protocol-only cleanup now keeps the output paths of the models the protocol is generated from, through a new ServerpodCodeGenerator.serializableModelPaths, instead of reading the stamp.
  • Future call parameter models are part of that model list, so the special case that filtered their directory out of the stamp is gone.
  • A full run is unchanged: it already keeps exactly what it generated.
  • An integration test runs the failed batch and then the fix. The two assertions that the model files and their stamp entries survive fail on main.
  • A unit test pins serializableModelPaths to the files the generators write for plain, server-only and shared models.

Fixes #5882.

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update contains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

If you need help, consider asking for advice on the discussion board.

Breaking changes

None

@FXschwartz
FXschwartz requested a review from a team October 23, 2026 01:12
@FXschwartz FXschwartz self-assigned this Oct 23, 2026

@marcelomendoncasoares marcelomendoncasoares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Only one minor bug and one test description fix.

@marcelomendoncasoares marcelomendoncasoares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! 🚀

@FXschwartz
FXschwartz merged commit d3eefa4 into serverpod:main Oct 23, 2026
481 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Under serverpod start, a model generated in a failed cycle is deleted by the next one

2 participants