Skip to content

fix(sparklink): isolate event lifecycle and align language ABI - #9

Draft
sanchuanhehe wants to merge 31 commits into
masterfrom
codex/sparklink-ws73
Draft

sanchuanhehe wants to merge 31 commits into
masterfrom
codex/sparklink-ws73

Conversation

@sanchuanhehe

Copy link
Copy Markdown
Collaborator

slkd 在静默控制器上等待事件时持有业务状态锁,使 D-Bus 管理方法无法响应。此批把接收 fd 交给独立 EventReceiver,显式取消并 join;D-Bus object 注册、Bond 文件操作和连接 Profile 回调在业务锁外执行。已接受的存储/回调操作在调用方取消后仍保持顺序,退出时 drain;callback panic 后关闭服务。

同步 Rust/C open 不再要求 Tokio reactor。同时修复 Rust/C/Python 的 DLI 字段位宽及 Python ConnInfo 字段缺失,以编译器导出的布局验证规范内核 UAPI;拒绝 CLI Unicode hex 输入,统一格式并处理工具 lint。

验证:

  • Rust workspace 135/135,包含真实私有 D-Bus 的 30 秒静默、旧锁复现、阻塞存储/Profile、取消及 fd 生命周期回归。
  • Python/compiled C/Rust ABI 23/23;cbindgen verify 和全仓 rustfmt 通过。
  • 六个库/工具 crate 的 all-targets clippy -D warnings 通过。slkd 现存未接通策略/SSAP/transport 及旧接口 lint 仍使严格 CI 失败,保持 draft,不放宽门禁。

边界:仍为 legacy destructive ring、固定 slk0 与顺序 dispatcher;未实现独立订阅、用户态 SSAP、安全 Bond 凭据、完整 WS73/RF 验收。Linux boot/lab 改动尚未提交,需独立 QEMU 验收。

Refs: #1, #3, #8;完整规划与参考审计见 docs/IMPLEMENTATION_PLAN.md 和 docs/NEARLINK_HOST_REFERENCE.md。这些引用不自动关闭未完成 issue。

Normalize existing workspace source with rustfmt before the ABI and
event lifecycle changes. This commit contains formatting only.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Restore missing Python connection fields and use 16-bit DLI capability
fields in Rust, C and Python. Regenerate the public C header with
cbindgen and test compiler-derived layouts and guarded C writes
against the pinned kernel UAPI in CI.

Validation: 23 Python/compiled ABI tests passed on the native host;
cbindgen header verification passed. This does not certify 32-bit ABI.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Separate synchronous control fd ownership from the single-consumer
async event receiver. Wait and register D-Bus objects outside shared
business state; explicitly cancel and join receiver shutdown.

Serialize accepted Bond writes and Profile callbacks on independent
blocking services, drain them on shutdown and reject new operations.
Reject ambiguous peer attribution in legacy security events and invalid
Unicode key input. Add private D-Bus and cancellation regressions.

Validation: libsparklink 9 and slkd 62 tests passed, including a
30-second quiet receiver regression and blocked storage/Profile
responsiveness.
Legacy ring polling remains unchanged; this does not implement
independent subscriptions, per-controller routing or SSAP migration.

Refs: #1, #3, #8

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Validate ASCII before byte-index slicing in CLI key parsers to avoid
panics on even-length Unicode input. Remove a redundant test module
wrapper and update small lint patterns for the current Rust toolchain.

Validation: workspace 135 tests passed; all-target clippy with warnings
denied passed for six library/tool crates. Existing slkd warnings
remain and are not suppressed.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
…aries

Define S0-S6 dependencies, original issue acceptance and reproducible
validation gates for native WS73 and vendor/proxy support. Record the
NearLink Host source audit, version/dialect differences and reuse
boundaries without claiming reference execution or RF validation.

Refs: #8, OpenSparklink/linux#13, OpenSparklink/linux#17

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
@sanchuanhehe

Copy link
Copy Markdown
Collaborator Author

远端 CI 已运行:https://github.com/OpenSparklink/sparklink/actions/runs/37959618352 。rustfmt、Python bindings/kernel ABI conformance 成功;cargo check 在 RUSTFLAGS=-D warnings 下因 slkd 未使用的 policy/auto_enable/security/Profile/transport 等代码失败。依赖 cargo check 的 test/clippy/header/release jobs 被跳过,不能称为远端测试通过。

本地完整 workspace 135/135 与 compiled ABI 23/23 的结果单独记录。当前保持 draft 和原严格门禁,等待后续实现接通这些路径;不合入、不关闭未完成 issues。

Preserve the complete joint roadmap while prioritizing per-controller
runtime, WS73 boot/HCC/BSLE, genuine DLI queries, advertising/scanning,
events and dynamic adapter selection. Define the ordinary-user,
10-second, 20 alternating round and hotplug gates with capture evidence.
Virtual tests support development and cannot certify this hardware gate.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Revalidated outside the filesystem sandbox: KVM is readable/writable
and USB device nodes exist, but WS73 inventory remains empty. Keep
physical RF acceptance pending rather than inferring host permissions
from the isolated view.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Track fixed per-device Runtime ownership, independent queues, and the passing virtual ReadMacAddr ownership case. Preserve the failing full-suite evidence and identify the remaining global routing, lifetime, worker and hardware gaps.

Validation: docs diff --check; kernel image #7 build; static C Werror build; 41 harness unit tests. Full 96-case virtual suite: 3 failed assertions, strict FAIL; no physical RF acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Record RuntimeContext propagation, passing concurrent fd identity queries, the unresolved command completion counter assertion, and the separate diagnostic QEMU timeout. Keep all original issue acceptance criteria and hardware evidence boundaries.

Validation: docs diff --check; kernel builds #9, #10 and restored #11. Full virtual suite remains FAIL; no physical WS73 RF acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Document raw IRQ-save locking, atomic RX allocation, worker scheduling gates and drain ownership, TX/RX direction separation, and classified RX loss evidence. Tighten command ownership acceptance to exclude older completions and timeouts. Preserve failing full-suite results and all remaining Runtime/hardware requirements.

Validation: kernel image #16 build; static C Werror; 41 harness tests. Exact command ownership case PASS; full 96-case virtual suite 3 failed assertions, strict FAIL. No physical RF, teardown, RT or lockdep acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Document stable Runtime ownership, independent locks and RX/TX work, exact DLI checks, and the reproducible virtual hotplug gate. Preserve the full-suite failures and real WS73 acceptance boundary.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Record strict bootstrap validation, generation-tagged RX, corrected standard command-credit fields and in-place queue initialization. Preserve the boot failure, full-suite failures and passing virtual lifecycle evidence without claiming real WS73/RF acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Document per-owner command scheduling and retained replies, intent cookies, immediate RX wakeup and the pending sentinel fix. Preserve failed burst/full-suite runs and record exact passing dual-owner bursts and virtual hotplug without claiming WS73/RF acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Document per-interface vendor HCC framing, bounded BSP/customize/open/boot handshake, explicit board configuration inputs and synthetic production-code tests. Preserve the #34 fuzz panic and #35 bounds fix evidence, full-suite failures and missing physical RF acceptance. All original issues remain open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Export the packed efuse BSLE payload and platform PM word from explicitly selected SDK fields. Require the compile-time USB link-check bit, reject incomplete/flash inputs, preserve prior output and record actual byte provenance without claiming hardware compatibility.

Tests: 18 Python tests pass; supplied SDK default exported successfully as an unverified candidate.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
…ion limits

Record SDK board candidate export and native metadata query behavior with exact synthetic, lifecycle and full-suite results. Keep hardware acceptance and all original issues open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Record the frozen production-driver synthetic query and fault gates, full regression failures and evidence boundaries. Keep real discovery acceptance and all original issue criteria open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
…cceptance

Link the signed kernel branch and draft PR, frozen source-matched validation and retained failure history. Preserve legacy air-medium assertion limits and all real hardware North Star criteria.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>

Assisted-by: OpenAI Codex <noreply@openai.com>
Document the driver-owned validation seam, explicit WS73 discovery schemas and strict report codec, with source revisions and frozen image #43 evidence. Keep discovery support, real dual-device acceptance and all S0–S6 issues open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Mirror the versioned per-registration controller event ABI and decode complete WS73 discovery parameters without legacy field aliases. Add caller-owned cursors, independent synchronous reads and an owning async receiver using the new kernel poll subscription. Document loss/generation/copyout semantics and the remaining real discovery/slkd/slctl work.

Validation: workspace 137 tests PASS with cached D-Bus daemon; fmt and changed slk-protocol/libsparklink strict clippy PASS. Whole-workspace strict clippy remains FAIL in unchanged slkd dead code. Kernel image #45 four support gates and full 96 cases PASS; real WS73/RF/Ready acceptance remains incomplete.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Record the full 49-byte encoder, bounded interval conversions and
driver-owned successful Complete schemas. Link the signed kernel change
and exact synthetic fault, lifecycle and regression evidence.

Keep native RF activation, typed Host recipes, slkd/slctl and all seven
real-device North Star criteria explicitly pending. Preserve the complete
S0-S6 plan and subsequent four-controller parallel acceptance.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Record frozen kernel #50 gates, delayed-Complete negative control and the limits of standard one-step recipe coverage. Keep native typed preparation, public results and all seven real-device criteria pending; retain the complete S0-S6 plan.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Document complete typed recipe preparation, transfer-time step validation, frozen image #51 evidence and the pending native submit/results integration. Keep all real-device criteria and the full S0-S6 plan open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Mirror the versioned submit/result ABI and expose selected Adapter identity probes, typed submission, non-destructive results and async waits that preserve controller/host errors. Reject overflowing deadlines before ioctl. Record real virtual native USB transaction evidence and all remaining Ready/slkd/slctl/air acceptance work.

