Skip to content

feat: detect and reject P3 async components (Phase 1)#58

Merged
avrabe merged 1 commit intomainfrom
feat/p3-phase1-reject
Mar 22, 2026
Merged

feat: detect and reject P3 async components (Phase 1)#58
avrabe merged 1 commit intomainfrom
feat/p3-phase1-reject

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 22, 2026

Summary

P3 Phase 1: detect and reject P3 async component model features with clear error messages instead of silently producing broken fused output.

Parser changes:

  • Future(ty) and Stream(ty)ComponentTypeKind::P3Async (was silent Other)
  • Async and Callback canonical options detected and tracked
  • P3 task builtins (task.wait, task.poll, task.yield, task.return, subtask.drop, stream., future.) detected with human-readable descriptions
  • New p3_async_features: Vec<String> field on ParsedComponent

Rejection:

  • Fuser::fuse_with_stats() checks all components before fusion starts
  • Error includes component names, deduplicated feature list, and actionable message
  • New Error::P3AsyncNotSupported(String) variant

Tests: 7 new unit tests covering option detection, type detection, feature collection, and error message generation.

No changes to existing P2 behavior — only triggers on actual P3 constructs.

Test plan

  • All 73 wit-bindgen tests pass (P2 unaffected)
  • All 164 unit tests pass (7 new P3 tests)
  • cargo +stable clippy --all-targets -- -D warnings clean

🤖 Generated with Claude Code

Parse P3 component model constructs (future<T>, stream<T>, async/callback
canonical options, task.*/subtask.*/stream.*/future.* built-ins) and
reject them with a clear, actionable error message before fusion starts.

Previously, these were silently mapped to Other/Unsupported/ignored,
which would produce broken fused output. Now:

- ParsedComponent.p3_async_features tracks all detected P3 constructs
- ComponentTypeKind::P3Async variant for future/stream types
- convert_canonical_function detects P3 built-in functions
- convert_canonical_options detects async/callback options
- Fuser.fuse_with_stats rejects components with P3 features early
- Error::P3AsyncNotSupported provides component name + feature list
- 7 new unit tests covering detection and error paths

P2 components are completely unaffected.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 5be8463 into main Mar 22, 2026
3 of 4 checks passed
@avrabe avrabe deleted the feat/p3-phase1-reject branch March 22, 2026 08:50
avrabe added a commit that referenced this pull request Mar 22, 2026
P3 Phase 2: sync-only P3 components work with zero code changes.
The canonical ABI is identical for sync operations between P2 and P3.
Bumping wit-bindgen to 0.54.0 enables P3 fixture generation.

P3 async features (stream, future, task.*) are detected and rejected
by Phase 1 (PR #58). Sync-only P3 fixtures will pass transparently.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
avrabe added a commit that referenced this pull request Mar 22, 2026
P3 Phase 2: sync-only P3 components work with zero code changes.
The canonical ABI is identical for sync operations between P2 and P3.
Bumping wit-bindgen to 0.54.0 enables P3 fixture generation.

P3 async features (stream, future, task.*) are detected and rejected
by Phase 1 (PR #58). Sync-only P3 fixtures will pass transparently.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant