Skip to content

Tracker Service v0.4: scene config dynamic loading & update#1009

Merged
jdanieck merged 8 commits intomainfrom
tracker-service-v0.4.0
Feb 25, 2026
Merged

Tracker Service v0.4: scene config dynamic loading & update#1009
jdanieck merged 8 commits intomainfrom
tracker-service-v0.4.0

Conversation

@jdanieck
Copy link
Contributor

@jdanieck jdanieck commented Feb 12, 2026

📝 Description

Introduce dynamic scene loading capabilities by allowing the application to fetch scenes from a Manager REST API instead of relying solely on local files.

Testing

$ make demo-tracker
$ docker compose logs tracker 
tracker-1  | {"timestamp":"2026-02-18T13:50:35.052Z","level":"INFO","msg":"Healthcheck server listening","component":"healthcheck","port":8080}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.052Z","level":"INFO","msg":"Tracker service starting","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.224Z","level":"INFO","msg":"Authenticated with Manager API successfully","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.284Z","level":"INFO","msg":"Fetched scenes from Manager API (3677 bytes)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.284Z","level":"INFO","msg":"Loaded 2 scenes from Manager API","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.284Z","level":"INFO","msg":"Loaded 2 scenes with 4 cameras","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.284Z","level":"INFO","msg":"MQTT client initializing: ssl://broker.scenescape.intel.com:1883 (client_id: tracker-02e73c0dbbe3-1)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.285Z","level":"INFO","msg":"Schema validation enabled for MQTT messages","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.285Z","level":"INFO","msg":"MQTT connecting to broker.scenescape.intel.com:1883 (insecure=false)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.285Z","level":"INFO","msg":"TimeChunkScheduler started (interval=66ms, max_workers=50)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.285Z","level":"INFO","msg":"Queued camera subscriptions","component":"mqtt","operation":"4 cameras","_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.285Z","level":"INFO","msg":"Tracker service running (chunking @ 15fps, max_workers=50)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.347Z","level":"INFO","msg":"MQTT connected","component":"mqtt","operation":"connect onSuccess called","_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.349Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/atag-qcam1","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.349Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/atag-qcam2","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.349Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/camera1","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.349Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/camera2","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"TrackingWorker initialized with 2 cameras for scope 3bc091c7-e449-46a0-9540-29c499bca18c/person","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"Created TrackingWorker for scope 3bc091c7-e449-46a0-9540-29c499bca18c/person (total workers: 1, cameras: 2)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"TrackingWorker initialized with 2 cameras for scope 302cf49a-97ec-402d-a324-c5077b280b7b/person","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"Created TrackingWorker for scope 302cf49a-97ec-402d-a324-c5077b280b7b/person (total workers: 2, cameras: 2)","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"TrackingWorker started for scope 3bc091c7-e449-46a0-9540-29c499bca18c/person","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:50:35.417Z","level":"INFO","msg":"TrackingWorker started for scope 302cf49a-97ec-402d-a324-c5077b280b7b/person","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:08.962Z","level":"WARNING","msg":"MQTT connection lost: unknown","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:08.962Z","level":"INFO","msg":"Paho auto-reconnect will attempt to restore connection","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:09.006Z","level":"WARNING","msg":"Cannot publish tracks: MQTT client not connected","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:14.011Z","level":"INFO","msg":"MQTT connected","component":"mqtt","operation":"automatic reconnect","_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:14.011Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/atag-qcam1","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:14.011Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/atag-qcam2","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:14.052Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/camera1","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
tracker-1  | {"timestamp":"2026-02-18T13:51:14.052Z","level":"INFO","msg":"MQTT subscription successful","component":"mqtt","mqtt":{"topic":"scenescape/data/camera/camera2","direction":"subscribe"},"_":"","service":"tracker","version":"2026.0.0-dev","commit":"aa9bc7d5"}
controller-analytics-1  | 2026-02-18 13:50:36 Controller mode: ANALYTICS-ONLY (tracker disabled)
controller-analytics-1  | 2026-02-18 13:50:36 OpenTelemetry metrics disabled.
controller-analytics-1  | 2026-02-18 13:50:36 Tracing disabled
controller-analytics-1  | 2026-02-18 13:50:36 Analytics-only mode: Skipping tracker configuration file loading
controller-analytics-1  | Loading schema file..
controller-analytics-1  | Schema file loaded - /home/scenescape/SceneScape/schema/metadata.schema.json
controller-analytics-1  | 2026-02-18 13:50:36 Loading scene-data schema from: /home/scenescape/SceneScape/tracker/schema/scene-data.schema.json
controller-analytics-1  | Loading schema file..
controller-analytics-1  | Schema file loaded - /home/scenescape/SceneScape/tracker/schema/scene-data.schema.json
controller-analytics-1  | 2026-02-18 13:50:36 Scene-data schema validator initialized
controller-analytics-1  | 2026-02-18 13:50:36 NEW SCENE Retail https://web.scenescape.intel.com/media/HazardZoneSceneLarge.png 100.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:50:36 Tracker initialization SKIPPED for scene: Retail
controller-analytics-1  | 2026-02-18 13:50:36 NEW SCENE Queuing https://web.scenescape.intel.com/media/scene.png 157.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:50:36 Tracker initialization SKIPPED for scene: Queuing
controller-analytics-1  | 2026-02-18 13:50:36 Publishing camera visibility info on regulated topic.
controller-analytics-1  | 2026-02-18 13:50:36 Connected with result code 0
controller-analytics-1  | 2026-02-18 13:50:36 NEW SCENE Retail https://web.scenescape.intel.com/media/HazardZoneSceneLarge.png 100.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:50:36 Tracker initialization SKIPPED for scene: Retail
controller-analytics-1  | 2026-02-18 13:50:36 NEW SCENE Queuing https://web.scenescape.intel.com/media/scene.png 157.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:50:36 Tracker initialization SKIPPED for scene: Queuing
controller-analytics-1  | 2026-02-18 13:50:36 Subscribed to scenescape/data/scene/302cf49a-97ec-402d-a324-c5077b280b7b/+
controller-analytics-1  | 2026-02-18 13:50:36 Subscribed to scenescape/data/scene/3bc091c7-e449-46a0-9540-29c499bca18c/+
controller-analytics-1  | 2026-02-18 13:50:36 Subscribed to scenescape/cmd/database
controller-analytics-1  | 2026-02-18 13:51:10 Connected with result code 0
controller-analytics-1  | 2026-02-18 13:51:10 NEW SCENE Retail https://web.scenescape.intel.com/media/HazardZoneSceneLarge.png 100.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:51:10 Tracker initialization SKIPPED for scene: Retail
controller-analytics-1  | 2026-02-18 13:51:10 NEW SCENE Queuing https://web.scenescape.intel.com/media/scene.png 157.0 0.3333 0.2666 0.5333 analytics_only=True
controller-analytics-1  | 2026-02-18 13:51:10 Tracker initialization SKIPPED for scene: Queuing
controller-analytics-1  | 2026-02-18 13:51:10 Subscribed to scenescape/data/scene/302cf49a-97ec-402d-a324-c5077b280b7b/+
controller-analytics-1  | 2026-02-18 13:51:10 Subscribed to scenescape/data/scene/3bc091c7-e449-46a0-9540-29c499bca18c/+
controller-analytics-1  | 2026-02-18 13:51:10 Subscribed to scenescape/cmd/database
image

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests
  • 🚂 CI

