Skip to content

fix(schema): add systemd timer and lifecycle options - #11050

Merged
jdx merged 2 commits into
mainfrom
codex/fix-systemd-schema
Jul 16, 2026
Merged

jdx merged 2 commits into
mainfrom
codex/fix-systemd-schema

Conversation

@jdx

@jdx jdx commented Jul 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add the systemd timer fields accepted by the runtime to schema/mise.json
  • add the service lifecycle and hardening fields introduced with timer support
  • model service and timer declarations separately so services require exec_start while timers require a schedule and reject service-only directives
  • extend strict Tombi schema coverage for valid and invalid systemd units

Root cause

The runtime, tests, and documentation were updated in #10984, but the manually maintained systemd section of schema/mise.json retained the earlier service-only shape.

Fixes the schema mismatch reported in discussion #11049.

Validation

  • mise run render:schema
  • mise run test:e2e e2e/config/test_schema_tombi
  • mise run lint-fix

Note

Low Risk
Schema and e2e validation only; no runtime bootstrap apply logic changes in this diff.

Overview
Brings schema/mise.json in line with the systemd bootstrap behavior added in runtime/docs: bootstrap.linux.systemd.units now documents services and timers, not services only.

Service entries gain lifecycle and hardening fields (type, remain_after_exit, exec_stop, timeouts, no_new_privileges, private_tmp). Timer entries gain schedule and linkage fields (on_boot_sec, on_unit_*_sec, on_calendar, delay/accuracy, persistent, unit). A oneOf splits the two shapes so services require exec_start and forbid timer-only keys, while timers require at least one schedule field and forbid service-only keys (including mixed exec_start + on_boot_sec).

e2e/config/test_schema_tombi adds passing examples for a rich service and a timer, registers mise-bad-systemd.toml, and asserts Tombi strict lint fails on missing exec_start, timer-only persistent, service/timer mixes, and invalid type.

Reviewed by Cursor Bugbot for commit b1ff031. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Expanded Linux systemd configuration support to include both services and timers.
    • Added options for service behavior, shutdown handling, privileges, temporary directories, scheduling, persistence, and timer relationships.
    • Improved validation to enforce the correct fields for each systemd unit type.
  • Bug Fixes

    • Added regression coverage for invalid systemd configurations, including missing required fields and unsupported property combinations.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Linux systemd schema now supports both service and timer units, with expanded properties and mutually exclusive validation rules. Tombi end-to-end tests add valid service/timer fixtures and invalid cases covering missing and incompatible fields.

Changes

Systemd schema validation

Layer / File(s) Summary
Service and timer schema contract
schema/mise.json
Adds systemd service and timer properties, and separates validation into service and timer definitions with distinct required and prohibited fields.
Schema fixture and lint validation
e2e/config/test_schema_tombi
Adds valid service/timer declarations and verifies that invalid systemd configurations cause tombi lint to fail.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • jdx/mise#10984: Covers related systemd service-versus-timer parsing and validation behavior.

Suggested reviewers: risu729, jambalaya56562

Poem

A rabbit hops through timers bright,
While services start the night.
Missing fields are caught with care,
Invalid settings stop right there.
Tombi thumps its schema drum—
“Valid units, here they come!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main schema change: adding systemd timer support and lifecycle options.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch codex/fix-systemd-schema

Thanks for using CodeRabbit! 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.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes the schema/mise.json systemd section to match the bootstrap runtime changes introduced in #10984, and extends the Tombi e2e tests with both valid and invalid unit examples.

  • schema/mise.json: Expands the bootstrap.linux.systemd.units entry schema with service lifecycle fields (type with a strict enum, remain_after_exit, exec_stop, timeout and hardening options) and timer schedule fields (on_boot_sec, on_unit_active_sec, on_unit_inactive_sec, on_calendar, delay/accuracy/persistence). A oneOf replaces the old flat required: ["exec_start"], enforcing that services must have exec_start and no timer-only keys, while timers must have at least one schedule key and no service-only keys.
  • e2e/config/test_schema_tombi: Adds a valid sync service and sync-timer to the positive block, and a four-case negative loop (missing exec_start, timer-only field without schedule, mixed service+timer fields, invalid type enum value) to confirm that Tombi lint correctly rejects each bad shape.

Confidence Score: 5/5

Schema and test-only change with no runtime modifications; the oneOf logic is correct and all four negative test cases are well-designed to cover the new mutual-exclusion rules.

