Repository navigation
T15 — Read the type tables as box entries - #3091
Conversation
[sessions|tasks|agents|services.<name>] read as [boxes.<name>] with the matching type (BOX-046). An entry name that is self, not DNS-safe, or not unique in the file fails with exit 3 naming the entry (BOX-007).
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Reviewed: 1 finding, none blocking at Address the comments on the diff. Clobber: none: the diff only adds code. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 1 condition · the full ruling
The name rules for BOX-007 and BOX-046 conform, and mfile is the right owner. One deviation remains. read_entries keeps an explicit type key in a sugar table, so [sessions.x] type = "task" reads as a task. Line 1176 of architecture.md says [agents.reviewer] is exactly [boxes.reviewer] with type = "agent". C1 refuses a sugar type that is not the noun, with exit 3, and changes the test that pins rust-dev.
Ruled at 293255b against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
A type-noun table sets its noun's type. A different type, or a type that is not a string, now fails with exit 3 and names the entry.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
minimal.toml type tables ([sessions.x], [tasks.x], [agents.x], [services.x]) read as [boxes.x] entries with the noun's type. An entry named self fails with exit 3 and names the entry. A sugar table with a different type, or any entry with a non-string type, now also fails with exit 3 and names the entry. Notes from the agent: Revise round 1. Two new EntryNameRule variants (TypeNotString, TypeMismatch) carry the type refusals through Error::InvalidEntryName, as the review asked. That variant name now covers more than names. A rename is left for a later change. The arch review cites line 1176 of architecture.md, but docs/architecture.md has 251 lines on this branch. The fix follows BOX-046 ('with the matching type') instead. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms. A sugar table now always carries its noun's type, as architecture.md line 1176 says: [agents.reviewer] is exactly [boxes.reviewer] with type = "agent". A different or non-string type fails with exit 3 and names the entry. The self, DNS-label and uniqueness rules from the earlier head stay as they were. Nothing calls read_entries yet. T16 (#2410) wires it to a command.
Ruled at f73d528 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
|
Round 2 of 10 on the runtime's review findings: the coder changed nothing. This round changes no code. The design note from round 1 is out of date and this note replaces it. The rule for a type-noun table is now: the table sets the type of its noun. It can repeat that type, for example [sessions.x] type = "session". Any other string type in it, for example [sessions.x] type = "rust-dev" or type = "task", fails with exit 3 (EntryNameRule::TypeMismatch). A type that is not a string fails with exit 3 in every table (EntryNameRule::TypeNotString). A [boxes.] table keeps the string type it writes. A custom type therefore goes in [boxes.], not in a type-noun table. Round 2 (commit f73d528) made this change on the earlier review threads, which cite architecture.md line 1176. The module doc of crates/mfile/src/entry.rs and the test type_noun_tables_are_boxes_sugar already state and pin this rule. The later expander task must build on this rule. Review threads the coder judged:
|
There was a problem hiding this comment.
Reviewed f73d528 against T15's plan block. Only the three planned files change (entry.rs new, error.rs, lib.rs). read_entries reads [boxes.*] and the four type-noun tables as box entries; self, non-DNS-safe names and duplicates fail with InvalidEntryName (exit 3, naming the entry by its header); a sugar table may repeat its noun's type, another string type fails with TypeMismatch and a non-string with TypeNotString (arch C1). The three planned tests are present (self_as_name_is_exit3, type_noun_tables_are_boxes_sugar, entry_name_invalid_exit3_names_entry). Each message states the problem and one fix. Arch PASS, required lanes green.
T15 — Read the type tables as box entries
slice: S4
kind: task
covers: BOX-007, BOX-046
size: M
est: 220 code, 180 tests
executor: agent
difficulty: routine
model: standard
diagnostics: error names entry and rule
observability: none: parsing emits only the error
layers:
- entries:
- crates/mfile/src/entry.rs (new): type tables as entries
- crates/mfile/src/lib.rs: mod line
- crates/mfile/src/error.rs: invalid-name error
test: cargo nextest run -p mfile self_as_name_is_exit3
test: cargo nextest run -p mfile type_noun_tables_are_boxes_sugar
test: cargo nextest run -p mfile entry_name_invalid_exit3_names_entry
produces:
- crates/mfile/src/entry.rs
consumes: none
proof: Type tables read as box entries;
selfis refused.depends on:
- blocked by #2407
Proof
mfile::entry::read_entries reads [sessions.], [tasks.], [agents.] and [services.] as [boxes.] entries with type session, task, agent or service. An entry named self, a name that is not a lowercase DNS label, or a name used twice in the file fails with Error::InvalidEntryName. Its exit_code() is 3, and its message names the entry header, for example "entry
[sessions.self]in minimal.toml:selfis reserved and cannot name an entry. Rename the entry."Notes from the agent: The new module is a library function only. No caller uses read_entries yet, so no command prints the new error today. A later task (the expander, T16 / #2410) must call it. mfile errors had no exit codes before this change. I added Error::exit_code() -> Option, which gives Some(3) for InvalidEntryName and None for every other variant. Callers must map it to the process exit. Design choices that the spec leaves open: (1) a sugar table sets its noun's type: it can repeat that
type([sessions.x] type = "session"), any other stringtypein it fails with exit 3 (EntryNameRule::TypeMismatch), and atypethat is not a string fails with exit 3 in every table (EntryNameRule::TypeNotString). A custom type goes in[boxes.<name>]. (Corrected after round 2; the earlier wording said a customtypein a sugar table stays as written.) (2) A [boxes.] entry with notypereads with box_type None. Nothing refu 8000 ses it here. (3) [agents.] and [services.] entries are read and keep EntryTable::Agents / Services. The per-entry refusal is BOX-063, which this task does not cover. (4) DNS-safe means 1 to 63 of a-z, 0-9 and '-', with no hyphen first or last. Uppercase is refused. (5) For a duplicate, the error names the later entry and the earlier one, with tables read in the order boxes, sessions, tasks, agents, services. lib.rs also re-exports EntryNameRule beside Error, on the same line as the mod line. Nothing outside the layers changed.Tests
cargo nextest run -p mfile self_as_name_is_exit3cargo nextest run -p mfile type_noun_tables_are_boxes_sugarcargo nextest run -p mfile entry_name_invalid_exit3_names_entryVerify
min task run agent-verifypassed ([tasks.verify]).Closes #2409