Skip to content

id(world_manifest): apply() re-checks only grants/ceiling/schedule-id — ScheduleAt fire time and the 64 cap, SetProfile bounds, and InstallModule hash fold unvalidated #4769

Closed

Description

@dezren39

Problem

pkgs/id/src/world_manifest.rs — WorldManifest::validate() (lines 216–256) refuses:

  • a schedule with at_ms == 0 ("must fire in the future", line 236),
  • more than MAX_PENDING_SCHEDULES (64) schedules (lines 229–233),
  • a module_hash that is not 1..=64 hex digits (lines 244–255),
  • a profile whose bounds fail WorldExecutionProfile::validate() (line 227: wasm_fuel == Some(0), memory below the floors, etc.).

apply() (lines 373–424) is documented as the defensive re-check ("A step that names an unknown capability (a manifest should be validated first; this is a defensive re-check)"), and it does re-check two step kinds — SetGrants/SetCeiling re-run validate_grant_names/validate_ceiling_names (lines 386, 394) and ScheduleAt re-runs validate_schedule_id (line 405). But the other step kinds get no re-check at all:

  • ScheduleAt accepts at_ms == 0 and folds any number of schedules into state, past the 64 cap.
  • SetProfile accepts a profile that profile.validate() refuses (e.g. wasm_fuel: Some(0)).
  • InstallModule accepts a non-hex, over-long, or empty hash and stores it as the live module hash.

So a step list that did not come from a validated manifest (programmatic construction, a future caller, a deserialized plan) can fold a state that parse/validate would never let a manifest describe — and apply's own changed-count then reports it as a successful reconciliation. The re-check is inconsistent: either it is load-bearing (then it should cover every invariant validate() enforces) or it is decoration on exactly the fields that happen to have a helper handy.

Evidence (verified this run, origin/main a8aa52d)

Laptop probe (worktree ~/git/fleet/probe-2026-11-02-laneA-scan7, pkgs/id/tests/probe_manifest_apply.rs against the real id crate, cargo test, probe removed after the run):

  • apply([ScheduleAt { id: "wake", at_ms: 0 }]) → Ok(1), schedule stored with fire time 0.
  • apply([SetProfile { wasm_fuel: Some(0), .. }]) → Ok(1), profile stored.
  • apply([InstallModule { hash: Some("zz!" × 40), source: None, seed: 1 }]) → Ok(1), 120-char non-hex hash stored as module_hash.
  • apply(65 distinct ScheduleAt steps) → Ok, 65 schedules in state (cap is 64).
  • Control: apply([SetGrants { grants: ["no.such.cap"] }]) → Err — the re-check exists for grants, confirming the gap is the missing coverage on the sibling steps, not a design of "apply never validates".

Dedup: searches (all states) for world_manifest apply, ApplyStep, and open manifest issues found #2876 (closed; unknown TOML keys), #2882 (closed; check_schedule_replacing cap), #3015/#1519 (cited in the code; parse-time profile validation and seed/ceiling plan semantics). No open or closed issue covers apply()'s partial re-check.

Why it matters

apply is the pure fold the manifest tests and the server-side reconciliation model are checked against; a fold that accepts states the manifest layer forbids makes the model lie about what a live world can look like, and any future caller that builds steps without going through parse inherits the hole silently. The inconsistency is the bug: two of five step kinds re-validate, three do not.

Acceptance criteria

  • apply refuses a ScheduleAt step with at_ms == 0, naming the schedule id, in the style of validate() line 236.
  • apply refuses a step list that would leave the state with more than MAX_PENDING_SCHEDULES schedules.
  • apply refuses a SetProfile step whose profile fails WorldExecutionProfile::validate().
  • apply refuses an InstallModule step whose hash is not 1..=64 hex digits (the validate() rule at lines 244–255).
  • Regression tests sit alongside the existing world_manifest tests covering each refusal above, plus the already-working grant/ceiling/id refusals; valid step lists fold exactly as before (existing tests green, changed-count semantics unchanged for valid input).
  • No change to plan() output or to WorldManifest::validate() itself.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 3, 2026
  2. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (lane A, new-issue-creator-code-a)
    • Session / ID: cron new-issue-creator-code-a, run 2026-11-02 23:35 CST
    • Found via: filed this run
    • Task: Filed after verifying on the laptop that world_manifest::apply() folds ScheduleAt/SetProfile/InstallModule steps without the re-checks its sibling steps get — probe results are in the issue body.
    • Expectation: effort s; done when apply() refuses the four invalid step shapes in the acceptance criteria and the regression tests pass, with plan()/validate() unchanged.
    • Links: queue packet to follow in this run (repo-health-code-pilot)
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 3, 2026
  4. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  5. added a commit that references this issue on Nov 3, 2026
  6. dezren39 commented on Nov 3, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions