Roundup Tracker - Issues

Issue 2551293

classification
remove schema_hook from Tracker instance
Type: behavior Severity: minor
Components: Database Versions:
process
Status: fixed fixed
:
: rouilj : rouilj, schlatterbeck
Priority: low : Effort-Low

Created on 2023-09-27 21:49 by rouilj, last changed 2023-10-02 15:13 by schlatterbeck.

Messages
msg7835 Author: [hidden] (rouilj) Date: 2023-09-27 21:49
Sent this to roundup-devel on the 21st. Tomorrow is a week without any response, remove it.

email start --

Does anybody know how the schema_hook property of a Tracker object is
supposed to be used? Any ideas on what its purpose is?

It is defined in instance.py:Tracker::__init__ with:

        # if set, call schema_hook after executing schema.py will get
        # same variables (in particular db) as schema.py main purpose is
        # for regression tests
        self.schema_hook = None

It's invoked with:

            if isinstance(self.schema_hook, Callable):
                self.schema_hook(**env)

right after schema.py is executed.

A grep in current code under roundup/, test/ and doc/ doesn't show any
examples of it being set.

It was added in changeset: 4211:61cf00ca920a by Ralf. The change was
for mailgw and was used in the test_mailgw.py.

Its use in test_mailgw.py was removed in 4342:94c992852f12 with the
addition of memorydb to speed up testing.

It looks like:

  1) the use of schema_hook was for testing not production

  2) it has been removed from testing and was just not removed
     from instance.py

  3) it was never meant to be accessible from schema.py

One possible use case for it is to run some type of validator once the
schema is fully loaded. There is a validator method that can be hooked
into in configuration.py. It runs after the whole config is loaded.

Since schema.py is edited per tracker, this use case is handled by
writing the validation code at the end of schema.py. No need for a
schema_hook.

Does anybody think there is a real use case for keeping schema_hook?

email end ---
msg7836 Author: [hidden] (rouilj) Date: 2023-09-28 13:44
removed in changeset:   7649:771d7c43c76f
msg7838 Author: [hidden] (schlatterbeck) Date: 2023-10-02 15:13
Sorry for the silence, I'm just back from a short holiday.
Thanks for the analysis, I've just looked through my tracker instances and I'm not using the schema_hook either. So I guess we can safely remove it.

Thanks again!
Ralf
History
Date User Action Args
2023-10-02 15:13:13schlatterbecksetnosy: + schlatterbeck
messages: + msg7838
2023-09-28 13:44:38rouiljsetkeywords: + Effort-Low
status: open -> fixed
resolution: fixed
messages: + msg7836
2023-09-27 21:51:04rouiljsetpriority: low
title: remove Tracker().schema_hook -> remove schema_hook from Tracker instance
2023-09-27 21:50:20rouiljsetstatus: new -> open
2023-09-27 21:49:45rouiljcreate