Skip to content

Phase 2: Clean Dependent Crates Feature Dependencies #103

@avrabe

Description

@avrabe

Overview

Clean up all workspace crates to use the new four-layer safety architecture, removing mixed allocation/safety level dependencies and ensuring proper layer composition.

Parent Issue: #101
Depends on: #102

Affected Crates

  • wrt-component/Cargo.toml
  • wrt-runtime/Cargo.toml
  • wrt-decoder/Cargo.toml
  • wrt-format/Cargo.toml
  • wrt-host/Cargo.toml
  • wrt-intercept/Cargo.toml
  • All other workspace crates with wrt-foundation dependencies

Current Problems

wrt-component/Cargo.toml (Line 19)

# PROBLEMATIC - Mixed allocation strategy with safety level
wrt-foundation = { workspace = true, default-features = false, features = ["asil-b", "alloc"] }

wrt-runtime/Cargo.toml (Line 22)

# PROBLEMATIC - Mixed allocation strategy with safety level
wrt-runtime = { workspace = true, default-features = false, features = ["asil-b", "alloc"] }

Required Changes

1. wrt-component Dependencies

# BEFORE (problematic)
wrt-foundation = { workspace = true, default-features = false, features = ["asil-b", "alloc"] }

# AFTER (clean layer composition)
wrt-foundation = { workspace = true, default-features = false, features = ["iso-26262", "asil-b"] }
# Note: Memory strategy will be selected based on safety level requirements automatically

2. wrt-runtime Dependencies

# BEFORE (problematic)
wrt-runtime = { workspace = true, default-features = false, features = ["asil-b", "alloc"] }

# AFTER (clean layer composition)  
wrt-foundation = { workspace = true, default-features = false, features = ["iso-26262", "asil-b"] }

3. Feature Propagation

Each crate should properly propagate the four layers:

[features]
# Layer 1: Memory Management (mutually exclusive)
static-allocation = ["wrt-foundation/static-allocation"]
bounded-allocation = ["wrt-foundation/bounded-allocation"] 
managed-allocation = ["wrt-foundation/managed-allocation"]
std-allocation = ["wrt-foundation/std-allocation"]

# Layer 3: Safety Standards (mutually exclusive per project)
iso-26262 = ["wrt-foundation/iso-26262"]
do-178c = ["wrt-foundation/do-178c"] 
iec-61508 = ["wrt-foundation/iec-61508"]
iec-62304 = ["wrt-foundation/iec-62304"]
en-50128 = ["wrt-foundation/en-50128"]
iso-25119 = ["wrt-foundation/iso-25119"]

# Layer 4: Safety Levels (dependent on standard)
# ISO 26262
qm = ["wrt-foundation/qm"]
asil-a = ["wrt-foundation/asil-a"]
asil-b = ["wrt-foundation/asil-b"] 
asil-c = ["wrt-foundation/asil-c"]
asil-d = ["wrt-foundation/asil-d"]

# DO-178C
dal-e = ["wrt-foundation/dal-e"]
dal-d = ["wrt-foundation/dal-d"]
dal-c = ["wrt-foundation/dal-c"] 
dal-b = ["wrt-foundation/dal-b"]
dal-a = ["wrt-foundation/dal-a"]

# And so on for other standards...

Implementation Tasks

For Each Crate:

  • wrt-component: Remove ["asil-b", "alloc"] mixed dependencies
  • wrt-runtime: Remove ["asil-b", "alloc"] mixed dependencies
  • wrt-decoder: Clean any mixed allocation/safety dependencies
  • wrt-format: Clean any mixed allocation/safety dependencies
  • wrt-host: Clean any mixed allocation/safety dependencies
  • wrt-intercept: Clean any mixed allocation/safety dependencies
  • All other crates: Audit and clean dependencies

Feature Propagation:

  • Add proper four-layer feature propagation to each crate
  • Ensure memory strategy selection is automatic based on safety level
  • Remove direct alloc/std feature mixing with safety levels
  • Add multi-standard support propagation (not just automotive)

Validation:

  • Test all crates compile with new feature structure
  • Verify no std dependencies leak into safety-critical combinations
  • Test cross-crate feature composition works correctly
  • Validate existing functionality is preserved

Testing Matrix

Test key combinations across all affected crates:

# Automotive ASIL-D (should use static-allocation automatically)
cargo check -p wrt-component --features="iso-26262,asil-d"
cargo check -p wrt-runtime --features="iso-26262,asil-d"

# Aerospace DAL-A (should use static-allocation automatically) 
cargo check -p wrt-component --features="do-178c,dal-a"
cargo check -p wrt-runtime --features="do-178c,dal-a"

# Medical Class C (should use static-allocation automatically)
cargo check -p wrt-component --features="iec-62304,class-c"
cargo check -p wrt-runtime --features="iec-62304,class-c"

# Lower safety levels (should use appropriate allocation strategy)
cargo check -p wrt-component --features="iso-26262,asil-b"
cargo check -p wrt-component --features="iso-26262,qm"

Acceptance Criteria

  • No mixed allocation/safety level dependencies remain in any crate
  • All crates properly propagate four-layer feature architecture
  • Memory strategy selection is automatic based on safety level
  • Multi-standard support available across all crates
  • All existing functionality preserved
  • No std library dependencies in safety-critical feature combinations
  • Clear documentation of feature composition for each crate

Migration Notes

  • Existing feature usage should be supported through legacy compatibility features
  • Add deprecation warnings for old mixed feature usage
  • Provide clear migration guide in each crate's documentation
  • Update examples to use new clean feature specification

Metadata

Metadata

Assignees

Labels

architectureArchitectural design and refactoringbreaking-changeBreaking API or behavioral changesfeature-systemCargo feature system and configuration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions