Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions TODO/TODO_hacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ represented as empty collection).

## Tasks

- [ ] Hack 1: Replace `Satisfies` comment-only codegen with runtime callback or typed matcher variants
- [x] Hack 1: Replace `Satisfies` comment-only codegen with typed matcher variants
- Added `IsBool`, `IsInt`, `IsString`, `IsRequest`, `IsResponse`, `IntGe(i64)`, `IntLe(i64)` to `OutputMatcher`
- All typed matchers generate real assertions in codegen (via `Assert::True` with method chains)
- Migrated existing `Satisfies` usages in `ci/graph_mock.rs` and `makegen/graph_mock.rs`
- `Satisfies` remains as escape hatch for truly custom predicates
- [x] Hack 2: Add `Value::Response`/`Value::Request` support (done via ValueExpr pipeline)
- [ ] Hack 2: Update parse node examples to use real transport responses
- [x] Hack 3: Make `NonEmpty` codegen type-aware (or add `Value::is_empty()`)
Expand All @@ -311,14 +315,14 @@ represented as empty collection).
The old `value_to_rust_literal` is a one-liner delegating to this
pipeline; the old `value_to_code` and `to_check_code` in mock_spec.rs
have been deleted as dead code.
- Hack 1 is independent — it's about closure serialization, not Value
serialization. The "typed matcher variants" approach (option 2) is
probably the cleanest since it keeps generated tests self-contained.
Typed matchers form a small finite logic language that's both
serializable to codegen and amenable to future proof generation.
- **Hack 1 resolved**: Typed matcher variants (`IsBool`, `IsInt`, etc.)
now generate real codegen assertions. These are serializable to Rust
source without closure references. `Satisfies` remains only for
complex predicates that can't be expressed as simple type/range checks.
Existing usages in CI and makegen graph mocks have been migrated.
- Hack 5 is the most architecturally important — it blocks meaningful
cardinality boundary testing. If Empty doesn't test absence, the
B.3 tests exercise a subset of what they claim to cover.
- None of the remaining hacks are blocking. Tests compile, run, and
pass. The risk is false confidence — tests that look like they verify
behavior but actually don't.
- Only hacks 2 (parse node examples) and 5 (absence testing) remain.
Both require deeper infrastructure changes (transport serialization
and `Option<Value>` semantics respectively).
27 changes: 17 additions & 10 deletions TODO/TODO_type_system.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,31 +117,31 @@ Examples:

---

## 6. Cardinality-driven CLI generation (partial) ✅
## 6. Cardinality-driven CLI generation ✅

**Implemented**: `gunbc-dag/src/makegen/registry.rs` now checks
`ep.type_id == "List" || ep.type_id == "Set"` instead of just `"List"`.
A TODO comment marks this for replacement with `cardinality.allows_many()`
when `CliEntrypoint` carries `Cardinality` (part of codegen rework).
**Implemented**: `CliEntrypoint` now carries a `cardinality: Cardinality`
field (`core/codegen/src/cli_gen.rs`). All CLI generation logic —
`rust_type()`, `value_constructor()`, `is_repeatable()`, arg parsing,
help text — derives collection behavior from `cardinality.allows_many()`
instead of string-matching `type_id == "List"`.

The makegen registry (`gunbc-dag/src/makegen/registry.rs`) now uses
`ep.cardinality.allows_many()` directly, eliminating the TODO that
previously marked this for replacement.

**Loop pattern fixed**: `core/ir/src/patterns/loop_pattern.rs` defaults
now use `"String"` as the type_id (element type) instead of `"List"`.
Cardinality `ZERO_OR_MORE` handles the collection semantics — this
eliminates the dual encoding where `"List"` was both a type name and
a cardinality indicator.

**What's next**: Add `cardinality: Cardinality` field to `CliEntrypoint`
and replace all `type_id ==` string checks in codegen. This is being
addressed in the codegen rework.

---

## Remaining Tasks

- [ ] Move toward structural type DAG comparison in Port (item 1)
- [ ] Wire cardinality through to codegen emptiness checks (item 2, codegen rework)
- [ ] Model target language elements as structured data (item 3, codegen rework — in progress)
- [ ] Add `cardinality` field to `CliEntrypoint` (item 6, codegen rework)
- [ ] Wire `contract::witnesses()` into testgen (codegen rework)

## Completed
Expand All @@ -153,6 +153,13 @@ addressed in the codegen rework.
- [x] Implement `contract::witnesses()` boundary witness generation (item 5)
- [x] Replace `type_id == "List"` in non-codegen locations (item 6 partial)
- [x] Fix loop pattern dual encoding (type_id "List" → element type + cardinality)
- [x] Add `cardinality: Cardinality` field to `CliEntrypoint` (item 6)
- [x] Replace `type_id ==` string checks in CLI generation with `cardinality.allows_many()`
- [x] Add typed `OutputMatcher` variants (`IsBool`, `IsInt`, `IsString`, `IsRequest`, `IsResponse`, `IntGe`, `IntLe`) that generate real codegen assertions
- [x] Add `ShellResponse::ok()` / `failed()` constructors for transport response modeling
- [x] Add `From<T> for TransportRequest` / `TransportResponse` impls for all transport types
- [x] Add `ExecError::context()` and `ResultExt` trait for structured error context
- [x] Add `propagate_skipped()` helper for skip propagation pattern

## Design Principles (from review)

Expand Down
13 changes: 8 additions & 5 deletions TODO/consolidation.md
Original file line number Diff line number Diff line change
Expand Up @@ -900,12 +900,15 @@ This is fine; it's infrastructure code, not op code.
- [x] Add `TransportResponseExt::require_shell/rest/file` methods (51 call sites) — `core/exec/src/helpers.rs`
- [x] Add `ShellRequest::into_transport_request()` — `core/ir/src/transport/mod.rs`

### High priority (new — widespread, low effort)
- [ ] Add `propagate_skipped` helper (8 call sites across 3 files) — §12
- [ ] Add `ExecError::context()` + `ResultExt` trait (27 call sites across 10 files) — §13
- [ ] Add `ShellResponse::ok()` / `ShellResponse::failed()` constructors (39 sites, 16 files) — §14
### High priority (new — widespread, low effort) — DONE
- [x] Add `propagate_skipped` helper (8 call sites across 3 files) — §12
- [x] Add `ExecError::context()` + `ResultExt` trait (27 call sites across 10 files) — §13
- [x] Add `ShellResponse::ok()` / `ShellResponse::failed()` constructors (39 sites, 16 files) — §14
- [x] Add `From<ShellRequest> for TransportRequest` (+ FileRequest, RestRequest, etc.) — all 5 request types + 5 response types

### High priority (remaining)
- [ ] Add `InputsExt` trait to replace free-function `require_*/optional_*` calls — shrinks import lists
- [ ] Add `From<ShellRequest> for TransportRequest` (+ FileRequest etc) and make `OutputMap::request` accept `impl Into<TransportRequest>`
- [ ] Migrate call sites to use `propagate_skipped`, `ExecError::context()`, `ShellResponse::ok()` etc.

### Medium priority
- [ ] Migrate remaining raw `HashMap::new()` output construction to `OutputMap` (9 sites, 5 files) — §15
Expand Down
Loading