Skip to content

Add event exporters and usage collection - #37

Open
cms7371 wants to merge 23 commits into
toss:mainfrom
cms7371:feature/event-exporter
Open

cms7371 wants to merge 23 commits into
toss:mainfrom
cms7371:feature/event-exporter

Conversation

@cms7371

@cms7371 cms7371 commented Nov 11, 2026

Copy link
Copy Markdown

Summary

Add opt-in usage collection so plugin authors can understand which features people use, without tying Necto to an analytics service. App and web plugins record named events; Necto adds common metadata and forwards permitted events to one user-approved desktop Event Exporter. The exporter owns formatting, batching, delivery, retries, and persistence.

  • Provide necto.log(...) and registrar.logger, with device/desktop/native sources and web/CLI invocation context.
  • Require installation consent through the UI or CLI, including shell-access choices. Users can exclude plugin IDs, inspect exporter diagnostics, or remove the exporter to stop collection. Existing exclusions also apply to newly installed plugins.
  • Add a native HTTPS bridge and a reusable HTTPExporter with JSON batches, retry backoff, and persisted pending events. Normal shutdown allows up to five seconds to finish or checkpoint work.
  • Instrument native and built-in plugin usage, excluding request bodies, search text, file paths, and preference values from those built-in event parameters. Include API documentation and release packaging.

Review guide

  1. Event contracts and routing: NectoMac/Sources/NectoMacService/NectoEventDispatcher.swift, Sources/NectoSDK/NectoPluginLogger.swift, and WebPackages/Bridge/src/{index,exporter,types}.ts.
  2. Consent and runtime: Necto/InstallCoordinator.swift, Necto/PluginApprovalSheet.swift, Necto/NectoExporterRuntime.swift, and Necto/SettingsScreen.swift. Check UI/CLI approval parity, shell access, exclusions, and shutdown.
  3. Delivery and examples: WebPackages/HTTPExporter/, then built-in instrumentation and its tests. Exporter-specific batching and retry behavior stay outside the dispatcher.

Changelog

Add opt-in usage collection through desktop Event Exporters, plugin logging APIs, and a configurable HTTP exporter.

Test Plan

  • Final committed project: macOS Debug build succeeded; NectoAppTests passed 84 tests in 14 suites.
  • During implementation: script/test swift, web tests and typechecks, built-in panel builds, and panel asset checks passed.
  • Example app on a simulator: exercised all six built-in plugins, CLI event context, representative web actions, persistent exclusions, re-inclusion, and normal shutdown/reload.
  • Real HTTPExporter with synthetic events over HTTPS: verified partial/threshold batches, 503 retries, recovery with stable event IDs, and checkpoint removal after success. Verified timers and retry backoff while Necto was inactive, with a native regression test that does not wake JavaScript.
  • CLI warning tests cover cached/refreshed catalogs, rejection suppression, and fresh checks during explicit review and approval.

Limits: USB-device behavior and delivery during crashes or system sleep were not verified. Delivery is best effort; receivers should deduplicate by event ID. Integration checks used shorter batch thresholds without changing shipped defaults.

Screenshots

Native Necto integration build, using a local-only test exporter. The installation metadata/path is obscured in the settings capture. No app is connected in these captures.

Collection settings

Native collection settings

Exporter diagnostics

The log includes local recorder activity and synthetic HTTP retry checks.

Native exporter diagnostics

This branch has not been deployed

No deployments
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