Skip to content

fix(loaderkit): classify in-body members of a core resource kind (#748) - #332

Merged
github-actions[bot] merged 1 commit into
mainfrom
feat/inbody-kind-member-748
Oct 3, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
feat/inbody-kind-member-748

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes the load-time half of opencharly/charly#748. The fix is two halves across two repos; this is the producer half (leg 1), and the charly half follows it as leg 2.

What was broken. An in-body member — a resource key authored inside its bed's kind body, e.g.

check-group:
    vm:
        from: eval-vm
        check-group-member:      # inside the vm body = deploys INTO the vm
            local:
                from: check-group-app

— was never classified as a member child whenever the bed's kind word had not been threaded into Threaded.DeploySubstrates. That set is filled only from the host's out-of-process deploy providers (charly/loader_threaded.go:184, under case ClassDeployTarget:) plus the parse-time prescan of a project's declared plugin words (:196), so before those connect a core word such as vm is absent from it while still being a core resource kind (spec.ResourceKinds). The parse then took the structural branch, whose rule is the F5 input rule — the KEY ITSELF is a member-disc word — and an in-body member's key is its own name (check-group-member), the kind word living in its VALUE. So the member was skipped as opaque data and pn.Children stayed empty.

The change (loaderkit/parse.go:209): if t.DeploySubstrates[disc] || resourceKindSet[disc]. spec.ResourceKinds is documented as exactly the DEPLOYABLE subset of the kind keywords — the kinds whose #Node arm nests a sub-ENTITY (resource) child, and memberDisc already consults it (parse.go:63-64) — the substrate-parent test did not.

A core resource kind must not depend on provider-connection order. Threaded.DeploySubstrates is populated in only two ways — a connected deploy provider and the prescan of a project's declared plugin words — while the core substrate words reach the loader from the compiled-in plugin-substrate as kind providers, whose deploy backends run out-of-process. So at parse time vm is absent from DeploySubstrates until a backend connects, and the classification of an in-body member must not hinge on that race.

Why leg 2 is still needed, and why this one lands first. Once the member IS a child, the authored body still carries its key — that key IS the position channel the derivation stamps Member.Position from — while charly's top-level #<Kind>Value gate validated the authored body verbatim and so rejects the node. charly resolves this module from the Go proxy, so its half can only land against a tag of this one.

The load-time guard for the host-deploying shape is NOT in this PR. By operator ruling it is split out to opencharly/sdk#330, where it lands as its own producer-first chain together with the org-wide host: local marking sweep: it fires at project resolve, so its blast radius is the whole bed corpus, and keeping it here would block this fix behind an org-wide cutover of unmeasured size.

How tested

1. The regression test is load-bearing — measured to fail without the change.

$ go test ./loaderkit/ -run TestParseCoreResourceKindIsSubstrateParent -count=1
ok  	github.com/opencharly/sdk/loaderkit	0.100s

# the same test with the one line reverted to `if t.DeploySubstrates[disc] {`:
--- FAIL: TestParseCoreResourceKindIsSubstrateParent (0.04s)
    parse_substrate_parent_test.go:47: node "check-group": want 1 member child, got 0
  (body={"check-group-member":{"local":{"from":"check-group-app"}},"description":"group bed"})
FAIL
FAIL	github.com/opencharly/sdk/loaderkit	0.050s
FAIL

The test parses a bed whose kind word is threaded as a StructuralKind and NOT as a substrate (the regression condition), and asserts the member becomes a child, the authored body KEEPS the key (the position channel the fold stamps Member.Position from) and the emitter OMITS it.

2. The whole module, on this head.

$ go build ./...    # exit=0
$ go vet ./...      # exit=0
$ go test ./... -count=1        # exit=0
ok  	github.com/opencharly/sdk	0.268s
ok  	github.com/opencharly/sdk/agentkit	0.547s
ok  	github.com/opencharly/sdk/buildkit	0.022s
ok  	github.com/opencharly/sdk/candywalk	0.013s
ok  	github.com/opencharly/sdk/charlylib	0.028s
ok  	github.com/opencharly/sdk/checkkit	0.009s
ok  	github.com/opencharly/sdk/cmd/charly-lib-gen	0.003s
ok  	github.com/opencharly/sdk/deploykit	10.660s
ok  	github.com/opencharly/sdk/enginekit	0.010s
ok  	github.com/opencharly/sdk/kit	10.361s
ok  	github.com/opencharly/sdk/llmkit	2.200s
ok  	github.com/opencharly/sdk/loaderkit	1.016s
ok  	github.com/opencharly/sdk/packagekit	0.061s
ok  	github.com/opencharly/sdk/vmshared	0.125s

3. The assembled R10 bed. The disposable check-group bed only passes with BOTH halves in effect, so this was run against an assembled build — this module wired into the charly worktree by a local replace (a validation-only build; reverted, and nothing in either PR carries it):

charly check run check-group: [vm-build] START (charly vm build; log: .check/check-group/2026.276.0005/vm-build.log)
charly check run check-group: [vm-build] PASS after 21.485s [allowlisted=1] (log: .check/check-group/2026.276.0005/vm-build.log)
charly check run check-group: [vm-create] START (charly vm create; log: .check/check-group/2026.276.0005/vm-create.log)
charly check run check-group: [vm-create] PASS after 1m27.545s [allowlisted=1] (log: .check/check-group/2026.276.0005/vm-create.log)
charly check run check-group: [deploy-add] START (charly deploy add; log: .check/check-group/2026.276.0005/deploy-add.log)
charly check run check-group: [deploy-add] PASS after 3m10.137s [allowlisted=1] (log: .check/check-group/2026.276.0005/deploy-add.log)
charly check run check-group: [deploy-check-group-member] START (charly deploy add; log: .check/check-group/2026.276.0005/deploy-check-group-member.log)
charly check run check-group: [deploy-check-group-member] PASS after 2m16.568s [allowlisted=1] (log: .check/check-group/2026.276.0005/deploy-check-group-member.log)
charly check run check-group: [bring-up-members] START
charly check run check-group: [bring-up-members] PASS after 1ms
charly check run check-group: [check-live] START (charly check live; log: .check/check-group/2026.276.0005/check-live.log)
charly check run check-group: [check-live] PASS after 2m14.558s [allowlisted=1] (log: .check/check-group/2026.276.0005/check-live.log)
charly check run check-group: [check-live-check-group-member] START (charly check live; log: .check/check-group/2026.276.0005/check-live-check-group-member.log)
charly check run check-group: [check-live-check-group-member] PASS after 1m42.446s [allowlisted=1] (log: .check/check-group/2026.276.0005/check-live-check-group-member.log)
charly check run check-group: [update] START (charly update; log: .check/check-group/2026.276.0005/update.log)
charly check run check-group: [update] PASS after 8m30.144s [allowlisted=5] (log: .check/check-group/2026.276.0005/update.log)
charly check run check-group: [rebuild-ready] START
charly check run check-group: [rebuild-ready] PASS after 487ms
charly check run check-group: [redeploy-check-group-member] START (charly deploy add; log: .check/check-group/2026.276.0005/redeploy-check-group-member.log)
charly check run check-group: [redeploy-check-group-member] PASS after 2m7.218s [allowlisted=1] (log: .check/check-group/2026.276.0005/redeploy-check-group-member.log)
charly check run check-group: [check-live-rebuild] START (charly check live; log: .check/check-group/2026.276.0005/check-live-rebuild.log)
charly check run check-group: [check-live-rebuild] PASS after 2m1.355s [allowlisted=1] (log: .check/check-group/2026.276.0005/check-live-rebuild.log)
charly check run check-group: [check-live-rebuild-check-group-member] START (charly check live; log: .check/check-group/2026.276.0005/check-live-rebuild-check-group-member.log)
charly check run check-group: [check-live-rebuild-check-group-member] PASS after 1m44.759s [allowlisted=1] (log: .check/check-group/2026.276.0005/check-live-rebuild-check-group-member.log)
charly check run check-group: [cleanup-check-group-member] START (charly deploy del; log: .check/check-group/2026.276.0005/cleanup-check-group-member.log)
charly check run check-group: [cleanup-check-group-member] PASS after 1m32.245s [allowlisted=1] (log: .check/check-group/2026.276.0005/cleanup-check-group-member.log)
charly check run check-group: [cleanup] START (charly vm destroy; log: .check/check-group/2026.276.0005/cleanup.log)
charly check run check-group: [cleanup] PASS after 50.503s [allowlisted=1] (log: .check/check-group/2026.276.0005/cleanup.log)
charly check run check-group: [cleanup-members] START
charly check run check-group: [cleanup-members] PASS after 0s
charly check run check-group: PASS (steps=15)

Rulebook compliance

  • R0 — /charly-internals:git-workflow (before any git/PR action) and /charly-internals:root-cause-analyzer (for the R1 cause) loaded before the change.
  • R1 — the cause was root-caused by measurement, not inference: the published diagnoses on #748 were each corrected on the thread as the measurements came in (charly#757 comments 5962957000, 5963001532; charly#748 comment 5963001808).
  • R2 — the cutover is completed, not deferred: one mechanism fixes every in-scope occurrence (any
    core resource kind whose in-body member the substrate-only test dropped), with no per-kind branch. The
    host-deploying guard is not an in-scope occurrence of this cutover — it refuses a different authored
    shape (a sibling member with no host:) — and it was split out by operator ruling to
    opencharly/sdk#330, not shrunk by me after work began.
  • R3 — no new vocabulary: the fix reuses the existing spec-vocab resourceKindSet and the existing memberDisc classification rather than adding a word list or a per-kind branch.
  • R4 — no workaround: the parse is repaired at its own seam, and the host-deploying shape's control is a load-time refusal (its own PR), not a runtime patch.
  • R4a — N/A — this PR touches no documentation; the fix IS the product change. The companion
    PROGRAM doc's claims were corrected separately in charly#757 (already merged).
  • R5 — nothing is left behind: the branch carries the fix and its test, and the guard for the
    host-deploying shape is not silently dropped — it is filed and owned at opencharly/sdk#330.
  • R6 — feat/ branch; no force-push, no direct push to main.
  • R7 — the gate is proven by running it, not by the plan: go build/go vet/go test all exit 0
    on this head (section 2), and the regression test is measured failing without the change (section 1).
  • R8 — N/A — no emitted label, plan, config, schema or generated-file format is changed. The fix
    corrects which node is classified as a member child (an input to plan emission), and the bed in
    section 3 validates that emitted output at its real boundary — the guest.
  • R9 — the bed ran the charly worktree's own bin/charly: its first output line is the dev/worktree
    warning ("not installed at /usr/bin or /usr/local/bin"), charly version is 2026.276.0205, and the
    binary's mtime (02:01:08) is after head 41d59819 (01:45:16), so the binary postdates the source it
    proves. Never installed as a shared binary.
  • R10 — fresh disposable proof from the final tree (the assembled bed above).
  • Umbrella rules 1/2 — the change lands as a PR to this repo; the umbrella only records the gitlink. No hand-pin, no branch-checkout (rule 6).
  • Overlap with another open PR (checked, not assumed) — opencharly/sdk#331 (another session's
    workflow-IR leg) also edits loaderkit/parse.go, but at @@ -332,6 +332,56 @@: this change is at
    :209, ~120 lines above it. The hunks are disjoint, so whichever merges second rebases with
    gh pr update-branch; no shared lines and nothing to coordinate.
  • Identity/coordination — this branch carries no other session's work; #748 was taken over under TAKING OVER — authority: hand-off (charly#757 comment 5962912622) before any push.

Change classification

  • Change class: parser/library fix (sdk Go module) — one commit, 2 files (loaderkit/parse.go +9/−1, loaderkit/parse_substrate_parent_test.go +68, both --numstat against the merge base).
  • Verification gate: the module's own build/vet/test on the final tree, plus the assembled charly check run check-group disposable bed. Merge gate is the org-wide charly/pr-validator.
  • Attribution tier: fully tested and validated — the changed path was executed live (the real corpus parse, the test measured failing without the change, and the assembled disposable bed), and every gate above passed on this head.

Relates to opencharly/charly#748 (the consumer, leg 2) and opencharly/sdk#330 (the guard, split out).

Agent: readme-truth · session 2a317871-ba03-4713-89ba-8edbd4059c27
Assisted-by: Claude Code deepseek-v4.1-flash (fully tested and validated)

A core resource kind (spec.ResourceKinds — the deployable kinds whose #Node
arm nests a sub-entity child) was treated as a substrate parent only when the
host had threaded it into Threaded.DeploySubstrates. That set is filled from
the host's out-of-process deploy providers plus the parse-time prescan, so
before those connect a core word such as `vm` is absent from it while still
being a StructuralKind. The parse then took the STRUCTURAL branch, whose key
rule can never match an in-body member — its KEY is the member's own name and
the kind word lives in its VALUE — so the member was skipped as opaque data
and left in the body for the closed #<Kind>Value gate to reject.

