From 29f274a131f4507c7da7bea7f06278b78f79c711 Mon Sep 17 00:00:00 2001 From: AbdullahT01 Date: Wed, 18 Nov 2026 23:47:09 -0500 Subject: [PATCH] add the redis catalog plugin Signed-off-by: AbdullahT01 --- docs/plugins.md | 3 +- docs/writing-a-plugin.md | 1 + plugins/all/all.go | 1 + plugins/catalog/catalog.go | 228 ++++++++++++++++++ plugins/catalog/catalog_test.go | 116 +++++++++ plugins/catalog/registered_test.go | 11 + plugins/catalog/testdata/README.md | 9 + plugins/catalog/testdata/commits-master.json | 1 + .../catalog/testdata/redis-doc-06f3598.json | 92 +++++++ .../catalog/testdata/redis-doc-cc0427b.json | 112 +++++++++ providers/README.md | 1 + providers/redis.md | 36 +++ 12 files changed, 610 insertions(+), 1 deletion(-) create mode 100644 plugins/catalog/catalog.go create mode 100644 plugins/catalog/catalog_test.go create mode 100644 plugins/catalog/registered_test.go create mode 100644 plugins/catalog/testdata/README.md create mode 100644 plugins/catalog/testdata/commits-master.json create mode 100644 plugins/catalog/testdata/redis-doc-06f3598.json create mode 100644 plugins/catalog/testdata/redis-doc-cc0427b.json create mode 100644 providers/redis.md diff --git a/docs/plugins.md b/docs/plugins.md index f176efb..f55a1b2 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -21,6 +21,7 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe | [`urllib3`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/urllib3.md) | urllib3 | Removals and deprecations in release 2.0.0 | `changelog` | [urllib3/urllib3 CHANGES.rst](https://github.com/urllib3/urllib3/blob/2.0.0/CHANGES.rst) | live | | [`github-actions`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/github-actions.md) | GitHub | GitHub Actions retirements, such as runner images and the `runs-on` labels they remove | `feed` | [GitHub changelog, Actions label (RSS)](https://github.blog/changelog/label/actions/feed/) | live | | [`vertex-ai-models`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/vertex-ai-models.md) | Google | Generative AI model deprecations on Vertex AI | `feed` | [Vertex AI generative AI release notes (Atom)](https://docs.cloud.google.com/feeds/generative-ai-on-vertex-ai-release-notes.xml) | live | +| [`redis`](https://github.com/patch-it-dev/patch-it-plugins/blob/main/providers/redis.md) | Redis | Commands removed entirely from Redis's own command catalog between two snapshots | `catalog` | [redis/redis-doc `commands.json`](https://github.com/redis/redis-doc/blob/master/commands.json) | live | ## The columns @@ -30,7 +31,7 @@ The table between the `plugins:start` and `plugins:end` markers is also publishe | Plugin | The id you pass as `--api` and the `api` field on every event it emits. Lowercase, unique. | | Provider | Whose API, SDK or package it is. | | What it watches | The kind of change it reports, in a few words. | -| Format plugin | Which shared reader it is built on: `openapi` (a spec per release, diffed), `retirements` (a deprecations page), `migrationguide` (an SDK's migration guide), `removedmembers` (a package's table of removed members), `changelog` (a release changelog file), `feed` (an RSS or Atom feed). | +| Format plugin | Which shared reader it is built on: `openapi` (a spec per release, diffed), `retirements` (a deprecations page), `migrationguide` (an SDK's migration guide), `removedmembers` (a package's table of removed members), `changelog` (a release changelog file), `feed` (an RSS or Atom feed), `catalog` (a structured JSON catalog of names, diffed between two snapshots). | | Source | The provider's own public page or file the plugin reads. Every event links back to it. | | Status | `live`: runs every day in patch-it's hosted service. `planned`: accepted, not written yet. `paused`: registered but not run, with the reason in the row. | diff --git a/docs/writing-a-plugin.md b/docs/writing-a-plugin.md index 5cd9b5c..46a2264 100644 --- a/docs/writing-a-plugin.md +++ b/docs/writing-a-plugin.md @@ -25,6 +25,7 @@ Never scrape what the provider's `robots.txt` or terms disallow, and never read | `plugins/removedmembers` | A package's table of removed members at a release tag | A `removedmembers.Guide` | | `plugins/changelog` | A `CHANGELOG.md` / `CHANGES.rst` / `HISTORY.rst` at a release tag | A `changelog.File` | | `plugins/feed` | An RSS or Atom feed | A `feed.Feed` with a reader for that vendor's entries | +| `plugins/catalog` | A flat JSON catalog, one entry per name, with no release tags to pin — a commit SHA stands in | A `catalog.Catalog`, diffed between two snapshots for names that disappeared entirely | ## 3. The interface diff --git a/plugins/all/all.go b/plugins/all/all.go index 8b79d60..e48ae2a 100644 --- a/plugins/all/all.go +++ b/plugins/all/all.go @@ -4,6 +4,7 @@ package all import ( + _ "github.com/patch-it-dev/patch-it-plugins/plugins/catalog" _ "github.com/patch-it-dev/patch-it-plugins/plugins/changelog" _ "github.com/patch-it-dev/patch-it-plugins/plugins/feed" _ "github.com/patch-it-dev/patch-it-plugins/plugins/migrationguide" diff --git a/plugins/catalog/catalog.go b/plugins/catalog/catalog.go new file mode 100644 index 0000000..a89743e --- /dev/null +++ b/plugins/catalog/catalog.go @@ -0,0 +1,228 @@ +// Package catalog is the source plugin for a provider that publishes its +// whole command or endpoint surface as one structured JSON file, one entry +// keyed by name: fetch the newest snapshot, diff it against the last one +// seen (or two given snapshots, to replay a historical change), and report +// every name that disappeared entirely between them. Unlike openapi's typed +// spec, an entry here is opaque: no request or response shape to walk, just +// whether the name is still there. Redis first: its command surface has no +// OpenAPI spec, but redis-doc's commands.json is the real, machine-readable +// file redis.io's own command reference is generated from. +// +// Precision over recall: a name that moves to a different key (a genuine +// rename) reads as one removal and one addition, same as any other. This +// never guesses a rename from two disappearances and appearances landing in +// the same diff; it only ever reports what's gone. +package catalog + +import ( + "context" + "encoding/json" + "fmt" + "log" + "sort" + "time" + + "github.com/patch-it-dev/patch-it-plugins/event" + "github.com/patch-it-dev/patch-it-plugins/plugin" +) + +func init() { + plugin.Register(Plugin{Catalog: Redis}) +} + +// Catalog is one provider's command or endpoint catalog: a single JSON +// object, one key per entry, fetched at a git ref. +type Catalog struct { + API string // the events' api: "redis" + Ecosystem string // the package_release subject's ecosystem: "redis" + Package string // the package_release subject's package: "redis" + Repo string // owner/name on GitHub the catalog lives in + Path string // the catalog's path in the repo + RefsURL string // GitHub's commits API, for the newest ref: .../commits/ +} + +// Redis is redis-doc's commands.json, regenerated from each real Redis +// release and read by redis.io's own command reference (checked 2026-11-18). +// The repo has no tags, so a ref here is a commit SHA, not a release. +var Redis = Catalog{ + API: "redis", Ecosystem: "redis", Package: "redis", + Repo: "redis/redis-doc", Path: "commands.json", + RefsURL: "https://api.github.com/repos/redis/redis-doc/commits/master", +} + +// URL is the catalog as it was at ref: its own provenance. +func (c Catalog) URL(ref string) string { + return fmt.Sprintf("https://raw.githubusercontent.com/%s/%s/%s", c.Repo, ref, c.Path) +} + +// parse reads the catalog as a flat map of name to its raw entry: every +// field of an entry (arity, complexity, ACL categories...) is unread, except +// where an entry's own bytes become an event's excerpt. +func parse(data []byte) (map[string]json.RawMessage, error) { + var out map[string]json.RawMessage + if err := json.Unmarshal(data, &out); err != nil { + return nil, fmt.Errorf("parsing catalog: %w", err) + } + return out, nil +} + +// removed is every name of old that new doesn't have, sorted so the result +// (and the fingerprints built from it) don't depend on map order. +func removed(old, new map[string]json.RawMessage) []string { + var out []string + for name := range old { + if _, ok := new[name]; !ok { + out = append(out, name) + } + } + sort.Strings(out) + return out +} + +// Plugin reads one catalog. +type Plugin struct { + Catalog Catalog +} + +func (p Plugin) Name() string { return p.Catalog.API } + +// Run diffs the newest snapshot against whatever was last stored. +func (p Plugin) Run(ctx context.Context, env plugin.Env) (plugin.Result, error) { + c := p.Catalog + ref, err := p.latestRef(ctx, env) + if err != nil { + return plugin.Result{}, err + } + newContent, err := env.Get(ctx, c.URL(ref)) + if err != nil { + return plugin.Result{}, fmt.Errorf("fetching %s: %w", c.URL(ref), err) + } + last, err := env.Baselines.LastSpec(c.API) + if err != nil { + return plugin.Result{}, fmt.Errorf("loading last catalog: %w", err) + } + if last != nil && last.SHA256 == plugin.SHA256(newContent) { + log.Printf("%s: no change (%s)", c.API, ref) + return plugin.Result{}, nil + } + + var oldContent []byte + var from string + if last != nil { + oldContent, from = last.Content, last.Tag + } + now := env.Now() + events, rejected, err := p.events(oldContent, newContent, from, ref, now) + if err != nil { + return plugin.Result{}, err + } + return plugin.Result{ + Label: ref, + Events: events, + Rejected: rejected, + Baselines: []plugin.Spec{plugin.Baseline(c.API, ref, ref, c.URL(ref), newContent, false, now)}, + }, nil +} + +// Replay diffs two given snapshots. Both are saved marked as replays, so the +// normal-run baseline never moves; the events are stored like any others. +func (p Plugin) Replay(ctx context.Context, env plugin.Env, from, to string) (plugin.Result, error) { + c := p.Catalog + oldContent, err := env.Get(ctx, c.URL(from)) + if err != nil { + return plugin.Result{}, fmt.Errorf("fetching %s: %w", c.URL(from), err) + } + newContent, err := env.Get(ctx, c.URL(to)) + if err != nil { + return plugin.Result{}, fmt.Errorf("fetching %s: %w", c.URL(to), err) + } + now := env.Now() + events, rejected, err := p.events(oldContent, newContent, from, to, now) + if err != nil { + return plugin.Result{}, err + } + return plugin.Result{ + Label: to, + Events: events, + Rejected: rejected, + Baselines: []plugin.Spec{ + plugin.Baseline(c.API, from, from, c.URL(from), oldContent, true, now), + plugin.Baseline(c.API, to, to, c.URL(to), newContent, true, now), + }, + }, nil +} + +// latestRef asks GitHub for the catalog repo's newest commit. +func (p Plugin) latestRef(ctx context.Context, env plugin.Env) (string, error) { + body, err := env.Get(ctx, p.Catalog.RefsURL) + if err != nil { + return "", fmt.Errorf("looking up the newest commit: %w", err) + } + var commit struct { + SHA string `json:"sha"` + } + if err := json.Unmarshal(body, &commit); err != nil { + return "", fmt.Errorf("parsing the commit lookup: %w", err) + } + if commit.SHA == "" { + return "", fmt.Errorf("the commit lookup named no sha") + } + return commit.SHA, nil +} + +// events diffs two parsed snapshots into events. oldContent is empty on a +// plugin's first run (no baseline yet): diffing against no snapshot reports +// nothing, the same as an unchanged one. +func (p Plugin) events(oldContent, newContent []byte, from, to string, now time.Time) ([]event.EventV2, []error, error) { + c := p.Catalog + newEntries, err := parse(newContent) + if err != nil { + return nil, nil, fmt.Errorf("parsing %s: %w", c.URL(to), err) + } + var oldEntries map[string]json.RawMessage + if len(oldContent) > 0 { + oldEntries, err = parse(oldContent) + if err != nil { + return nil, nil, fmt.Errorf("parsing %s: %w", c.URL(from), err) + } + } + + var events []event.EventV2 + var rejected []error + for _, name := range removed(oldEntries, newEntries) { + subject := event.Subject{ + Type: event.SubjectPackageRelease, Ecosystem: c.Ecosystem, Package: c.Package, + Change: event.PackageRemovedSymbol, Symbols: []string{name}, + } + e := event.EventV2{ + API: c.API, Version: to, PreviousVersion: from, + ChangeType: event.ChangeTypeBreaking, + Breaking: true, + Subject: subject, + Description: fmt.Sprintf("%s no longer exists: calling it now fails.", name), + SourceURL: c.URL(from), + SourceExcerpt: excerpt(name, oldEntries[name]), + Confidence: 1.0, + DetectedAt: now, + } + e.Fingerprint = event.FingerprintV2(e.API, e.Version, e.ChangeType, subject, "") + if err := e.Validate(); err != nil { + rejected = append(rejected, fmt.Errorf("%s: %w", name, err)) + continue + } + events = append(events, e) + } + return events, rejected, nil +} + +// excerpt quotes the entry exactly as the old snapshot had it: the evidence +// that name existed, in the catalog's own shape. Capped at the contract's +// 2000-character limit, the entry's closing braces never cut off: nested +// command-line arguments can run long. +func excerpt(name string, raw json.RawMessage) string { + s := fmt.Sprintf("%q: %s", name, string(raw)) + if r := []rune(s); len(r) > 2000 { + s = string(r[:1999]) + "…" + } + return s +} diff --git a/plugins/catalog/catalog_test.go b/plugins/catalog/catalog_test.go new file mode 100644 index 0000000..5d22323 --- /dev/null +++ b/plugins/catalog/catalog_test.go @@ -0,0 +1,116 @@ +package catalog + +import ( + "context" + "testing" + "time" + + "github.com/patch-it-dev/patch-it-plugins/event" + "github.com/patch-it-dev/patch-it-plugins/kit/kittest" + "github.com/patch-it-dev/patch-it-plugins/plugin" +) + +// The two commits redis-doc's own history shows the removal happen between: +// PR #1697 dropped FUNCTION CREATE and FUNCTION INFO from commands.json on +// 2022-01-24 (checked 2026-11-18), replacing the single-function CREATE with +// a whole-library LOAD. Neither command ever reached a tagged Redis release +// (not even 7.0's first release candidate, which shipped a week later with +// neither in its own src/commands/): a real removal, but one that happened +// before any user could depend on it, not a production break. +const ( + oldRef = "cc0427b3c3671e90b92f1ad2fe4e835fd32cd3c9" + newRef = "06f3598f39c7ca86dbdb0aa1668cfdd1b82b908d" +) + +func env(s *kittest.Mem, pages kittest.Pages, t *testing.T) plugin.Env { + return plugin.Env{Baselines: s, Get: pages.Get(t), Now: time.Now} +} + +func fixturePages() kittest.Pages { + return kittest.Pages{ + Redis.URL(oldRef): "testdata/redis-doc-cc0427b.json", + Redis.URL(newRef): "testdata/redis-doc-06f3598.json", + } +} + +// The golden test and the replay fixture in one: testdata/redis-doc-cc0427b.json +// and redis-doc-06f3598.json are real, trimmed excerpts of redis-doc's +// commands.json at those two commits (checked 2026-11-18). Between them, +// FUNCTION CREATE and FUNCTION INFO disappear, FUNCTION LOAD appears, and GET +// (an unrelated, long-lived command) is unchanged. This is the pair the +// plugin's Replay from oldRef to newRef recreates. +func TestReplayRecreatesTheRealFunctionCommandRemoval(t *testing.T) { + ctx := context.Background() + s := kittest.NewMem() + e := env(s, fixturePages(), t) + + rejected, err := kittest.Replay(ctx, e, s, Plugin{Catalog: Redis}, oldRef, newRef) + if err != nil || rejected { + t.Fatalf("replay: rejected=%v err=%v", rejected, err) + } + + events, err := s.All() + if err != nil { + t.Fatalf("reading events: %v", err) + } + // Precision over recall: GET (unchanged) and FUNCTION LOAD (added, not + // removed) must produce nothing. Only the two real removals should. + got := map[string]bool{} + for _, ev := range events { + if len(ev.Subject.Symbols) != 1 { + t.Fatalf("event with %d symbols, want exactly 1: %+v", len(ev.Subject.Symbols), ev) + } + got[ev.Subject.Symbols[0]] = true + } + want := map[string]bool{"FUNCTION CREATE": true, "FUNCTION INFO": true} + if len(got) != len(want) { + t.Fatalf("stored %v, want exactly %v (GET and FUNCTION LOAD must drop silently)", got, want) + } + for name := range want { + if !got[name] { + t.Errorf("missing an event for %s", name) + } + } + + // Acceptance criteria: every event carries source_url and a non-empty + // source_excerpt, is marked breaking, and is placed on the real refs. + for _, ev := range events { + if ev.API != "redis" || ev.Version != newRef || ev.PreviousVersion != oldRef { + t.Errorf("event %v: api=%s version=%s previous_version=%s, want redis %s from %s", + ev.Subject.Symbols, ev.API, ev.Version, ev.PreviousVersion, newRef, oldRef) + } + if ev.ChangeType != event.ChangeTypeBreaking || !ev.Breaking { + t.Errorf("event %v: change_type=%s breaking=%v, want breaking", ev.Subject.Symbols, ev.ChangeType, ev.Breaking) + } + if ev.SourceURL != Redis.URL(oldRef) { + t.Errorf("event %v: source_url=%s, want the old snapshot, where the removed command is still evidenced", ev.Subject.Symbols, ev.SourceURL) + } + if ev.SourceExcerpt == "" { + t.Errorf("event %v: missing source_excerpt", ev.Subject.Symbols) + } + } + + // Replaying the same pair again must not duplicate the events. + if _, err := kittest.Replay(ctx, e, s, Plugin{Catalog: Redis}, oldRef, newRef); err != nil { + t.Fatalf("second replay: %v", err) + } + if again, _ := s.All(); len(again) != len(events) { + t.Errorf("repeating the replay added events: %d -> %d", len(events), len(again)) + } +} + +// Run's own path: looking up the newest commit, then diffing it against +// whatever was last stored. A first run has no baseline to diff against, so +// it reports nothing (same as an unchanged one) and just saves one. +// kittest.Ingest reruns this, so a second run that found anything new would +// fail it too. +func TestRunFindsNothingOnAFirstRunAndStaysQuietOnARerun(t *testing.T) { + pages := kittest.Pages{ + Redis.RefsURL: "testdata/commits-master.json", + Redis.URL(newRef): "testdata/redis-doc-06f3598.json", + } + events := kittest.Ingest(t, Plugin{Catalog: Redis}, pages) + if len(events) != 0 { + t.Errorf("first run found %d events, want 0: there is nothing yet to diff against", len(events)) + } +} diff --git a/plugins/catalog/registered_test.go b/plugins/catalog/registered_test.go new file mode 100644 index 0000000..6a078fa --- /dev/null +++ b/plugins/catalog/registered_test.go @@ -0,0 +1,11 @@ +package catalog + +import ( + "testing" + + "github.com/patch-it-dev/patch-it-plugins/kit/kittest" +) + +func TestRegistersItself(t *testing.T) { + kittest.Registered(t, Plugin{Catalog: Redis}) +} diff --git a/plugins/catalog/testdata/README.md b/plugins/catalog/testdata/README.md new file mode 100644 index 0000000..eea3aac --- /dev/null +++ b/plugins/catalog/testdata/README.md @@ -0,0 +1,9 @@ +# Saved catalog snapshots + +| File | URL | Fetched | License | Quote | +|---|---|---|---|---| +| `redis-doc-cc0427b.json` | https://github.com/redis/redis-doc/blob/cc0427b3c3671e90b92f1ad2fe4e835fd32cd3c9/commands.json | 2026-11-18 | BSD-3-Clause (redis-doc); trimmed to `FUNCTION CREATE`, `FUNCTION INFO` and `GET` | `"FUNCTION CREATE": {"summary": "Create a function with the given arguments (name, code, description)", "since": "7.0.0", ...}` | +| `redis-doc-06f3598.json` | https://github.com/redis/redis-doc/blob/06f3598f39c7ca86dbdb0aa1668cfdd1b82b908d/commands.json | 2026-11-18 | BSD-3-Clause (redis-doc); trimmed to `FUNCTION LOAD` and `GET` | `"FUNCTION LOAD": {"summary": "Create a function with the given arguments (name, code, description)", "since": "7.0.0", ...}` | +| `commits-master.json` | n/a: a stand-in for `GET https://api.github.com/repos/redis/redis-doc/commits/master`'s response shape, not a saved page. The plugin never cites this lookup as an event's evidence, only the two files above. | — | — | — | + +Both `commands.json` snapshots are real, un-invented excerpts: `06f3598` ([PR #1697](https://github.com/redis/redis-doc/pull/1697), 2022-01-24) is the actual commit that removed `FUNCTION CREATE` and `FUNCTION INFO` and added `FUNCTION LOAD`; `cc0427b` is its immediate parent. `GET` is kept whole and unmodified in both as the drop-test fixture: an unrelated, decades-old command that must never produce an event just because the file around it changed. diff --git a/plugins/catalog/testdata/commits-master.json b/plugins/catalog/testdata/commits-master.json new file mode 100644 index 0000000..68ec6b0 --- /dev/null +++ b/plugins/catalog/testdata/commits-master.json @@ -0,0 +1 @@ +{"sha": "06f3598f39c7ca86dbdb0aa1668cfdd1b82b908d"} diff --git a/plugins/catalog/testdata/redis-doc-06f3598.json b/plugins/catalog/testdata/redis-doc-06f3598.json new file mode 100644 index 0000000..08e93d1 --- /dev/null +++ b/plugins/catalog/testdata/redis-doc-06f3598.json @@ -0,0 +1,92 @@ +{ + "FUNCTION LOAD": { + "acl_categories": [ + "@write", + "@slow", + "@scripting" + ], + "arguments": [ + { + "name": "engine-name", + "type": "string" + }, + { + "name": "library-name", + "type": "string" + }, + { + "name": "replace", + "optional": true, + "token": "REPLACE", + "type": "pure-token" + }, + { + "name": "library-description", + "optional": true, + "token": "DESC", + "type": "string" + }, + { + "name": "function-code", + "type": "string" + } + ], + "arity": -5, + "command_flags": [ + "write", + "denyoom", + "noscript" + ], + "complexity": "O(1) (considering compilation time is redundant)", + "group": "scripting", + "hints": [ + "request_policy:all_shards", + "response_policy:all_succeeded" + ], + "since": "7.0.0", + "summary": "Create a function with the given arguments (name, code, description)" + }, + "GET": { + "acl_categories": [ + "@read", + "@string", + "@fast" + ], + "arguments": [ + { + "key_spec_index": 0, + "name": "key", + "type": "key" + } + ], + "arity": 2, + "command_flags": [ + "readonly", + "fast" + ], + "complexity": "O(1)", + "group": "string", + "key_specs": [ + { + "RO": true, + "access": true, + "begin_search": { + "spec": { + "index": 1 + }, + "type": "index" + }, + "find_keys": { + "spec": { + "keystep": 1, + "lastkey": 0, + "limit": 0 + }, + "type": "range" + } + } + ], + "since": "1.0.0", + "summary": "Get the value of a key" + } +} \ No newline at end of file diff --git a/plugins/catalog/testdata/redis-doc-cc0427b.json b/plugins/catalog/testdata/redis-doc-cc0427b.json new file mode 100644 index 0000000..53fd757 --- /dev/null +++ b/plugins/catalog/testdata/redis-doc-cc0427b.json @@ -0,0 +1,112 @@ +{ + "FUNCTION CREATE": { + "acl_categories": [ + "@write", + "@slow", + "@scripting" + ], + "arguments": [ + { + "name": "engine-name", + "type": "string" + }, + { + "name": "function-name", + "type": "string" + }, + { + "name": "replace", + "optional": true, + "token": "REPLACE", + "type": "pure-token" + }, + { + "name": "function-description", + "optional": true, + "token": "DESC", + "type": "string" + }, + { + "name": "function-code", + "type": "string" + } + ], + "arity": -5, + "command_flags": [ + "write", + "noscript" + ], + "complexity": "O(1) (considering compilation time is redundant)", + "group": "scripting", + "since": "7.0.0", + "summary": "Create a function with the given arguments (name, code, description)" + }, + "FUNCTION INFO": { + "acl_categories": [ + "@slow", + "@scripting" + ], + "arguments": [ + { + "name": "function-name", + "type": "string" + }, + { + "name": "withcode", + "optional": true, + "token": "WITHCODE", + "type": "pure-token" + } + ], + "arity": -3, + "command_flags": [ + "noscript" + ], + "complexity": "O(1)", + "group": "scripting", + "since": "7.0.0", + "summary": "Return information about a function by function name" + }, + "GET": { + "acl_categories": [ + "@read", + "@string", + "@fast" + ], + "arguments": [ + { + "key_spec_index": 0, + "name": "key", + "type": "key" + } + ], + "arity": 2, + "command_flags": [ + "readonly", + "fast" + ], + "complexity": "O(1)", + "group": "string", + "key_specs": [ + { + "begin_search": { + "spec": { + "index": 1 + }, + "type": "index" + }, + "find_keys": { + "spec": { + "keystep": 1, + "lastkey": 0, + "limit": 0 + }, + "type": "range" + }, + "read": true + } + ], + "since": "1.0.0", + "summary": "Get the value of a key" + } +} \ No newline at end of file diff --git a/providers/README.md b/providers/README.md index 7baeb09..cdefad8 100644 --- a/providers/README.md +++ b/providers/README.md @@ -22,5 +22,6 @@ One page per plugin id: `providers/.md`. Start from [`_template.md`](_templ | [urllib3.md](urllib3.md) | `urllib3` | `changelog` | | [github-actions.md](github-actions.md) | `github-actions` | `feed` | | [vertex-ai-models.md](vertex-ai-models.md) | `vertex-ai-models` | `feed` | +| [redis.md](redis.md) | `redis` | `catalog` | The list of plugins, with their status, is [docs/plugins.md](../docs/plugins.md). diff --git a/providers/redis.md b/providers/redis.md new file mode 100644 index 0000000..98808be --- /dev/null +++ b/providers/redis.md @@ -0,0 +1,36 @@ +# Redis (`redis`) + +## What it watches + +Redis's command surface: commands that disappear entirely from `redis-doc`'s own catalog of every command, between two snapshots of it. + +Format plugin: `catalog` (`plugins/catalog`), new in this change — no existing format plugin reads a flat JSON catalog keyed by name; see "Alternatives considered" for the formats checked and ruled out first. + +## Why this source + +- **Source:** `commands.json` in [redis/redis-doc](https://github.com/redis/redis-doc), fetched at a commit (`https://raw.githubusercontent.com/redis/redis-doc//commands.json`); the newest commit from `GET https://api.github.com/repos/redis/redis-doc/commits/master`. Checked on 2026-11-18. +- **Why this one:** it's the real, machine-readable file redis.io's own command reference is generated from, one JSON object per command (370 of them as checked), each with the metadata (arity, flags, ACL categories, and for a few, `deprecated_since` / `replaced_by`) that drives the docs site. `redis-doc` has no tags, so a commit SHA stands in for a release; that SHA is still a permanent, immutable citation, the same property a tag gives elsewhere. +- **Alternatives considered:** + - **An OpenAPI spec.** Redis the database has none: it's a binary protocol, not a REST API. (Redis Cloud, the separate hosted-management product, does publish a REST API, but only behind a live Swagger UI at `api.redislabs.com`, not an official, git-pinned spec repo — no stable tag to diff between releases the way Stripe's or GitHub's are.) + - **The official client libraries' changelogs** (`redis-py`'s `CHANGES`, `node-redis`'s `CHANGELOG.md`): both exist, but both stopped being updated once each project moved past its early releases — `CHANGES` says outright "this file contains only the changes history before redis-py version 4.0.0 ... after ... all changes can be found in the Release notes published in GitHub"; `node-redis`'s file stops at v4.0.2 (Jan 2022) while the package itself is past v6. Checked their actual bullets against `plugins/changelog`'s classifier (which needs a plain "Removed `X`" sentence with a backtick'd name): across every version heading in both files, none matched — the prose names JS/Python arguments and config options, not Redis commands, and rarely in backticks. + - **Redis's own deprecations/sunset prose** (`docs.github.com`-style breaking-changes page): Redis has no equivalent single page; deprecation notes live per-command, in the catalog itself (see below). + - **An RSS/Atom feed:** none found for Redis's own release notes; `redis/redis`'s GitHub Releases has an Atom feed (`/releases.atom`), but its entries are prose changelogs with the same shape problem as the client libraries above, not a vendor-labelled "breaking" category the way `feed`'s existing readers (GitHub Actions, Vertex AI) depend on. +- **Quote:** `"FUNCTION INFO"` is in the catalog at commit `cc0427b`; by the very next commit touching the file, it and `FUNCTION CREATE` are gone, replaced by `FUNCTION LOAD` ([PR #1697](https://github.com/redis/redis-doc/pull/1697)). + +## How the provider announces changes + +- **No API version at all**: Redis is versioned by server release (`7.0.0`, `8.2.0`...), with no header, path or date scheme the way Stripe or GitHub have. A client picks a server to connect to; there is no "pin an API version" concept to gate against. +- **Commands are deprecated, essentially never removed.** Of the 370 commands in the live catalog, 21 carry `deprecated_since` (e.g. `HMSET` since 4.0.0, replaced by `HSET`); every one of them still works. Checked directly against the real source of truth, [redis/redis](https://github.com/redis/redis)'s own `src/commands/*.json`: diffing the full command file list between the `7.0.0` and `8.2.0` GA tags removed **zero** files. Redis's own backward-compatibility stance means a shipped command keeps working forever. +- **The one real removal found, `FUNCTION CREATE` / `FUNCTION INFO`, never shipped.** They existed only in `redis-doc`'s catalog during the pre-release design of the Functions feature; `src/commands/function-create.json` doesn't exist even at `7.0-rc1`, the first public release candidate, tagged a week *after* the catalog commit that dropped them. So this is a real, verifiable removal in the repo's history, but not one any real user's code could have depended on — unlike Stripe's, Datadog's or GitHub's demo changes, which all broke a real, shipped version. Recorded here rather than smoothed over: Redis's command surface, at least since 7.0 GA, has had no breaking removal to replay instead. + +## What the plugin reads and ignores + +- Reads: `commands.json` at the newest commit, diffed against the last one stored (or two given commits, to replay). A name present before and missing after becomes a `breaking` `package_release` event (`change: removed_symbol`); the excerpt quotes the entry's own JSON from the snapshot where it still existed. +- Ignores: everything else about a command (arguments, flags, complexity, ACL categories) — only presence is diffed. A name that's only *added* is not an event. A rename is read as one removal, since nothing in the catalog says a disappearance and an appearance are the same command; guessing that would trade precision for recall. +- The live `deprecated_since` / `replaced_by` fields on still-present commands aren't read yet (see "Known gaps"): they're deprecations, not removals, and every one of them already works forever regardless. +- Replays a historical pair (`Replay`, from commit `cc0427b` to `06f3598`) and recreates the real removal of `FUNCTION CREATE` and `FUNCTION INFO` (the golden test uses trimmed excerpts of both commits' `commands.json`, alongside `GET`, unchanged, as the drop-test fixture). + +## Known gaps + +- The 21 commands already marked `deprecated_since` in the live catalog aren't turned into `deprecation` events: there's no second snapshot showing the moment each one was marked that way conveniently paired with a trimmed fixture, and since none of them is ever actually removed, the user-facing urgency is low. A future change could diff for a command gaining `deprecated_since` between two snapshots the same way this one diffs for removal. +- `node-redis` and `redis-py`'s own breaking changes (argument shapes, defaults, RESP3 becoming the default response protocol) aren't watched: real breaking changes exist in both (checked: `node-redis` v4.0.0's "Breaking Changes" section, `redis-py` v8.0.0's RESP2/RESP3 unification), but neither client writes them as the plain, single-symbol sentences `plugins/changelog` already reads elsewhere. A client-library plugin for Redis would need its own, looser reader, not this one.