🧪 Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • ✅ Tested manually
  • 🤖 Ran automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

@jdanieck jdanieck self-assigned this Feb 12, 2026
@jdanieck jdanieck force-pushed the tracker-service-v0.4.0 branch from dc67fee to 6d7d2f7 Compare February 17, 2026 09:05
@jdanieck jdanieck changed the base branch from main to tracker-service-v0.3.2 February 17, 2026 09:05
@jdanieck jdanieck requested a review from Copilot February 17, 2026 16:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds dynamic scene loading to the tracker by fetching scenes from the Manager REST API (auth + fetch + transform + schema validate) and wiring this into config/env, build, and automated tests.

Changes:

  • Introduces ManagerRestClient + ApiSceneLoader and updates create_scene_loader()/main to support scenes.source=api.
  • Extends config schema/config loader with infrastructure.manager + env overrides for Manager settings.
  • Adds unit/service tests plus compose-based mock Manager for end-to-end API scene loading.

Reviewed changes

Copilot reviewed 30 out of 30 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
tracker/test/unit/utils/mock_manager_rest_client.hpp Adds gmockable Manager REST client interface for unit tests
tracker/test/unit/manager_rest_client_test.cpp Adds end-to-end tests for ManagerRestClient using local httplib::Server
tracker/test/unit/config_loader_test.cpp Expands config loader tests for API scenes source + Manager config/env overrides
tracker/test/unit/api_scene_loader_test.cpp Adds unit tests for API scene loader pipeline and API->schema transforms
tracker/test/unit/CMakeLists.txt Links new API/REST client sources and adds OpenSSL to unit test target
tracker/test/service/test_scene_loading.py Adds service tests validating API scene loading and message flow
tracker/test/service/test_mqtt.py Forces file-based scenes in TLS MQTT service test fixture
tracker/test/service/mocks/mock_manager.py Adds mock Manager REST API server used by service tests
tracker/test/service/fixtures/test-scenes-api.json Adds fixture payload emulating Manager /api/v1/scenes response
tracker/test/service/fixtures/test-auth.json Adds fixture auth file for API mode tests
tracker/test/service/docker-compose.yaml Adds mock-manager service/profile and API-related env/secrets wiring
tracker/test/service/conftest.py Adds tracker_service_api fixture to run tracker against mock Manager
tracker/src/scene_loader.cpp Refactors file loader parsing to shared parser; routes API mode to create_api_scene_loader
tracker/src/manager_rest_client.cpp Implements auth + fetch scenes against Manager REST API via cpp-httplib
tracker/src/main.cpp Passes Manager config + schema dir into scene loader factory
tracker/src/config_loader.cpp Defaults scenes source to API; parses/overrides Manager config and validates API requirements
tracker/src/api_scene_loader.cpp Implements API scene loading (auth file -> REST -> transform -> schema validate -> parse)
tracker/schema/config.schema.json Updates schema for Manager auth file + API scenes default/requirements
tracker/inc/scenes_config.hpp Introduces SceneSource/ScenesConfig in a dedicated header
tracker/inc/scene_registry.hpp Adjusts includes to align with refactor
tracker/inc/scene_parser.hpp Adds shared JSON->Scene parser used by both file and API loaders
tracker/inc/scene_loader.hpp Extends factory API; adds Manager client factory + API helper declarations
tracker/inc/manager_rest_client.hpp Adds IManagerRestClient + concrete ManagerRestClient interface
tracker/inc/env_vars.hpp Adds Manager-related env var constants
tracker/inc/config_loader.hpp Adds ManagerConfig and InfrastructureConfig::manager
tracker/config/tracker.json Switches default config to API scenes and adds Manager section
tracker/conanfile.txt Enables OpenSSL in cpp-httplib via Conan option
tracker/Makefile Includes service-test mock scripts in autopep8 format/lint targets
tracker/CMakeLists.txt Adds OpenSSL dependency and builds new API/REST client sources
sample_data/docker-compose-dl-streamer-example.yml Configures tracker container for API scenes + Manager secrets and startup ordering

