-
Notifications
You must be signed in to change notification settings - Fork 53
Description
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:
- Set
"test_mode": "false"(note: string, not boolean) in yourdj_local_conf.jsonor other config method. - Run ingestion or populate a table that triggers a divergence check.
- 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 promptExpected 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_modedirectly fromdj.config, where it is likely a string from JSON. String values like'false'areTruein 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.)