Skip to content

Add diagnostic warning when source database is overwritten#16

Closed
dinkelk wants to merge 1 commit intomasterfrom
fix/diagnostic-source-overwrite
Closed

Add diagnostic warning when source database is overwritten#16
dinkelk wants to merge 1 commit intomasterfrom
fix/diagnostic-source-overwrite

Conversation

@dinkelk
Copy link
Copy Markdown
Owner

@dinkelk dinkelk commented Apr 5, 2026

Summary

  • Adds a warning in initializeTargetDatabase when it's about to overwrite a database that has a source marker (y entry).
  • This should never happen during normal builds. If it fires, it means a source file is being treated as a build target — the exact corruption that causes permanent "No rule to build" errors.
  • The warning prints the .do file path, which will identify exactly which build rule is causing the corruption.
  • Zero performance cost (one directory existence check inside an already-locked function).

Context

Users have reported intermittent "No rule to build" errors for source files after branch switches. We've narrowed the corruption to source files losing their source marker in the redo database, but haven't identified the exact trigger for always-existing files. This diagnostic will fire the moment the corruption happens, revealing the code path responsible.

Test plan

  • Full existing test suite passes
  • Warning correctly fires in the newsource corner case test (which deliberately converts source → target)
  • No false positives in any other test

🤖 Generated with Claude Code

…init

When initializeTargetDatabase is called on a file that was previously
marked as a source, log a warning. This should never happen during
normal builds — it indicates a source file is being incorrectly treated
as a build target, which corrupts the database and leads to permanent
"No rule to build" errors.

This diagnostic will help identify the root cause of source database
corruption that some users have reported after branch switches.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@dinkelk dinkelk closed this Apr 8, 2026
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.

1 participant