8000 T127 — Each lifecycle hook in the stored spec names its declarer, and the selected loadouts reach the expansion · Issue #3311 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content
< 8000 link rel="modulepreload" href="https://github.githubassets.com/assets/lt-5adda46997ed68bd.js" crossorigin="anonymous" />

T127 — Each lifecycle hook in the stored spec names its declarer, and the selected loadouts reach the expansion #3311

Open

Description

@agent-137

Task

slice size difficulty model who estimated lines
Types only narrow M needs care strongest an agent 380 (160 code, 220 tests)

Each lifecycle hook in a box's expanded and stored spec names who declared it: { kind = "loadout", name = "<loadout>" } for a hook a selected loadout declares, and { kind = "project" } for one that any layer of minimal.toml declares. The selected loadouts reach the expansion as their own layer, so a loadout's hooks get their declarer and BOX-183's refusal of a conflicting loadout var runs before the box is created.

Covers:

  • BOX-179

This task also closes #3302. box_entry builds Layers with an empty loadouts table today, so neither a loadout's hooks nor its vars reach mfile::expand::expand. BOX-179 needs the loadout's name on each of its hooks, so this task fills that layer, one table for each selected loadout with its name.

Layers:

  • expansion:
    • crates/mfile/src/expand.rs: Layers::loadouts becomes one table for each selected loadout, in selection order, each with the loadout's name. When the fold appends a layer's lifecycle_hooks, it writes declared_by into each hook table: { kind = "project" } for [defaults], [defaults.<type>], a project Box Type's defaults and the entry, and { kind = "loadout", name } for a loadout's layer. A hook that two declarers declare stays once for each. The vars merge (T125) reads the loadout layers in the same order, so BOX-183 still names the loadout.
    • crates/mfile/src/spec.rs: a lifecycle_hooks table accepts the declared_by key, with kind project or loadout, and name only for loadout
    • cargo nextest run -p mfile expanded_lifecycle_hooks_carry_declared_by
  • client:
    • crates/minimal/src/cmd/boxes/create.rs: box_entry passes each gated, selected loadout (T126) to Layers::loadouts with its name, for min box create, min session start and min task run
    • crates/minimal/src/tests.rs: tests
    • cargo nextest run -p minimal stored_spec_keeps_each_hook_with_its_declarer
    • cargo nextest run -p minimal conflicting_loadout_var_refused_before_create

stored_spec_keeps_each_hook_with_its_declarer creates a box whose entry declares one hook and whose loadout dev declares another. It reads the box's stored spec back and checks both hooks: one with { kind = "project" }, one with { kind = "loadout", name = "dev" }. conflicting_loadout_var_refused_before_create runs min task run with a loadout that sets a var to a different value than the entry. It checks exit 3, T125's BOX-183 message, and that no box record exists.

User-facing text. This task adds no message. min box spec <entry> and min box spec <box> show declared_by in the hook tables they already render. BCLI T41 (#3283) renders the hooks rows from it. The BOX-183 refusal text is T125's and is pinned there.

Observability. The expansion report records the layer each hook came from, as it does for other keys.

Owner decisions this task follows:

Plan block
### T127 — Each lifecycle hook in the stored spec names its declarer, and the selected loadouts reach the expansion
  slice: S5
  kind: task
  covers: BOX-179
  size: M
  est: 160 code, 220 tests
  executor: agent
  difficulty: needs care
  model: strongest
  diagnostics: min box spec shows declared_by on each hook; a BOX-183 refusal names the loadout
  observability: the expansion report records the layer of each hook
  layers:
    - expansion:
      - crates/mfile/src/expand.rs: one loadouts layer per selected loadout with its name; write declared_by into each hook as the fold appends it
      - crates/mfile/src/spec.rs: a lifecycle hook table accepts declared_by
      test: cargo nextest run -p mfile expanded_lifecycle_hooks_carry_declared_by
    - client:
      - crates/minimal/src/cmd/boxes/create.rs: box_entry passes each gated selected loadout with its name
      - crates/minimal/src/tests.rs: tests
      test: cargo nextest run -p minimal stored_spec_keeps_each_hook_with_its_declarer
      test: cargo nextest run -p minimal conflicting_loadout_var_refused_before_create
  produces: none
  consumes:
    - crates/mfile/src/expand.rs
  proof: A box with a project hook and a loadout hook stores both with their declarers, and a conflicting loadout var fails the create with exit 3 before any record exists.
  depends on:
    - blocked by #3248
    - blocked by #3254

The pull request for this task closes #3282 and #3302.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0