Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Feature/589 windows start when available#590

Open
hollowhemlock wants to merge 2 commits intocreativeprojects:masterfrom
hollowhemlock:feature/589-windows-start-when-available
Open

Feature/589 windows start when available#590
hollowhemlock wants to merge 2 commits intocreativeprojects:masterfrom
hollowhemlock:feature/589-windows-start-when-available

Conversation

@hollowhemlock
Copy link
Contributor

Mostly generated with ai from a script that I had to solve the same issue. First time with a go repository.

@coderabbitai
Copy link

coderabbitaibot commentedDec 20, 2025
edited
Loading

Walkthrough

This pull request adds a Windows-only scheduling configuration optionschedule-start-when-available that enables a missed scheduled task to start immediately when the system becomes available. The feature propagates through configuration parsing, schedule abstraction, and Windows Task Scheduler integration layers with supporting tests and documentation.

Changes

Cohort / File(s)Summary
Configuration layer
config/profile.go,config/schedule.go
AddedScheduleStartWhenAvailable field (typemaybe.Bool) toScheduleBaseSection andStartWhenAvailable field toScheduleBaseConfig with initialization ininit() and propagation inapplyOverrides()
Schedule abstraction
schedule/config.go,schedule_jobs.go
AddedStartWhenAvailable bool field toschedule.Config struct and populated it from configuration inscheduleToConfig()
Windows Task Scheduler implementation
schtasks/config.go,schtasks/taskscheduler.go
AddedStartWhenAvailable bool field toschtasks.Config and mapped it totask.Settings.StartWhenAvailable increateTaskDefinition()
Windows handler
schedule/handler_windows.go
UpdatedCreateJob() to passStartWhenAvailable from job configuration toschtasks.Config
Windows integration tests
schedule/handler_windows_test.go,schtasks/taskscheduler_test.go
Added new test functionsTestStartWhenAvailableOption() to validate feature functionality at both handler and task scheduler levels
Documentation
docs/content/schedules/configuration.md,docs/content/schedules/task_scheduler/index.md
Added configuration documentation section describing the Windows-only option, its behaviour, and YAML usage examples

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review field threading consistency across all configuration layers (config → schedule → schtasks)
  • Verify test coverage adequately validates the feature at both Windows handler and Task Scheduler levels
  • Confirm documentation accurately reflects Windows-only scope and expected behaviour

Possibly related PRs

Suggested labels

enhancement

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.You can run@coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check nameStatusExplanation
Title check✅ PassedThe title accurately describes the main change: adding a Windows-specific feature for starting scheduled tasks when the system becomes available.
Description check✅ PassedThe description is somewhat vague but is related to the changeset, acknowledging it was generated with AI assistance for implementing a specific feature.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for usingCodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment@coderabbitai help to get the list of available commands and usage tips.

@hollowhemlock
Copy link
ContributorAuthor

For feature#589

Copy link

@coderabbitaicoderabbitaibot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
docs/content/schedules/configuration.md (1)

204-211:Consider minor grammar improvement.

The documentation is clear and helpful. However, consider adding a comma before "but" in line 208 for improved readability.

🔎 Proposed fix
-For example, if a backup is scheduled for 3:00 AM but the computer is off, enabling this option will run the backup when the computer is next available.+For example, if a backup is scheduled for 3:00 AM, but the computer is off, enabling this option will run the backup when the computer is next available.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between2c47715 andaa43377.

📒 Files selected for processing (11)
  • config/profile.go (1 hunks)
  • config/schedule.go (3 hunks)
  • docs/content/schedules/configuration.md (1 hunks)
  • docs/content/schedules/task_scheduler/index.md (1 hunks)
  • schedule/config.go (1 hunks)
  • schedule/handler_windows.go (1 hunks)
  • schedule/handler_windows_test.go (1 hunks)
  • schedule_jobs.go (1 hunks)
  • schtasks/config.go (1 hunks)
  • schtasks/taskscheduler.go (1 hunks)
  • schtasks/taskscheduler_test.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-29T16:14:02.636Z
Learnt from: zummRepo: creativeprojects/resticprofile PR: 541File: schtasks/taskscheduler.go:60-67Timestamp: 2025-07-29T16:14:02.636ZLearning: In the schtasks package, `config.Command` is guaranteed to be just a path to executable, making single quotes sufficient for wrapping in command construction.

Applied to files:

  • schedule/handler_windows.go
  • schtasks/config.go