Validation: 139 workspace tests, changed-crate strict clippy, 32/64-bit C ABI and frozen kernel #55 eight QEMU gates plus original 96-case regression PASS. Existing three regression warnings and slkd whole-workspace strict-clippy limitations retained.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Select independent control/subscriber fds for each registration and dynamically
publish generation-specific adapters. Initialize native Host readiness through
typed stop results, isolate hotplug/lifecycle workers, preserve full native
report data/identity/loss, and invalidate cached readiness/fault properties.

Let slctl select a live registration, inspect Ready and exact reports, and run
one-shot commands. Keep native legacy scan/profile calls unsupported until the
WS73 radio policy and SSAP backend exist. This does not claim real RF acceptance.

Validation: 142 workspace tests PASS, actual uid1000 slkd/slctl QEMU hotplug PASS,
and strict clippy for libsparklink/slk-protocol/slctl PASS. slkd strict clippy still
fails on existing unused code and an existing test helper argument-count warning.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Provide versioned basic native advertisement/scan policy, caller-correlated
D-Bus submission/results and slctl advertisement, scanning and result commands.
Match only fresh selected-generation reports with exact marker/address/data,
retain kernel receipt time and enforce a 10-second bound before scan admission.

Use zbus's Tokio backend for blocking-task/timer calls in service handlers.
Activate native event subscriptions before epoll registration so controller
reports wake the correct queue. Preserve the existing report API and raw status.

Workspace: 145 PASS. Protocol/library/CLI strict clippy PASS; existing daemon
strict-clippy failures retained. Actual uid-1000 binaries pass synthetic USB
20 alternating rounds, hotplug plus two rounds and TX-off negative controls.
No real WS73/RF acceptance is claimed; all full issue criteria remain open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Add an ordinary-user slctl control harness with explicit physical USB mapping,
20 alternating random-marker rounds, single-device manual hotplug, same daemon
process/bus owner and separate post-replug rounds and TX-off negatives.
Expose the bus-authenticated daemon owner/PID/UID through slctl daemon.

Corroborate complete receiver usbmon pcap USB/HCC/DLI bytes, actual metadata
and radio Complete events, capture windows and zero-drop/count statistics.
Preserve failed control runs and keep control success evidence-pending; RX
corroboration does not certify firmware/board provenance or PHY sniffing.

36 tool tests, 12000 aggregate comparisons with production C, 145 workspace
tests and protocol/library/CLI strict clippy PASS. Actual uid-1000 binaries
pass the synthetic USB discovery gate including daemon bus identity.
Physical WS73 inventory is empty; all real North Star conditions remain open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Replace universal control access with explicit observation methods, root service ownership and trusted control-group calls. Reject unlisted/interface-less methods, sensitive or destructive reads and property writes for observers. Add a real guest client denial matrix and document public properties, one-time enrollment and the remaining kernel writer/raw access boundary.

Validation: actual production-policy and existing session synthetic 20+2-round daemon/CLI gates PASS; 145 workspace, 145 harness and 36 physical tool tests PASS; changed crates strict clippy PASS. Physical WS73 discovery and original issue acceptance remain pending.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Describe current-caller authorization, privileged daemon/unprivileged
application deployment, inherited-fd denial evidence and readonly power
behavior. Preserve the full plan and seven unchecked physical criteria.
Record the event ingress barrier, qualified frozen kernel configuration
and final synthetic regression results without claiming writer leases
or WS73 firmware/RF acceptance.

Validation: 168 kernel harness tests, ten integration gates and original
96-case strict QEMU regression PASS (1056 OK / 0 FAIL / 3 existing WARN).
Rust sources are unchanged; prior workspace/clippy/tool results are reused
only after verifying their exact source hashes.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Add versioned native management ioctl types and library acquisition,
release and query helpers. Claim Managed before publishing a native adapter;
bootstrap, discovery and existing management share the same Arc<Adapter>.
Keep independent observing subscriptions and per-registration lifecycle.
Document file identity, caller capability, close/revocation, failure details,
legacy Backend migration and the still-unverified physical North Star.

Validation: 146 workspace tests; protocol/library/slctl strict clippy PASS.
181 kernel harness tests, eleven integration gates and original strict
96-case QEMU regression PASS (1056 OK / 0 FAIL / 0 SKIP / 3 existing WARN).
The actual uid-1000 slctl synthetic twenty-round/same-daemon hotplug/TX-off
loop remains PASS. Existing full-slkd strict-clippy issues remain unresolved;
all original issues and physical criteria stay open.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.com>
Retain the native lease token and explicitly release authority while SharedState
and outstanding RPCs can still hold the management fd. Observe cleanup without
holding state/directory locks, keep fault/timeout diagnostics, and handle removed
registrations. Roll back partial publication through the same release path.
Handle SIGTERM through normal shutdown alongside SIGINT.

Validation: 146 workspace tests, production/session native handoff integration,
198 harness tests and original 96-case QEMU regression. Real WS73 RF acceptance
and the remaining original issues are still pending.

Signed-off-by: sanchuanhehe <wyihe5220@gmail.com>
Assisted-by: OpenAI Codex <noreply@openai.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