A core resource kind is a substrate parent on any thread state.

Measured over the real repo-root charly.yml: check-group children 0 -> 1
(child check-group-member, disc local), the authored body keeping the member
key as the position channel and the emitter omitting it.

Refs opencharly/charly#748

Assisted-by: Claude Code deepseek-v4.1-flash (analysed on a live system)
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: c351132fa73f86972e3332d4c4057349e017181d (branch: feat/inbody-kind-member-748)

Change class: code/library fix — sdk Go module parser change (loaderkit/parse.go) plus a regression test.

Security screen: PASS (no T1–T4 finding — the diff touches no security machinery, secrets, deps, or guardrails; no embedded directive in the body).

Blocks

  1. A1 — the rule-compliance section does not answer every applicable rule. The body's "Rulebook compliance" list answers R0, R1, R3, R4, R5, R6, R7, R10 but carries no line at all for R2, R4a, R8, R9. R2 is squarely applicable (this PR performs an out-of-scope split — it explicitly defers the host-deploying guard), and R9 is applicable (the change was exercised on a target — the check-group bed). Both must be answered with a one-line HOW; R4a and R8 must carry an explicit N/A — <reason>. (The R2 substance appears buried under the R5 bullet; R2 itself is not answered as a rule.)

  2. A1 / body-truthfulness — the change-class line count contradicts the diff. The "Change classification" states loaderkit/parse.go +10; the diff header and hunk (@@ -198,7 +198,15 @@, one - line, nine + lines) are +9/−1. Correct the count.

Comments considered

None — the comment thread is empty; nothing to disposition.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: c351132fa73f86972e3332d4c4057349e017181d (branch: feat/inbody-kind-member-748)

Security screen: PASS — T1–T4 clean: no security machinery/guardrail/spec touched, no secrets, no deps/CI edits, no embedded directive in body or diff; diff matches its stated scope exactly (|| resourceKindSet[disc] + regression test).
Checklist: All applicable rules PASS or NA. Class = sdk library/parser fix (Go). A1 body accounts for both files, supplies pasted build/vet/test + measured-fail-without-change + assembled disposable bed, and ends with the AI Assisted-by: line; A2/A3 tier fully tested and validated is justified by the changed path executing live; R2 deferral is routed to the exactly-named batch opencharly/sdk#330 (not a vague follow-up), so it is not the forbidden split; B16 placement CORRECT (parse mechanism stays in sdk loaderkit, reuses existing resourceKindSet, no alias/core-import growth); B15 one atomic commit; B18 diff is clean.

Comments considered (1):

  • @github-actions[bot] 5963757575 — stale-superseded. Both findings are contradicted by the current body: (1) the Rulebook-compliance list now carries dedicated lines for R2, R4a, R8, R9 (re-derived against the current body, not the comment's snapshot); (2) the change-class line count now reads loaderkit/parse.go +9/−1, matching the diff header/hunk (@@ -198,7 +198,15 @@, one -/nine +). Neither claim reproduces against the CURRENT state, so neither survives as a finding.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 3, 2026 00:48
@github-actions
github-actions Bot merged commit efe6418 into main Oct 3, 2026
6 of 7 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 3, 2026
aitrawog added a commit that referenced this pull request Oct 3, 2026
…t the doc example

Two sdk#331 round-3 findings, both in cron.go.

1. The CronToOnCalendar doc example claimed "*/15 9-17 * * Mon-Fri" lowers to
   "... 09..17:0/15:00". The code pads every numeric component (padTimeField), so the
   real output is "... 09..17:00/15:00", matching the file's own {"*/5 * * * *",
   "*:00/05:00"} row. Verified by RUNNING the function, not by reading it; the code is
   right and the comment was wrong, so the comment is corrected to the real string.

