Skip to content

Run the file system watcher on its own setting - #110

Merged
jwrosewell merged 2 commits into
rcfrom
fix/watcher-own-setting
Nov 12, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/watcher-own-setting

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The file system watcher stopped running with automatic updates off, so a deployment with no License Key that replaces its Data File on disk is no longer watched, where the published package watched the file.

The rule

James Rosewell decided at about 11:40 UTC on 12 November 2026 that the file system watcher runs on its own setting and needs no License Key. The License Key is needed only for the two things that download, which are polling and the update on start-up. Watching a file downloads nothing, so a deployment that brings its own Data File can watch it with automatic updates off.

What the specification says

The specification says otherwise today, and is to change to follow the rule. This is its master switch section, at data-updates.md lines 97 to 105 on the specifications rc 48e28393.

The autoUpdate option is the master switch for all automatic update activity. When it is disabled, none of the ongoing automatic update mechanisms run, regardless of how they are individually configured:

  • Automatic update via HTTP (polling) does not take place.
  • Automatic update from File (file system watching) does not take place, even if a file system watcher is otherwise configured.

Lines 178 to 181 say the same of Automatic update from File. #69 followed those lines. The change to them, so that the watcher runs on its own setting and a License Key is needed only for polling and the update on start-up, is not drafted yet. The specification's message for a watcher, "Creating file system watcher" (line 449), is unchanged and is still logged whenever a watcher is created.

What changed

The tests come first, in 17ba64d6, and the fix after them, in 67045f72.

  1. The watcher is created on file_system_watcher alone. register_data_file reads if data_file.file_system_watcher: again, as main does, under a comment saying the watcher runs on its own setting whether or not automatic updates are on, and needs no licence key because it downloads nothing (lines 545 to 548). Nothing about polling, the update on start-up or the License Key changes. check_next_update still runs only with update_on_start or auto_update on, and the engines still turn both off without a key.
  2. One test holds the watcher to its own setting. testTheWatcherRunsOnItsOwnSetting registers a data file in three cases, being the watcher on with automatic updates on, the watcher on with them off, and the watcher off with them on. In each case a watcher is created, "Creating file system watcher" is logged and a replaced file is loaded exactly when the watcher's own setting is on.
  3. Tests that only needed a watcher no longer turn automatic updates on. Align the data update service to the specification: HTTP date, expected time, update from memory and logging #69 gave FileSystemWatcherTests a helper, register_watched, that set auto_update and left out the update checks it scheduled, only to get a watcher. The helper is gone, and the five tests that used it register the data file directly, as they did on main. testFileSystemWatcherIsLogged in test_datafile_update_http.py no longer sets auto_update. testNoFileSystemWatcherWithoutAutomaticUpdates, which held the watcher to the automatic update setting, is removed, because its case is the second case of the new test with the opposite answer.

Runs

  • Red, full build 43297050826 on the tests commit 17ba64d, failure. Configure and the Ubuntu Python 3.14 job both print Setting 'PullRequestSha' to '17ba64d6...', and Configure printed "Left out 5 macOS entries". The engines unit tests in that job ended "7 failed, 59 passed". The new test failed on its second case, SUBFAILED[watcher on, automatic updates off] tests/test_datafile_update_service.py::FileSystemWatcherTests::testTheWatcherRunsOnItsOwnSetting, with AssertionError: 1 != 0 : watcher on, automatic updates off at line 145, meaning no watcher was created. Its other two cases passed. The other six failures are the tests that lost auto_update. The five FileSystemWatcherTests found no watcher check pending (IndexError: pop from empty list and list index out of range), and testFileSystemWatcherIsLogged failed with ('info', 'Creating file system watcher') not found in []. The other nine Build and Test jobs were cancelled when that job failed.
  • Green, full build 43300413380 on the head 67045f7, success. Configure and all ten Build and Test jobs (Ubuntu and Windows, Python 3.10 to 3.14) passed, the 11 Setting 'PullRequestSha' lines are all 67045f7, and Configure printed "Left out 5 macOS entries". The engines unit tests on Ubuntu Python 3.14 ended "65 passed".
  • macOS was left out of this draft's full build under the 9 November decision. The rc head is built with macOS before it merges into main.
  • rc moved after the build. Every job merged rc at about 20:44 UTC, when it was 126d373 ("Already up to date"). #91 and #92 then merged at 21:10 as 625ee4e and ddbd95d. They change jsonbundler.py and two of its tests only, and this draft touches none of those files.

The same change in Go

51degrees-go#110, at head e53aa8fc, made the same change in Go. Its TestTheWatcherRunsOnItsOwnSetting has the same three cases, three of its tests lost the automatic update setting they had been given only to get a watcher, and its Register creates the watcher on FileSystemWatcherEnabled alone.

What remains

  1. The specification change. The master switch lines quoted above still hold the watcher to autoUpdate. A draft in specifications to say the watcher runs on its own setting, and that a License Key is needed only for polling and the update on start-up, is not written yet.
  2. .NET still holds its watcher behind the master switch, at DataUpdateService.cs line 275 on 9bb007e4, as go#110 records. .NET differs from Python and Go here until it follows the changed specification.
  3. The release. #67, the rc into main release draft, needs this draft in rc so that the release keeps the watcher of the published package.

testTheWatcherRunsOnItsOwnSetting registers a data file in three cases,
being the watcher on with automatic updates on, the watcher on with them
off, and the watcher off with them on. A watcher is created, logged and
loads a replaced file exactly when the watcher's own setting is on.

The five watcher tests in FileSystemWatcherTests no longer turn automatic
updates on through register_watched, which existed only to get a watcher,
and testFileSystemWatcherIsLogged no longer sets auto_update.
testNoFileSystemWatcherWithoutAutomaticUpdates, which held the watcher to
the automatic update setting, is removed.
register_data_file creates the watcher when file_system_watcher is on,
whether or not auto_update is, as it did on main. Watching a file
downloads nothing, so it needs no licence key, and the on-premise engines,
which turn auto_update off without a key, keep watching the data file.
Polling, the update on start-up and the licence key handling are
unchanged.
@jwrosewell
jwrosewell marked this pull request as ready for review November 12, 2026 21:29
@jwrosewell
jwrosewell merged commit c69d00f into rc Nov 12, 2026
3 checks passed
@jwrosewell
jwrosewell deleted the fix/watcher-own-setting branch November 12, 2026 21:30
@jwrosewell jwrosewell mentioned this pull request Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant