Skip to content

Fix file annotation content reuse in watch mode#1464

Merged
krzysztofzablocki merged 1 commit into
krzysztofzablocki:masterfrom
sorinc03:fix/watch-file-annotations-reset
Jun 11, 2026
Merged

Fix file annotation content reuse in watch mode#1464
krzysztofzablocki merged 1 commit into
krzysztofzablocki:masterfrom
sorinc03:fix/watch-file-annotations-reset

Conversation

@sorinc03

@sorinc03 sorinc03 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Fixes #736.

Summary

  • Clear per-file annotated content at the start of each generation pass.
  • Add a regression test covering repeated generation with the same Sourcery instance.

Root cause

fileAnnotatedContent is instance state populated while processing sourcery:file annotations. In watch mode the same Sourcery instance can run generation more than once, so stale annotated content from a previous pass could be appended again.

Validation

  • git diff --check
  • xcrun xctest .build/arm64-apple-macosx/debug/SourceryPackageTests.xctest (696 tests, 0 failures)

@krzysztofzablocki krzysztofzablocki marked this pull request as ready for review June 11, 2026 10:26
@krzysztofzablocki krzysztofzablocki merged commit f9d80dd into krzysztofzablocki:master Jun 11, 2026
1 of 2 checks passed
@krzysztofzablocki

Copy link
Copy Markdown
Owner

thanks!

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.

Using sourcery with --watch appends to the template instead of replacing it

2 participants