feat(updates): Multi-Tenant Update Scheduling (v1.8.0, Issue #262)#4205
Open
feat(updates): Multi-Tenant Update Scheduling (v1.8.0, Issue #262)#4205
Conversation
…#262)" Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement multi-tenant update scheduling feature
feat(updates): Multi-Tenant Update Scheduling (v1.8.0, Issue #262)
Mar 13, 2026
makr-code
approved these changes
Mar 14, 2026
There was a problem hiding this comment.
Pull request overview
Adds a new updates-domain component (TenantUpdateScheduler) to support per-tenant maintenance windows, blackout periods, priority-based bypass rules, consent/notification lead-time gating, and per-tenant rollback tracking, with focused unit tests and CI wiring.
Changes:
- Introduces
TenantUpdateSchedulerpublic API + implementation for per-tenant scheduling/consent/rollback. - Adds 37 focused unit tests and a dedicated focused test target.
- Registers sources in monolithic/modular builds and adds a dedicated GitHub Actions workflow.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| include/updates/tenant_update_scheduler.h | Public API/types and documentation for multi-tenant update scheduling. |
| src/updates/tenant_update_scheduler.cpp | Core scheduling logic, consent management, next-window calculation, apply/rollback bookkeeping. |
| tests/test_multi_tenant_update_scheduling.cpp | Focused unit tests covering AC1–AC5 plus status/lifecycle and construction. |
| tests/CMakeLists.txt | Adds focused test executable + CTest registration for this feature. |
| cmake/CMakeLists.txt | Registers scheduler source in monolithic themis_core build. |
| cmake/ModularBuild.cmake | Registers scheduler source in modular build source lists. |
| .github/workflows/multi-tenant-update-scheduling-ci.yml | Adds targeted CI workflow running the focused test and unified binary filters. |
| src/updates/ROADMAP.md | Marks the roadmap item as completed for v1.8.0. |
| src/updates/FUTURE_ENHANCEMENTS.md | Marks feature as implemented and links implementation files/tests/CI. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+75
to
+88
| /** | ||
| * @brief Priority tier for an update. | ||
| * | ||
| * Determines scheduling and consent rules: | ||
| * - CRITICAL : may override blackout periods when | ||
| * `UpdatePolicy::critical_auto_update` is true. | ||
| * - NORMAL : follows regular maintenance windows. | ||
| * - LOW : deferred to the next available window; never auto-applied. | ||
| */ | ||
| enum class UpdatePriority { | ||
| CRITICAL, ///< Security patches and data-integrity fixes. | ||
| NORMAL, ///< Feature releases and minor patches. | ||
| LOW, ///< Optional enhancements; applied only when explicitly approved. | ||
| }; |
| const std::string& blackout_id); | ||
|
|
||
| /** | ||
| * @brief Return all active blackout periods for a tenant. |
| with: | ||
| cc: ${{ matrix.cc }} | ||
| cxx: ${{ matrix.cxx }} | ||
| extra-packages: libssl-dev libcurl4-openssl-dev libboost-all-dev librocksdb-dev libfmt-dev libtbb-dev libspdlog-dev nlohmann-json3-dev libexpected-dev |
Comment on lines
+355
to
+365
| // Build the candidate time_point: midnight of (now + offset days) | ||
| // plus start_min minutes. | ||
| const std::time_t candidate_t = | ||
| now_t | ||
| - static_cast<std::time_t>(current_min_of_day * 60) // back to midnight | ||
| + static_cast<std::time_t>(offset * 24 * 3600) // advance days | ||
| + static_cast<std::time_t>(start_min * 60); // add start time | ||
|
|
||
| const auto candidate_tp = | ||
| std::chrono::system_clock::from_time_t(candidate_t); | ||
|
|
Comment on lines
+327
to
+336
| auto dayAllowed = [&](int wday) -> bool { | ||
| for (const auto& d : win.days) { | ||
| std::string dlower = d; | ||
| for (auto& c : dlower) c = static_cast<char>(std::tolower(c)); | ||
| if (dlower == "daily") { | ||
| return true; | ||
| } | ||
| std::string kday = kDayNames[wday]; | ||
| for (auto& c : kday) c = static_cast<char>(std::tolower(c)); | ||
| if (dlower == kday) { |
Comment on lines
+397
to
+409
| auto& state = tenants_[tenant_id]; | ||
| if (result.success) { | ||
| state.current_version = version; | ||
| state.last_rollback_id = result.rollback_id; | ||
| state.consent_granted = false; // reset consent after successful apply | ||
| state.pending_version.clear(); | ||
| state.notification_time.reset(); | ||
| LOG_INFO("TenantUpdateScheduler: applied version '{}' for tenant '{}' " | ||
| "(rollback_id='{}')", | ||
| version, tenant_id, result.rollback_id); | ||
| } else { | ||
| LOG_WARN("TenantUpdateScheduler: engine failed to apply '{}' for '{}': {}", | ||
| version, tenant_id, result.error_message); |
Comment on lines
+239
to
+240
| * After removal, `canUpdateNow()` returns false for the tenant unless | ||
| * an override is granted via `grantConsent()`. |
Comment on lines
+535
to
+556
| // Day-of-week check (tm_wday: 0=Sunday). | ||
| static const char* const kDayNames[] = { | ||
| "Sunday", "Monday", "Tuesday", "Wednesday", | ||
| "Thursday", "Friday", "Saturday" | ||
| }; | ||
| bool day_ok = false; | ||
| for (const auto& d : win.days) { | ||
| std::string dlower = d; | ||
| for (auto& c : dlower) c = static_cast<char>(std::tolower(c)); | ||
| if (dlower == "daily") { | ||
| day_ok = true; | ||
| break; | ||
| } | ||
| std::string kday = kDayNames[utc.tm_wday]; | ||
| for (auto& c : kday) c = static_cast<char>(std::tolower(c)); | ||
| if (dlower == kday) { | ||
| day_ok = true; | ||
| break; | ||
| } | ||
| } | ||
| if (!day_ok) { | ||
| return false; |
| tenant_id, version); | ||
| return r; | ||
| } | ||
|
|
| * | ||
| * scheduler.setMaintenanceWindow("tenant-123", { | ||
| * .days = {"Saturday", "Sunday"}, | ||
| * .time_range = {"02:00", "06:00"}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements per-tenant update scheduling for the updates module — maintenance windows, blackout periods, priority tiers, consent management, and per-tenant rollback.
Description
Core Implementation
include/updates/tenant_update_scheduler.h—TenantUpdateSchedulerclass with types:MaintenanceWindow,BlackoutPeriod,UpdatePolicy,UpdatePriority(CRITICAL/NORMAL/LOW),TenantUpdateStatussrc/updates/tenant_update_scheduler.cpp— Full production implementation with cross-midnight window support, injectable clock for testability, thread-safe via internal mutexKey scheduling rules
critical_auto_updatebypasses)notification_lead_timenot elapsed → blocksauto_update=falseand no explicit consent → blocksPer-tenant rollback stores the
rollback_idfromapplyUpdate()and callsHotReloadEngine::rollback()viarollbackTenant().Build / Test / CI
cmake/CMakeLists.txt+cmake/ModularBuild.cmake— source registered inthemis_coretests/test_multi_tenant_update_scheduling.cpp— 37 focused tests across all 5 ACstests/CMakeLists.txt—MultiTenantUpdateSchedulingFocusedTeststarget added.github/workflows/multi-tenant-update-scheduling-ci.yml— CI on ubuntu-22.04/24.04Type of Change
Testing
📚 Research & Knowledge (wenn applicable)
/docs/research/angelegt?/docs/research/implementation_influence/eingetragen?Relevante Quellen:
Checklist
Original prompt
📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.