jdanieck added a commit that referenced this pull request Feb 18, 2026
- config_loader: validate url/auth_path emptiness after env overrides
- manager_rest_client: configurable chrono timeouts (default 10s/30s)
- manager_rest_client: always enable TLS server cert verification
- manager_rest_client_test: ASSERT_GT on bind_to_any_port
- manager_rest_client_test: use ephemeral port + 50ms timeout for
  connection-refused test (62ms vs 30s)
- manager_rest_client_test: remove no-op FetchScenesInvalidUrlThrows
- api_scene_loader: guard validate_scenes with IsArray() check
- config_loader_test: add missing MANAGER_AUTH_PATH env in API test
- scene_loader: remove dead ApiSceneLoader stub class
@jdanieck jdanieck force-pushed the tracker-service-v0.4.0 branch from 7ed7183 to 5b7d618 Compare February 18, 2026 10:05
@jdanieck jdanieck changed the title [WIP] Tracker Service v0.4.0: dynamic scene loading Tracker Service v0.4.0: dynamic scene loading Feb 18, 2026
@jdanieck
Copy link
Contributor Author

jdanieck commented Feb 18, 2026

I've done development on this one. I'll keep it in draft until #968 is merged. Then I'll rebase and open for general review against main branch.

@jdanieck jdanieck changed the title Tracker Service v0.4.0: dynamic scene loading Tracker Service v0.4.0: dynamic scene config loading Feb 19, 2026
@jdanieck jdanieck changed the title Tracker Service v0.4.0: dynamic scene config loading Tracker Service v0.4.0: scene config dynamic loading Feb 19, 2026
Base automatically changed from tracker-service-v0.3.2 to main February 21, 2026 17:58
@jdanieck jdanieck force-pushed the tracker-service-v0.4.0 branch from 1b10dfe to 142ca6e Compare February 23, 2026 08:28
T_EDITOR="true" git rebase --continue
t status
@jdanieck jdanieck force-pushed the tracker-service-v0.4.0 branch from 142ca6e to 8f5b1f7 Compare February 23, 2026 08:39
@jdanieck jdanieck changed the title Tracker Service v0.4.0: scene config dynamic loading Tracker Service v0.4: scene config dynamic loading & update Feb 23, 2026
@jdanieck jdanieck marked this pull request as ready for review February 23, 2026 08:58
Copy link
Contributor