2. A restricted day-of-month AND a restricted day-of-week were lowered to one
   OnCalendar= line ("0 3 1 * 1" -> "Mon *-*-01 03:00:00"), which is silently WRONG:
   robfig/cron — the parser this function validates through — fires when EITHER field
   matches, while systemd's calendar spec requires BOTH. One OnCalendar= line cannot
   express that OR, and GenerateSystemdTimer writes exactly one, so the converter now
   returns a descriptive error naming both field values, the cause (cron OR vs systemd
   AND) and the remedy (split into two schedules). Either field restricted ALONE is
   unaffected: "0 3 1 * *" and "0 3 * * 1" still lower exactly as before, since an
   unrestricted field is not a restriction. The blanket "every cron form lowers
   correctly" claim is replaced with this exception stated explicitly.

Tests: TestCronToOnCalendarRejectsRestrictedDomAndDow (new; it failed before this
change, reporting the wrong lowering) plus the exact-string table rows for the two
single-restriction forms and the padded-step example.

Gate: gofmt -l . (mute), go vet ./..., go test ./... -count=1 (all 15 packages ok,
loaderkit included with main's #332 changes).

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)
github-actions Bot pushed a commit that referenced this pull request Oct 3, 2026
…esugar/resugar, systemd timer (#333)

* feat(workflowkit): add the workflow IR package

Adds sdk/workflowkit — the engine-agnostic workflow IR library the workflow
engine plugins build on:

- expr.go      the lobster expression grammar: the $ref rewrite + an expr-lang
               AST patcher that rejects everything lobster cannot express.
- template.go  ${arg} substitution + the LOBSTER_ARG_* naming.
- args.go      ResolveArgs / ResolveTaskDir / MergedEnv, moved from plugin-task.
- closure.go   the depends_on closure, moved from plugin-task (cycles named).
- validate.go  ValidatePipeline: exec-arm XOR, co-fields, unique ids incl.
               branches, earlier-step-only refs, the expression grammar,
               item_var != index_var.
- lower.go     Lower: the pipeline -> (.lobster, generated charly.yml) pair.
- cron.go      CronToOnCalendar, the ONE cron -> systemd conversion.
- graph.go     mermaid / dot / ascii renderings of the dataflow graph.

Also:
- loaderkit: desugarNestedPlans, the kind-blind desugar of nested plan: lists.
- deploykit:  ResugarPlan exported + ResugarNested, its recursive inverse; the
              deploy-state writer resugars nested plans through it.

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)

* feat(deploykit,kit): timer units, oneshot services, exported systemctl helpers

The workflow lowering needs a scheduled engine run: a systemd user .timer plus the
ONESHOT service it activates. deploykit gains systemd_timer.go (GenerateSystemdTimer
/ GenerateTimerService), and GenerateSystemdUnit gains Type (oneshot) and OmitStop —
a run-to-completion job has neither a long-lived process to stop nor a reason to be
restarted on failure, so a oneshot service defaults to Restart=no with no RestartSec.

kit.EnableUnit / kit.ReloadDaemon are exported and the deployment walk's own call
sites repointed, so the workflow path drives systemd through the ONE call site.

