Skip to content

Bug: test_mode string value in config causes ingestion to run in test mode #1528

@samuelbray32

Description

@samuelbray32

Describe the bug
If the DataJoint config contains the key test_mode with the string value "false" (instead of the boolean value false), Spyglass interprets the attribute Mixin._test_mode as True and runs ingestion/test logic as if in test mode. This triggers warnings such as accept_divergence called in test mode, returning False w/o prompt even though the user did not intend to run in test mode.

To Reproduce
Steps to reproduce the behavior:

  1. Set "test_mode": "false" (note: string, not boolean) in your dj_local_conf.json or other config method.
  2. Run ingestion or populate a table that triggers a divergence check.
  3. Observe that Spyglass behaves as if test mode is enabled (no user prompts / warning messages about test mode).
Error Stack / Example Log
[WARNING] Spyglass: accept_divergence called in test mode, returning False w/o prompt

Expected behavior
Spyglass should treat "false", "False", or other string-falsy values for test_mode as False. It should only operate in test mode when the actual value is the boolean True.

Additional context

  • BaseMixin and other places read test_mode directly from dj.config, where it is likely a string from JSON. String values like 'false' are True in a boolean context.
  • The bug can cause users to run ingestion with no prompts or unintended test behaviors, even with their config set to false.
  • See more here: https://github.com/LorenFrankLab/spyglass/search?q=test_mode&type=code

Proposed fix
The _test_mode table attribute should be set from spyglass.settings.test_mode which already correctly handles the string bool evaluation


(This issue was generated from user reporting who encountered this bug in production following documentation and observing incorrect behavior due to config value type.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    NWB ingestionProblems with loading nwb files into spyglassbugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions