TraceViewer with no index path writes .dftindex into the trace directory
Symptom#
After a tutorial page or script opens traces with TraceViewer, a .dftindex cache appears inside the trace directory. That directory can be a shared or read-only one such as the vast copy of the traces, and it can be compared by md5 with another copy. Stale indexes were left in the local copy under raw/.
Cause#
TraceViewer takes an optional index path. With no index path it writes .dftindex inside the trace directory, not in tmp. No environment variable sets a different location.
Fix#
Pass an index path explicitly, for example TraceViewer(traces_dir, os.path.join(tempfile.gettempdir(), 'elmerfold-index')). Pass the directory, not a glob. Delete any old .dftindex files from the trace directory. They are caches and they rebuild. The same rule applies to code blocks in docs, such as TraceViewer("traces/", "/tmp/traces-index"), with one sentence that explains why.
Evidence#
The agent tested this on the local copy of the elmerfold run. It found that the default wrote .dftindex inside raw/, and it found no environment setting. After the change, the page passed on the Mac and on corona, and the vast trace directory held only the trace files.