I have the answer to this riddle, it’s quite simple: -1 is supposed to represent the « unlimited » value, that’s what is defined in the signup code when you click on the « unlimited » radio button.
The issue is that there was a double bug in the code and in the tests that made this -1 value never work…
Here’s what happened:
- « -1 » behaved as if you wanted to keep only the states older than « 1 day in the future » (NOW - (-1) = TOMORROW)
There was no if(-1) to block the state purge, I think I must have forgotten when coding it. As we weren’t using sensor values from the past yet, it wasn’t noticed. What surprises me is that I think @Terdious has an unlimited history on his instance. Do you confirm @Terdious? I think you must have deliberately removed this variable from the DB, right? - In the tests, a fairly silly mistake, I used fake.resolves() to mock the call to variable.getValue(), except that I misused fake.resolves() and so when I had to do my tests at the time, the -1 behaved as expected, because in short I ended up with a returned function instead of -1, and thus it prevented the purge, in short a very silly thing (it was at the very beginning of v4 about a year and a half ago I think :D)
I fixed the bug and added more robust tests to ensure it doesn’t break again.
In the UI, there is now the possibility to modify the value in the settings:
