Safely flushes all committed transactions from the WAL file into the main database file
and truncates the WAL to zero bytes. Returns an error if the database is busy and unable to truncate.
Ensures the symbols_fts FTS5 virtual table and synchronization triggers exist in the SQLite database.
If symbols has rows but symbols_fts has not indexed them (e.g. freshly created FTS table),
an index rebuild is executed.
Retargets the root_path key in artifact_metadata to a new workspace canonical root.
This is essential when cloning or copying an artifact database (e.g. into a git worktree),
ensuring julie-extract update, delete, and scan recognize the new root without root mismatch errors.