Skip to content

Feature flags being set by a file is dangerous #310

@julianstirling

Description

@julianstirling

I think feature flags being set by import in any file is confusing and will cause problems in the future. It means that adding a new Thing to a configuration can change the behaviour of other base things. For example if someone turned a feature flag on in a custom extension in the microscope it changes the base microscope behaviour. I didn't see that this was the mechanism before it was merged as part of an unrelated MR, but I think it is likely to cause problems.

I would be in favour of changing this before any release

I would suggest rather than using

lt.FEATURE_FLAGS.validate_properties_on_set = True

to turn on a feature flag instead. I would only turn them on and off in the configuration, however any file that requires a flag to be on or off could do:

lt.feature_flags.require = {"validate_properties_on_set", True}

This way, it is very clear what to do if two things require something incompatible. It will also allow a Thing to do:

lt.feature_flags.require = {"feature_from_future_version", False}

And as it is a string LabThings could warn that this feature doesn't exits rather than error. Allowing code to run on old versions as long as the feature flag was required not to exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions