Files
whetstone_DSL/HANDOFF-2026-03-24.md
Bill 410bb2d78c Steps 1991-1993: AST sidecar lifecycle + schema stub fixes + IR chain
Step 1991: Wire AST sidecar lifecycle hooks
- openFile (DispatchPart2.h): auto-calls loadSidecarAST() after parse,
  returns annotationsRestored + staleAnnotations
- saveBuffer (DispatchPart3.h): auto-calls saveSidecarAST() +
  saveSemannoSidecar() after write, returns annotationsSaved +
  sidecarPath + semannoPath

Step 1992: Fix 9 schema stubs in Sprint 142/143/144 tool registrations
- All 9 text/AST sync and merge tools now have proper inputSchema with
  required id and documented optional parameters (language, text, mode)

Step 1993: Fix ingest_legacy_to_ir → generate_cpp_from_ir chain
- ingest_legacy_to_ir now emits ir field (SemanticCoreIR format)
  alongside existing graph/api_intent/assumption/readiness fields
- RecoveryNode → IRNode mapping: intent→kind, confidence in metadata
- Neighbor lists become inferred edges; moduleId = "legacy:" + slug
- generate_cpp_from_ir now accepts result["ir"] directly

15/15 tests passing across all three steps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 02:38:43 -06:00

98 lines
3.3 KiB
Markdown

# Whetstone Handoff — 2026-03-24
## Session Summary
Three steps completed, all closing B-run pipeline gaps discovered during the
whimptk Sprint 03 A/B test.
---
## Step 1991 — AST sidecar lifecycle hooks (COMPLETE)
**What**: `openFile` and `saveBuffer` were the right abstraction points for
automatic sidecar round-trips, but they never called the sidecar functions.
Two targeted edits closed the gap:
- `DispatchPart2.h``openFile` now calls `loadSidecarAST()` after parse,
returns `annotationsRestored` + `staleAnnotations` in result.
- `DispatchPart3.h``saveBuffer` now calls `saveSidecarAST()` +
`saveSemannoSidecar()` after file write, returns `annotationsSaved`,
`sidecarPath`, `semannoPath` in result.
5/5 tests passing (`step1991_test.cpp`).
---
## Step 1992 — Schema stub fix for Sprint 142/143/144 tools (COMPLETE)
**What**: 9 tools registered with empty `{}` schemas — MCP clients couldn't
discover the `id` parameter. All returned `"id required"` when called without
schema guidance.
**Files patched:**
- `RegisterSprint142Tools.h``sync_text_to_ast`, `get_sync_diagnostics`,
`get_sync_identity_report`
- `RegisterSprint143Tools.h``regenerate_text_from_ast`,
`preview_regenerated_diff`, `get_regeneration_decisions`
- `RegisterSprint144Tools.h``detect_text_ast_conflicts`,
`preview_text_ast_merge`, `apply_text_ast_merge`
All 9 now have proper `required: [id]` schemas with `language`/`text`/`mode`
optional properties and useful descriptions.
5/5 tests passing (`step1992_test.cpp`).
---
## Step 1993 — `ingest_legacy_to_ir` → `generate_cpp_from_ir` chain fix (COMPLETE)
**What**: `ingest_legacy_to_ir` returned `{graph, api_intent, assumption, ...}`
but `generate_cpp_from_ir` expected `{ir: SemanticCoreIR}`. The B-run got
`ir_invalid` because the formats were incompatible.
**Fix**: `RegisterLegacyIngestionTools.h` — added `buildIRFromGraph()` helper
that maps `RecoveryNode` objects to `IRNode`/`IREdge` and constructs a valid
`SemanticCoreIR`. The `ir` field is now emitted alongside the existing output:
```
result = ingest_legacy_to_ir({source: "...", language: "cpp"})
generate_cpp_from_ir({ir: result["ir"], profile: "safe-first"}) // works
```
Mapping: `core` → Module, `api_inference` → Function, `assumed` → Effect,
`unknown` → Unknown. Neighbors become `{relation: "inferred"}` edges with
existence check. `moduleId` = `"legacy:" + source.substr(0, 32)`.
5/5 tests passing (`step1993_test.cpp`).
---
## What's Still Open
From the original B-run gap list, both gaps are now closed:
- ~~Schema stubs~~ (Step 1992) ✓
- ~~IR chain mismatch~~ (Step 1993) ✓
The whimptk Sprint 03 B-run pipeline is now unblocked end-to-end:
```
ingest_legacy_to_ir → ir field → generate_cpp_from_ir → files
```
The next time whimptk Sprint 04 runs, use the proper pipeline:
1. `start_recording`
2. `architect_intake` (spec with Goals/Constraints/Acceptance Criteria sections)
3. `generate_taskitems`
4. `queue_ready`
5. `ingest_legacy_to_ir` on any legacy header
6. `generate_cpp_from_ir` using `result["ir"]`
7. `apply_text_ast_merge` + `save_buffer` to finalize
8. `get_metrics`
---
## Build State
- `whetstone_mcp` binary: `editor/build-native/whetstone_mcp` (rebuilt)
- All prior tests still passing (architecture gate unaffected)
- Daemon: restart with `tools/start-whetstone-daemon.sh` if needed