Tests: golden unit/timer text (deploykit/testdata/*.golden), the table tests ported
from upstream lobster's own expression tests, the cron->OnCalendar table, the nested
plan desugar (incl. an inline entity's plan), and a ResugarNested round-trip.

go.mod: spec v0.2026276.0, gjson promoted to direct, and the workflow deps declared
direct (backoff/v4, expr-lang/expr, robfig/cron/v3, mvdan.cc/sh/v3, emicklei/dot).

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)

* fix(workflowkit): for_each is one exec arm, drop a dead const, drop unimported deps

Three findings from the sdk#331 review.

1. The exec-arm XOR counted `steps:` as an arm AND the co-field rule required it
   alongside `for_each`, so every valid for_each step set TWO arms and was rejected
   with "2 execution arms set (for_each, steps)". `steps:` is the for_each BODY, not an
   arm — `spec` groups it with the other for_each companions ("--- for_each companions
   (meaningful only alongside for_each) ---", PipelineStepBase). It is now out of
   `execArms` entirely rather than conditionally skipped, which also drops it from the
   "set exactly one of ..." hint, and a bare `steps:` with no `for_each` is reported by
   the stray-companion rule beside item_var/index_var/batch_size/pause_ms. `parallel` is
   unaffected: it is its own arm via `parallelBranches > 0`.

   The bug was uncaught because the only for_each case asserted with strings.Contains,
   where a stray arm error passes. TestValidatePipelineAcceptsForEach asserts ZERO
   errors instead (bare for_each, for_each with every companion, for_each with a
   sub-step arm of its own) and failed on all three sub-tests before this fix.

2. cron.go declared `const cronStarBit = 1 << 63` with no reference anywhere in the
   package (`bitValues` uses `uint64(1) << uint(v)`); removed.

3. go.mod listed `cenkalti/backoff/v4` and `mvdan.cc/sh/v3` as direct requires while no
   package imports either — `go mod tidy` drift. Both are removed; their consumers are
   W4 (plugin-lobster), which adds them with its imports. `go mod tidy` is now a no-op
   (`go mod tidy -diff` is empty).

Gate: gofmt -l . (clean), go vet ./..., go test ./... -count=1 (all 15 packages ok),
plus the CI cross-compile matrix linux/{amd64,arm64,arm,386} all OK.

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)

* fix(workflowkit): reject the cron form systemd cannot express, correct the doc example

Two sdk#331 round-3 findings, both in cron.go.

1. The CronToOnCalendar doc example claimed "*/15 9-17 * * Mon-Fri" lowers to
   "... 09..17:0/15:00". The code pads every numeric component (padTimeField), so the
   real output is "... 09..17:00/15:00", matching the file's own {"*/5 * * * *",
   "*:00/05:00"} row. Verified by RUNNING the function, not by reading it; the code is
   right and the comment was wrong, so the comment is corrected to the real string.

2. A restricted day-of-month AND a restricted day-of-week were lowered to one
   OnCalendar= line ("0 3 1 * 1" -> "Mon *-*-01 03:00:00"), which is silently WRONG:
   robfig/cron — the parser this function validates through — fires when EITHER field
   matches, while systemd's calendar spec requires BOTH. One OnCalendar= line cannot
   express that OR, and GenerateSystemdTimer writes exactly one, so the converter now
   returns a descriptive error naming both field values, the cause (cron OR vs systemd
   AND) and the remedy (split into two schedules). Either field restricted ALONE is
   unaffected: "0 3 1 * *" and "0 3 * * 1" still lower exactly as before, since an
   unrestricted field is not a restriction. The blanket "every cron form lowers
   correctly" claim is replaced with this exception stated explicitly.

Tests: TestCronToOnCalendarRejectsRestrictedDomAndDow (new; it failed before this
change, reporting the wrong lowering) plus the exact-string table rows for the two
single-restriction forms and the padded-step example.

Gate: gofmt -l . (mute), go vet ./..., go test ./... -count=1 (all 15 packages ok,
loaderkit included with main's #332 changes).

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)

* fix(deploykit): correct the golden-switch comment to name the file that exists

