Skip to content

v0.38.0: managed feature evaluators

Choose a tag to compare

@cmilesio cmilesio released this 26 Nov 08:56
b33a7e0

Add feature flags to an App with shared evaluators, simple tenant checks, and portable defaults. Feature support is optional: the default memory evaluator needs no file and starts no background workers.

Managed feature evaluators

Enable the feature component for the owning App. Inject *features.Manager as features into a service and use a named evaluator:

flags := features.Checkout().For(feature.Target{Key: tenantID})
enabled := flags.Enabled(ctx, "checkout-v2")

Declare Checkout in the project environment and regenerate its accessor. For an explicitly configured file source:

FEATURE_CHECKOUT_DRIVER=file
FEATURE_CHECKOUT_PATH=storage/flags/checkout.json
forj generate --feature

Create a valid definition file before starting an App that selects the file driver. Relative paths resolve from the process working directory. Apps using the default memory source need no definition file; undefined boolean checks return false.

  • Named Apps own their evaluator registrations and can use overlays such as BILLING_FEATURE_CHECKOUT_PATH.
  • Healthy native file watches refresh definitions without periodic polling. Windows and unavailable watches use fallback polling. Transient source read failures retry while retaining the last valid decisions.
  • Snapshot() keeps related decisions on one revision and evaluation time. Instances() exposes refresh health without making transient update failures discard valid configuration.
  • App creation and removal protect surviving resource consumers before changing files. The dependency check is conservative, including Default-only consumers when a named registration would disappear.

Feature resource guide · Feature resource PR #274

WebSocket mask hardening

WebSocket client mask keys now use cryptographic randomness. PR #283

Install and upgrade

go install github.com/goforj/goforj/cmd/forj@v0.38.0
forj --version
# v0.38.0

For existing projects, commit local changes and review the upgrade notes before regenerating. Feature support remains opt-in; enabling it with the default memory source adds no file requirement. The minimum Go version remains Go 1.26.

Full changelog