Files
nexu-io__open-design/apps/daemon/tests/plugins-snapshot-diff.test.ts
Cursor Agent b74fc552ec feat(plugins): od plugin snapshots show / diff debugging tools (Phase 4)
Plan BB1 + BB2.

Two CLI subcommands powered by new pure helpers:

  od plugin snapshots show <snapshotId> [--json]
    Fetches GET /api/applied-plugins/<id> and prints the full
    AppliedPluginSnapshot. Useful for inspecting what a run was
    launched against (the immutable contract between plugin and
    run, spec §8.2.1).

  od plugin snapshots diff <id-a> <id-b> [--json]
    Compares two snapshots field-by-field. Surfaces the e2e-2
    invariance check at-a-glance via a digestEqual flag, then
    walks every recorded field with the same +/-/~ glyph format
    as `od plugin diff`.

apps/daemon/src/plugins/snapshot-diff.ts ships diffSnapshots():

  diffSnapshots({ a, b }) \u2192 SnapshotDiffReport
    { pluginId?, digestEqual, entries[], added, removed, changed }

Compared fields:
  Identity:    snapshotId, pluginId, pluginVersion,
               manifestSourceDigest, sourceMarketplaceId, pinnedRef,
               taskKind, status, pluginTitle, pluginDescription,
               query
  Inputs:      typed scalar map (added / removed / changed
               summary)
  Capabilities: capabilitiesRequired / capabilitiesGranted
  Context:     resolvedContext.items (kind:ref pairs)
  Connectors:  connectorsRequired (by id), connectorsResolved
               (id:status), mcpServers (by id)
  GenUI:       genuiSurfaces (by id)
  Pipeline:    stages roster + per-stage atoms[] + until
  Assets:      assetsStaged (by path)

Entries sort lexicographically by field path so output is byte-
deterministic across re-runs. Collection diffs collapse to one
entry with '<n> added, <m> removed' summaries.

Daemon tests: 1728 \u2192 1737 (+9 cases on plugins-snapshot-diff:
equivalence + digestEqual=true, manifestSourceDigest drift,
inputs map churn, capabilities array churn, connector status
drift, pipeline added / per-stage atoms churn, lexicographic
sort, aggregate count parity, pipeline=added asymmetry).

Co-authored-by: Tom Huang <1043269994@qq.com>
2026-05-09 17:03:29 +00:00

5.0 KiB