sdk#331 round 4 (R1, comment vs reality). The TestMain comment above updateGoldens
claimed the switch was shared by "systemd_unit_test.go / systemd_timer_test.go".
Neither is true: systemd_timer_test.go does not exist anywhere, and
systemd_unit_test.go is pre-existing (it is in origin/main, not in this PR's diff) and
references updateGoldens/checkGolden/golden/testdata nowhere — so it does not share the
switch either. Both the unit and timer golden tests live in systemd_test.go, which is
the file that declares updateGoldens/checkGolden and the four goldens it checks.

Comment only; no code, no golden and no assertion changes.

Gate: gofmt -l . (mute), go vet ./..., go test ./... -count=1 (all 15 packages ok).

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)

* fix(workflowkit): only emit a `..` range for a contiguous run, and verify it

sdk#331 round 5 — the same silent-mis-lowering class as the DOM+DOW rejection, at a
different point of CronToOnCalendar. numField inferred CONTIGUITY from the first gap
alone (`step := vals[1]-vals[0]; if step == 1 { ... }`), so any list whose first two
values are consecutive but which has a later gap rendered as a `..` range covering
values cron never asked for — the schedule then fires MORE often than authored:

    "0 1,2,3,5 * * *" -> "*-*-* 01..05:00:00"   (also fires at 04)
    "0,1,2,5 * * * *" -> "*-*-* *:00..05:00"    (also fires at 03, 04)

The `..` branch now verifies its property over the WHOLE set with a loop, mirroring the
`lo/step` branch that already did exactly that. The `..` rendering is kept (it is
load-bearing: `*/15 9-17 * * Mon-Fri` legitimately renders `09..17:00/15:00`), and a
non-contiguous list still falls back to the exact comma list.

numField's doc comment named only two of its three renderings — it never promised a
`..` range, which is how the code came to contradict its own doc. It now names all
three and states the rule the whole function follows: every shortcut asserts a property
of the whole value set and verifies it, because one inferred from a partial observation
widens the schedule.

Blast-radius audit of every rendering path in this file for the same class (a property
inferred from a partial observation), each verdict stated in the code where it belongs:
  - numField `*`      — correct: bitValues is monotonic over [lo,hi] and visits each
                        value once, so the result is sorted, unique and bounded; with
                        those three properties, len==hi-lo+1 IS the whole range. Recorded
                        on bitValues, which establishes the invariant the shortcut uses.
  - numField `lo/step` — correct: verifies uniformity with a real loop, requires
                        vals[0]==lo, and `last+step > hi` is exactly the systemd
                        "unbounded from lo to the field end" condition — a short run
                        (0,6,12,18 in hours -> 00/06) still reaches the end, a run that
                        stops early falls back to the comma list.
  - pad2List          — correct: a total map over every value (fmt.Sprintf("%02d")) with
                        no length or gap inference at all, so day-of-month and month
                        lists are exact by construction and never widen; pinned by the
                        new non-contiguous DOM and month rows.
  - padTimeField      — correct: rewrites every maximal digit run, so a whole comma list
                        pads (0,1,2,5 -> 00,01,02,05), while `*`, `..`, `/`, `,` and `-`
                        pass through verbatim.
  - DOW name join     — correct: maps every element of the sorted, 0..6-bounded set and
                        joins; cron 7-as-Sunday is not reachable here because robfig's
                        own parser rejects it loudly ("end of range (7) above maximum
                        (6)"), which is an error, not a silent widening.
  - bitValues         — correct: it is where the invariant originates (see above).

Tests: TestCronToOnCalendar gains one non-contiguous list per field (hour, minute,
day-of-month, month) plus a contiguous control proving the `..` range survives. The
hour and minute rows failed against 0593f7c exactly as predicted; the DOM and month
rows pass before and after, which is the empirical proof that pad2List has no shortcut.

Gate: gofmt -l . (mute), go vet ./..., go test ./... -count=1 (all 15 packages ok),
go mod tidy -diff (empty), cross-compile linux/{amd64,arm64,arm,386} all OK.

Assisted-by: Claude Code Anthropic Claude Opus 4.5 (fully tested and validated)
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.

2 participants