Both changed files are purely declarative — JSON Schema and a shell e2e test. The oneOf structure correctly enforces service/timer mutual exclusion: services require exec_start and forbid all timer keys, timers require at least one schedule key and forbid all service keys. The type enum is properly constrained to the eight values systemd recognises. Negative test cases cover missing required fields, timer-only fields without a schedule key, mixed service+timer fields, and an invalid enum value — all cases verified to fail.

No files require special attention.

Important Files Changed

Filename Overview
schema/mise.json Adds service lifecycle fields (type, remain_after_exit, exec_stop, timeouts, no_new_privileges, private_tmp) and timer fields (on_boot_sec, on_unit_active_sec, on_unit_inactive_sec, on_calendar, randomized_delay_sec, accuracy_sec, persistent, unit) to the systemd unit schema; replaces the flat required: ["exec_start"] with a oneOf that correctly enforces mutual exclusion between service and timer shapes
e2e/config/test_schema_tombi Adds a valid sync service and sync-timer example to the positive test block and a new four-case negative loop (missing exec_start, timer-only field alone, service+timer mix, invalid type enum) to cover the new oneOf constraint

Reviews (2): Last reviewed commit: "fix(schema): constrain systemd service t..." | Re-trigger Greptile

Comment thread schema/mise.json Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
schema/mise.json (1)

3667-3670: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add an enum for Type= to catch typos.

type is a bare string, so typos like "one-shot" or "oneshoot" silently pass validation and would only surface at systemctl apply time. Real systemd Type= accepts a fixed set of values (simple, exec, forking, oneshot, dbus, notify, notify-reload, idle). Consider the existing anyOf: [{enum}, {type: string}] pattern used elsewhere in this file (e.g. dotfiles mode/template) to keep forward compatibility while catching common mistakes.

♻️ Proposed enum with string fallback
       "type": {
-        "type": "string",
+        "anyOf": [
+          {
+            "enum": ["simple", "exec", "forking", "oneshot", "dbus", "notify", "notify-reload", "idle"]
+          },
+          {
+            "type": "string"
+          }
+        ],
         "description": "write Type in the [Service] section"
       },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@schema/mise.json` around lines 3667 - 3670, Update the `type` property in the
`[Service]` schema to validate known systemd `Type=` values with an enum
covering `simple`, `exec`, `forking`, `oneshot`, `dbus`, `notify`,
`notify-reload`, and `idle`, while retaining a string fallback for forward
compatibility. Follow the existing `anyOf` enum-and-string pattern used
elsewhere in the schema.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@schema/mise.json`:
- Around line 3667-3670: Update the `type` property in the `[Service]` schema to
validate known systemd `Type=` values with an enum covering `simple`, `exec`,
`forking`, `oneshot`, `dbus`, `notify`, `notify-reload`, and `idle`, while
retaining a string fallback for forward compatibility. Follow the existing
`anyOf` enum-and-string pattern used elsewhere in the schema.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b31078d0-8d6b-4596-bc47-f45e88ca5da0

📥 Commits

Reviewing files that changed from the base of the PR and between 6a69c2b and 4fe0682.

📒 Files selected for processing (2)
  • e2e/config/test_schema_tombi
  • schema/mise.json

jdx added 2 commits July 16, 2026 07:35
Entire-Checkpoint: 0f84e26412fc
@jdx
jdx force-pushed the codex/fix-systemd-schema branch from 4fe0682 to b1ff031 Compare July 16, 2026 14:38
@jdx
jdx enabled auto-merge (squash) July 16, 2026 14:43
@jdx
jdx merged commit b4e865c into main Jul 16, 2026
33 checks passed
@jdx
jdx deleted the codex/fix-systemd-schema branch July 16, 2026 15:02
@github-actions

Copy link
Copy Markdown
Contributor

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.7 x -- echo 22.9 ± 1.4 19.8 29.3 1.00
mise x -- echo 23.0 ± 2.3 19.2 58.0 1.00 ± 0.12

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.7 env 25.2 ± 2.6 20.2 35.1 1.12 ± 0.18
mise env 22.5 ± 2.8 18.0 34.7 1.00
✅ Performance improvement for env is 12%

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.7 hook-env 20.6 ± 1.1 18.8 28.9 1.06 ± 0.09
mise hook-env 19.4 ± 1.2 17.4 24.9 1.00

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.7.7 ls 17.4 ± 0.9 15.8 22.4 1.00 ± 0.11
mise ls 17.3 ± 1.6 14.6 23.0 1.00

xtasks/test/perf

Command mise-2026.7.7 mise Variance
install (cached) 165ms 164ms +0%
ls (cached) 62ms 62ms +0%
bin-paths (cached) 64ms 61ms +4%
task-ls (cached) 133ms 131ms +1%

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