Consumer-group-owned server filtering, normal and advanced group readers, safe progress, revisions and previews across Rust, Python and TypeScript. Use for Topic and ConsumerGroup filter APIs, wire/filter and the CDC examples.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Consumer Filters?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/laserdata-consumer-filters)
---
name: consumer-filters
description: Consumer-group-owned server filtering, normal and advanced group readers, safe progress, revisions and previews across Rust, Python and TypeScript. Use for Topic and ConsumerGroup filter APIs, wire/filter and the CDC examples.
---
# Consumer-group filters
Load the SDK overview first. The public hierarchy is `Laser → stream → topic → producer` and `Laser → stream → topic → consumer group → filter`. There is no public top-level filter service. Pure filter values remain reusable types.
## Implementation map
- `sdk/src/stream/consumer_group.rs` owns group handles, optional setup policies, creation outcomes and group-scoped administration.
- `sdk/src/stream/transport.rs` owns normal streaming, group-aware delivery, commit policies, cancellation and shutdown.
- `sdk/src/filters/` holds internal catalog clients, routing, membership, advanced readers, bounded outstanding pages, progress and optional local guards.
- `sdk/src/filters/mod.rs` re-exports the policy and evaluator types. The saved-filter catalog frames (`FilterRef`, `FilterMutation`, `FilterPage`, `FilterSummary`, `FilteredPage`, `RecordFault`, and the rest) and `ExactDecimal` are reachable only as `laser_sdk::wire::filter`, and TypeScript keeps them under `wire` in `@laserdata/laser-sdk/full`. `FilterAnnounce` lives in `laser_sdk::capabilities`.
- `wire/src/filter/` defines policies, codecs, requests, replies, revisions and durable operation results. `read.rs` includes automatic group execution, scan ceilings, source history and policy generations.
- `foreign/python/src/consumer_group.rs`, `filters.rs` and `transport.rs` bind the same behavior through Rust. Regenerate the Python stubs.
- `foreign/typescript/src/stream/consumer-group.ts`, `consumer.ts`, `managed/filters.ts` and the wire modules implement the native TypeScript peer. Regenerate both API reports.
- `foreign/go/laser/consumer_group.go`, `consumer_policy.go`, `filter_group_reader.go`, `filters.go`, `filter_catalog.go` and `filter_progress.go` are the Go peer: the group handle (`Selector`, `Filters`, `Consumer`, `OpenReader`), the group's own filter verbs, filtered reads and the acknowledgment bookkeeping. It runs the same evaluator and codec corpora.
## Invariants
A normal group consumer executes its group's policy. The advanced group reader does too. A group policy is configured with a caller-chosen name (`create().filter(name, filter)`, `configure(name, filter)`, `GroupFilterSpec::Definition { name, filter }`), validated by `validate_filter_name` and not unique. The name is a label: the group's own filter is found by its owner identity (`ListFilters.owner`, `FilterSummary.owner`, `GroupFilter::summary` and `delete` through `filters/client.rs` `owned`), never by name, and the same digest under a new name renames it. An unbound group returns all records without payload evaluation, each with `RecordEvaluation::Unfiltered`. A pass fault, foreign or mismatch delivery is `Unevaluated(FaultReason)` with the reason the server's evaluator gave (`FilteredPage.unevaluated` is a list of `RecordFault { offset, reason }`, filled by the streaming server's scan), TypeScript `{ kind: "unevaluated", reason }`, Python `evaluation == "unevaluated"` with `unevaluated_reason`, and an evaluated match `Selected`. The local guard requires the same reason. The advanced reader classifies the capability probe like the group consumer (`policy_aware`): a failed probe is a retryable timeout, a server without filters refuses `filters` with no feature, one serving filters without group reads asks for an upgrade. Explicitly selected saved revisions stay strict. The agent runtime binds each agent's group (one per agent id) to the headers-only addressee filter `agdx.to In [<agent>, "*"]` on `agent.sessions` and `agent.control` when the server resolves group policies and serves native filters and the catalog, and the `Laser` was built from a connection string (`DeliveryEngine` in `sdk/src/agent/consumer.rs`, `resolveEngine` and `bindAddressee` in `foreign/typescript/src/agent/reliable-consumer.ts`), saved under `ADDRESSEE_FILTER_NAME` (`agent-addressee`). Otherwise the group stays unbound and the runtime classifies records on the client. A failed catalog or capability lookup never becomes an unfiltered success.
A normal group consumer, policy-aware or native, always reads after the group's stored offset. Its start only seeds a partition the group never stored (`seed_group_partition` in `sdk/src/stream/transport.rs`). The policy-aware consumer (`FilteredReaderBuilder::seeded`) seeds every such partition it gains before reading it and keeps a seed the server refuses as not held pending. The native consumer seeds only what it holds at the join, after `settled_assignment` waits for the install. The advanced reader keeps its built start for its first assignment. [Client behavior](../../../docs/client-behavior.md#consumers-and-polling) owns the per-start offsets.
Normal batch length limits examined source records per partition request. Advanced `count` limits matches, and `max_examined` is independent. Empty scan results keep progress and distinguish remaining work from end of visible data. A round that found nothing new holds one `AGDX_FILTERED_WAIT` per serving node over every assigned partition and its next scan offset, one per slice of at most `MAX_FILTERED_WAIT_PARTITIONS` (1,024) partitions on a node that serves more, for the smaller of the reader's `max_wait` (default 5 s, the consumer's `max_wait` for a normal group consumer) and `Capabilities.filters.max_wait`, then polls the ready partitions. While the waits are held the reader reads its assignment again every 2 s and a changed assignment ends the wait. Each wait carries a process-unique `wait_id`, and the reader sends `AGDX_FILTERED_WAIT_CANCEL` for the waits still held on other nodes when one answers ready, when the assignment changes, and on close and drop (`cancel_held_waits`, a failed cancel is only logged). `Unsupported` stops waits for the reader, any other failure or an early empty answer falls back to one `idle_interval`, and a server announcing zero gets `idle_interval` pacing. A caller driving its own loop with `try_next_page` or `read_round` calls `FilteredReader::wait_for_records` after an idle round.
Acknowledge only completed contiguous work under the delivered group and source identity and the page's owner context. AGDX confirms the current group policy before acknowledging a page and refuses a changed policy with `conflict`. Do not commit a record before it is delivered unless an explicitly documented pre-delivery mode requires that behavior. The one acknowledgment of an undelivered record is `skip(partition, offset)` on the reader and the policy-aware group consumer, which passes the record a `stop` fault or an oversized record blocks the partition at: `PartitionProgress::skip` keeps the blocked page's fence (group id, generation, ack context, policy) as `skip_target`, folds it into the pending pages like an empty page so it is stored only after every earlier page, and moves the start past the record. A skip at another offset or after the block cleared is `Invalid`, and a native consumer refuses `skip`. `stop` stays the default fault policy. Cancellation must retain recovered deliveries. Do not treat offset zero as an unset checkpoint.
A reader sends each filtered poll to the source partition's primary when the route lookup (`GetPartitionRoute`) answers, through the replica request of the official Iggy SDK, and to the client's own node otherwise (Rust `sdk/src/nodes.rs` and `FilteredReader::read_target`, TypeScript `src/iggy/apache-iggy.ts`). It looks the route up again after `NotPrimary`, an unknown replica, a lost link, a recreated partition or a lost assignment. A backup's `unavailable` refusal also looks the route up and resends once, a request to the known primary unanswered after `ROUTE_RECHECK` (1 s) looks the route up every second and moves when another node leads, and an acknowledgment that finds no primary is resent with the same target on the managed retry backoff for up to 30 s. A node serves the read from its own replica only when it stores the partition: on a cluster wider than the topic's replication factor a node that does not store it refuses reads, acks and waits with `NotPrimary`, and a request that went to the client's own node (no route known) looks the route up again and resends once. The reader sends `FilteredAck` through AGDX with the page policy and `AckContext`. The host confirms the policy and submits the existing fenced Iggy offset mutation. The records body has the standard 40-byte polled head, and the reader refuses a page whose head context differs from the page.
A reused name or offset is not proof of the same history. Catalog freshness uses primary history verification and durable configuration receipts. Group bindings remain immutable per used incarnation, so the SDK offers no revision drafts of a group's own filter and `GroupFilterSpec` carries only a definition. Operator catalog revisions of named filters (`FilterMutation::Revise`) stay for separate groups bound to them. Use separate groups for A/B policies.
Rust defines behavior. Python and TypeScript must implement equivalent limits, errors, setup outcomes, commit timing and lifecycle. Public changes update exports, stubs, API reports and tests together, then regenerate `docs/parity.md` with `python3 scripts/check-parity.py --write` and run `just parity-check`. Keep operation versions at 1.
## Validation and documentation
TypeScript runs regex predicates with `foreign/typescript/src/wire/regex.ts`, a port of the regex-syntax 0.8 grammar run as a Thompson NFA over code points. Each character class compiles to a one-character V8 regex with the `v` flag (`iv` when case-insensitive, which matches Rust's simple case folding), so V8 never backtracks over input. `src/wire/regex-unicode.ts` copies the regex-syntax property alias tables so loose spellings such as `\p{greek}` resolve as in Rust. Known differences: Unicode data comes from Node's ICU (Unicode 16.0 on Node 22.14, the same version as regex-syntax 0.8.11), `\p{ASCII}` is spelled as an explicit range because V8 omits the long s and the Kelvin sign from its case-folded form, `Age` and the segmentation break properties and the binary properties V8 lacks (`Other_*`, `Hyphen`, `InCB`, and a few others) are refused, and the 256 KiB size limit is checked as a lower-bound cost estimate, so TypeScript never refuses a pattern Rust accepts but may accept one Rust refuses.
Use the shared evaluator/codec corpus for verdict parity. Add wire fixtures for intentional shape changes and shared BDD cases for normal and advanced group reads. Verify unbound groups, sparse/empty batches, setup retries, cancellation, multiple members, restart, pause, policy changes and native Iggy compatibility. Cluster claims require actual cluster evidence.
Update root/crate/language READMEs, API documentation, `docs/agdx.md` A14, the tutorial, contributor guidance, focused skills, all three CDC examples and the public Consumer Filters guide. Never describe a proposed endpoint or a skipped test as shipped or passing.