@tdorauintc tdorauintc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one issue I would suggest to fix in this PR. Comments starting with [future] are not blocking the PR but added as a reminder to fix it in another future PR.

Comment on lines +175 to +187
void MessageHandler::handleDatabaseUpdateMessage(const std::string& topic,
const std::string& payload) {
LOG_INFO_ENTRY(LogEntry("Database update received, triggering restart")
.component("message_handler")
.mqtt({.topic = topic, .direction = "subscribe"}));

if (shutdown_callback_) {
shutdown_callback_();
} else {
LOG_WARN("Database update received but no shutdown callback registered");
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[future] This will cause tracker restart even in case of adding tripwire or region, which impacts analytics but not the tracker itself. To be fixed later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. This is done this way because Manager do not send update events for deleted scenes, only generic "database update". As an improvement either we can change the Manager to send delete updates on specific scene topic (just like it sends edit updates), or query manager API for current scenes state and compute locally if this update requires us to reload scenes.

jdanieck and others added 4 commits February 25, 2026 11:17
Allows MANAGER_URL, MANAGER_AUTH_PATH, and MANAGER_CA_CERT_PATH
environment variables to populate infrastructure.manager config
before validation, instead of failing early when only env vars are set.
Co-authored-by: Lukasz Talarczyk <lukasz.talarczyk@intel.com>
Co-authored-by: Lukasz Talarczyk <lukasz.talarczyk@intel.com>
@jdanieck jdanieck merged commit 61df3b2 into main Feb 25, 2026
30 checks passed
@jdanieck jdanieck deleted the tracker-service-v0.4.0 branch February 25, 2026 11:21
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.

4 participants