Skip to content

feat(arty_io_core): add injectable I/O driver contracts - #737

Draft
martintmk wants to merge 23 commits into
mainfrom
user/martintomka/20260907-add-arty-io-driver
Draft

feat(arty_io_core): add injectable I/O driver contracts#737
martintmk wants to merge 23 commits into
mainfrom
user/martintomka/20260907-add-arty-io-driver

Conversation

@martintmk

@martintmk martintmk commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Introduces the initial stable arty_io_core contract for injecting I/O drivers after runtime startup.

  • DriverContext selects its associated provider, so get_context::<MyContext>() needs no registration value.
  • The first lookup initializes one driver instance on every active worker before returning the caller-local context.
  • Later lookups reuse the cached context without creating more drivers.
  • Multiple unrelated and semver-incompatible driver types can coexist in one runtime.
  • Driver remains thread-local, boxable as Box<dyn Driver<Context = C>>, and exposes only shared-reference callbacks.
  • Parker defines the latched wait/wake contract.
  • SystemTasks is a cloneable crate-owned handle that hides runtime shared-ownership plumbing.
  • Shutdown is initiated exactly once by the runtime and returns an object-safe boxed completion future.
  • Contexts and in-flight operations retain state through safe ownership handles rather than an unsafe is_inert contract.

The crate includes REQUIREMENTS.md, DESIGN.md, public-surface tests, and a modular two-worker example. The example registers two independent driver types after worker startup, performs in-memory I/O through both contexts, caches repeated lookups, drains all four driver instances, and rejects operations through retained contexts after shutdown.

Review

  • Multi-model reviews with Opus, Sonnet, and GPT found no remaining issues.
  • Pragmatic Rust public API review found no remaining issues after removing speculative Clone from DriverInit and replacing exposed Arc<dyn ...> plumbing with SystemTasks.
  • Package coverage is 100%.

Validation

  • just package=arty_io_core clippy
  • just package=arty_io_core format
  • just package=arty_io_core readme
  • just package=arty_io_core spellcheck
  • cargo test -p arty_io_core
  • cargo run -p arty_io_core --example two_thread_runtime
  • cargo coverage-gate --package arty_io_core
  • cargo public-api --all-features --manifest-path crates/arty_io_core/Cargo.toml

CI infrastructure blocker

The Windows coverage job fails after all 6,867 tests pass. cargo llvm-cov generates a 33,956-character llvm-cov.exe export command for 445 objects, exceeding the Windows 32,767-character process limit (os error 206). The failed job was retried once and reproduced identically. Linux and Linux ARM coverage, Codecov, mutation tests, static analysis, MSRV, semver, external-type exposure, spelling, and other completed checks pass.

martintmk and others added 5 commits September 7, 2026 13:59
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
@martintmk martintmk added the agency-rocket Touched by a rocket skill label Sep 7, 2026
martintmk and others added 9 commits September 7, 2026 14:44
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0

@martintmk martintmk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI AGENT]: I reviewed all eight added public contracts (Driver, DriverContext, DriverInit, DriverProvider, Parker, Shutdown, SystemTask, and SystemTaskSpawner), their rustdoc, the example runtime, dependencies, naming, object safety, shutdown behavior, and the new public-surface tests. Two targeted probes reproduced lifecycle contradictions below. The remaining public surface is documented and intentionally narrow; I found no additional dependency, naming, performance, resilience, or test-weakening issue. CI was still running with no reported failures at the final check.

Comment thread crates/arty_io_core/src/driver.rs Outdated
Comment thread crates/arty_io_core/examples/two_thread_runtime/sample_driver.rs
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.23077% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.9%. Comparing base (efd8178) to head (02fd34a).

Files with missing lines Patch % Lines
crates/arty_io_core/src/system_tasks.rs 66.6% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #737     +/-   ##
========================================
- Coverage   100.0%   99.9%   -0.1%     
========================================
  Files         583     587      +4     
  Lines       62930   62982     +52     
========================================
+ Hits        62930   62979     +49     
- Misses          0       3      +3     
Flag Coverage Δ
linux 99.9% <94.2%> (-0.1%) ⬇️
linux-arm 99.9% <94.2%> (-0.1%) ⬇️
scheduled ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

martintmk and others added 5 commits September 7, 2026 15:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 58677290-64b2-44fc-9e40-6c80b7e9e5c0

@martintmk martintmk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[AI AGENT]: Pragmatic Rust public API review completed with no findings. Verified the all-features cargo public-api surface, generated rustdoc JSON, package tests, clippy, spelling, the two-driver example, and the 100% coverage gate.

Coverage: reviewed Driver, DriverContext, DriverProvider, DriverInit, Parker, SystemTasks, and SystemTask from the downstream consumer and evolution perspective. The audit cannot prove runtime behavior or soundness from API output alone; those were covered separately by tests and multi-model review.

The resulting surface removes speculative Clone from DriverInit, hides Arc<dyn ...> behind the cloneable SystemTasks handle, and documents the boxed shutdown future as the deliberate object-safe shape for Box<dyn Driver<Context = C>>.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 206cc953-3282-4edf-b114-ee2b7f518bdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 206cc953-3282-4edf-b114-ee2b7f518bdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 206cc953-3282-4edf-b114-ee2b7f518bdf
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6a475d84-6296-497e-975b-7442019e433b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agency-rocket Touched by a rocket skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant