Skip to content

chore: release v0.0.15#74

Merged
squidfunk merged 1 commit intomasterfrom
release/v0.0.15
Mar 23, 2026
Merged

chore: release v0.0.15#74
squidfunk merged 1 commit intomasterfrom
release/v0.0.15

Conversation

@squidfunk
Copy link
Copy Markdown
Member

Summary

This version introduces Specificity — an ordering and tie-breaking concept for selectors and expressions that allows our runtime to determine which module wins when multiple modules compete for a resource. The idea is borrowed from CSS, where more specific selectors take precedence, and adapted here for globs, selectors, and expressions in ZRX.

Background

ZRX uses selectors to query and subscribe to resources. Selectors can be combined into expressions using ANY, ALL, and NOT operators. Each selector has 6 components, each of which can be a glob pattern:

zrs:<provider>:<resource>:<variant>:<context>:<location>:<fragment>

How Specificity works

Each component contributes to a 4-tuple (A, B, C, L):

  • A — literal segments (most specific)
  • B — single-wildcard segments (*, ?)
  • C — double-wildcard segments (**)
  • L — literal character count (tiebreaker)

Tuples are compared lexicographically — higher is more specific. Expressions combine specificities according to their operator: ALL sums them (constraints stack), ANY takes the minimum (only as specific as the broadest arm), and NOT contributes nothing (it filters, but doesn't select).

Examples

zrs:{git,file}:::{docs}:index.md:  # (3, 0, 0, 15)
zrs::::docs:{index,about}.md:      # (2, 0, 0, 12)
zrs:::::index.{md,rst}:            # (1, 0, 0, 8)
zrs:::::{*}:                       # (0, 1, 0, 0)

This is an early alpha — documentation on using specificity in the router and other modules will follow. This release includes the core implementation for selectors and expressions.

## Summary

This version introduces **Specificity** — an ordering and tie-breaking concept for selectors and expressions that allows our runtime to determine which module wins when multiple modules compete for a resource. The idea is borrowed from CSS, where more specific selectors take precedence, and adapted here for globs, selectors, and expressions in ZRX.

### Background

ZRX uses **selectors** to query and subscribe to resources. Selectors can be combined into **expressions** using `ANY`, `ALL`, and `NOT` operators. Each selector has 6 components, each of which can be a glob pattern:

```
zrs:<provider>:<resource>:<variant>:<context>:<location>:<fragment>
```

### How Specificity works

Each component contributes to a 4-tuple `(A, B, C, L)`:

- **A** — literal segments (most specific)
- **B** — single-wildcard segments (`*`, `?`)
- **C** — double-wildcard segments (`**`)
- **L** — literal character count (tiebreaker)

Tuples are compared lexicographically — higher is more specific. Expressions combine specificities according to their operator: `ALL` sums them (constraints stack), `ANY` takes the minimum (only as specific as the broadest arm), and `NOT` contributes nothing (it filters, but doesn't select).

### Examples

```sh
zrs:{git,file}:::{docs}:index.md:  # (3, 0, 0, 15)
zrs::::docs:{index,about}.md:      # (2, 0, 0, 12)
zrs:::::index.{md,rst}:            # (1, 0, 0, 8)
zrs:::::{*}:                       # (0, 1, 0, 0)
```

This is an early alpha — documentation on using specificity in the router and other modules will follow. This release includes the core implementation for selectors and expressions.

Signed-off-by: squidfunk <martin.donath@squidfunk.com>
@squidfunk squidfunk merged commit 5f1787f into master Mar 23, 2026
17 checks passed
@squidfunk squidfunk deleted the release/v0.0.15 branch March 23, 2026 12:54
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