🧬 Code graph analysis (5)
schedule/handler_windows.go (2)
shell/command.go (1)
  • Command (37-51)
schtasks/principal.go (1)
  • RunLevel (30-30)
config/profile.go (1)
util/maybe/bool.go (1)
  • Bool (11-13)
schtasks/taskscheduler_test.go (4)
schtasks/config.go (1)
  • Config (5-14)
calendar/event.go (2)
  • NewEvent (27-42)
  • Event (15-24)
schtasks/task.go (2)
  • RegistrationInfo (16-22)
  • Task (24-33)
schtasks/settings.go (1)
  • Settings (9-27)
schtasks/taskscheduler.go (1)
schtasks/settings.go (1)
  • Settings (9-27)
config/schedule.go (1)
util/maybe/bool.go (1)
  • Bool (11-13)
🪛 LanguageTool
docs/content/schedules/configuration.md

[uncategorized] ~208-~208: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...le, if a backup is scheduled for 3:00 AM but the computer is off, enabling this opti...

(COMMA_COMPOUND_SENTENCE_2)

🔇 Additional comments (12)
schtasks/config.go (1)

13-13:LGTM!

TheStartWhenAvailable field is correctly added to theConfig struct and aligns with the Windows Task Scheduler's Settings structure.

config/profile.go (1)

329-329:LGTM!

TheScheduleStartWhenAvailable field is correctly configured with appropriate tags and follows the established pattern for optional Windows-specific schedule settings.

schtasks/taskscheduler.go (1)

187-187:LGTM!

The assignment correctly maps the configuration value to the Windows Task Scheduler settings.

schedule/handler_windows.go (1)

79-88:LGTM!

TheStartWhenAvailable field is correctly propagated from the job configuration to theschtasks.Config structure. The alignment adjustments maintain code consistency.

schedule/config.go (1)

28-28:LGTM!

TheStartWhenAvailable field is appropriately added to the scheduling configuration structure.

config/schedule.go (3)

50-50:LGTM!

TheStartWhenAvailable field is correctly added toScheduleBaseConfig with appropriate type and tags.


104-106:LGTM!

The initialisation logic forStartWhenAvailable follows the established pattern for optional boolean fields.


123-123:LGTM!

The override logic correctly propagates theStartWhenAvailable value from the section configuration.

schedule_jobs.go (1)

242-242:LGTM!

TheStartWhenAvailable field is correctly populated by converting themaybe.Bool value to a boolean usingIsTrue(), consistent with theHideWindow field pattern.

docs/content/schedules/task_scheduler/index.md (1)

38-49:LGTM! Clear and helpful documentation.

The documentation clearly explains the purpose of theschedule-start-when-available option and provides a practical example. The mapping to Windows Task Scheduler terminology is helpful for users familiar with that interface.

schtasks/taskscheduler_test.go (1)

291-343:LGTM! Thorough test coverage.

The test properly verifies that theStartWhenAvailable setting:

  1. Is correctly applied when creating the task definition (line 316)
  2. Persists when the task is created in Windows Task Scheduler (line 322)
  3. Is correctly exported back from Task Scheduler (line 342)

The test follows the established pattern and includes proper cleanup.

schedule/handler_windows_test.go (1)

82-108:LGTM! Appropriate integration test.

The test follows the established pattern fromTestHideWindowOption and properly verifies that a job can be created with theStartWhenAvailable option. The detailed verification of the setting itself is appropriately handled at theschtasks layer (inTestStartWhenAvailableOption intaskscheduler_test.go), whilst this test ensures the integration works correctly.

@creativeprojects
Copy link
Owner

Mostly generated with ai from a script that I had to solve the same issue. First time with a go repository.

At first glance it didn't do too badly. Which model did you use?

@codecov
Copy link

codecovbot commentedDec 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.04%. Comparing base (2c47715) to head (aa43377).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@##           master     #590      +/-   ##==========================================+ Coverage   81.00%   81.04%   +0.04%==========================================  Files         137      137                Lines       11083    11089       +6     ==========================================+ Hits         8977     8986       +9+ Misses       1680     1677       -3  Partials      426      426
FlagCoverage Δ
unittests81.04% <100.00%> (+0.04%)⬆️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hollowhemlock
Copy link
ContributorAuthor

claude opus 4.5

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@coderabbitaicoderabbitai[bot]coderabbitai[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@hollowhemlock@creativeprojects

[8]ページ先頭

©2009-2026 Movatter.jp