v0.3.0
Added
- Multivariate flags:
Bandera.variant/2andput_variants/3for stable per-actor N-way allocation. Bucketing uses a weighted SHA-256 hash — the same actor always sees the same variant across nodes and restarts. - Ecto schema v2: a nullable
valuecolumn stores variant gate payloads.Bandera.Ecto.Migrations.upgrade_v2/0migrates an existing table; new installs get the column automatically viaup/0. - Context-based targeting rules:
enable(flag, when: constraints)and a:contextmap onenabled?/2. Supported operators::eq,:neq,:in,:not_in,:contains,:gt,:gte,:lt,:lte,:matches(regex). - Reusable segments:
put_segment/2stores a named constraint set;enable(flag, for_segment: name)references it. Segment rules are expanded at evaluation time so changing a segment immediately affects every flag that uses it. - Flag prerequisites:
enable(flag, requires: other_flag)requires another flag to be enabled (or disabled with{:flag, false}) before the dependent flag can turn on. Dependency cycles and missing parents fail closed. - Scheduled activation:
enable(flag, schedule: {start, stop})enables a flag only inside an ISO-8601 UTC time window. Either bound may benilfor an open-ended start or end. Malformed windows fail closed. - Audit log:
Bandera.Audit.attach/2anddetach/1register callbacks that receive a%Bandera.Audit.Event{}on every write. Pass:bytoenable/2,disable/2, andclear/2to record who made the change. - Stale flag tracking: start
Bandera.Usagein your supervision tree and callattach/0at boot; then useBandera.stale_flags/1ormix bandera.flags --stale [--older-than N]to find flags not evaluated in the last N days (default 30). - Dashboard: inline editors for variant, rule-constraint, segment, prerequisite, and schedule gates in the expanded flag row.
- Dashboard: per-gate-type summaries shown in collapsed flag rows.
enabled?/2:defaultoption: passdefault: trueto fail open when the store is unreachable (the default behaviour remains fail closed).- Symmetric
clear/2options for variant, rule, segment, prerequisite, and schedule gates — matching the correspondingenable/2options.
Changed
- Re-added
jasonas a direct dependency (required for variant gate JSON serialization in Ecto and Redis stores). It was dropped in 0.2.0 in favour of Elixir's built-inJSONmodule, but structured gate payloads need encoder options not available in the standard library.
Fixed
stale_flags/1: negative window values are clamped to zero.- Telemetry: audit and usage handlers that raise are caught; they no longer crash the telemetry pipeline.
- Stores: JSON deserialization of unknown gate types now fails softly instead of crashing; prerequisite flag names are bound as atoms at load time.
- Prerequisites: resolution is memoized per
enabled?call; cycles and unknown parents fail closed rather than looping. - Targeting: empty rule sets now fail closed instead of granting access to all callers.
- Variant weights: negative and non-numeric weight values are rejected at write time.
- Constraint evaluation: comparisons are numeric-aware when both sides are numbers; compiled regexes are cached per constraint.
Full changelog: v0.2.0...v0.3.0