# Local Visibility Barrier (dev profile)

This document describes how to boot the current `sf-visibility-barrier` binary locally and which
environment variables control its bootstrap configuration.

## Environment variables

`sf-visibility-barrier` reads the following environment variables:

- `SF_VISIBILITY_BARRIER_LISTEN_ADDR`
  - Type: `host:port`
  - Default: `127.0.0.1:50562`
  - Meaning: where the gRPC server listens for `VisibilityBarrierInternalService`.

- `SF_VISIBILITY_BARRIER_BOOTSTRAP_EPOCH`
  - Type: `u64`
  - Default: `1`
  - Meaning: fenced barrier epoch for diagnostics; MUST be > 0.

- `SF_VISIBILITY_BARRIER_PUBLISH_CONCURRENCY`
  - Type: `usize`
  - Default: `4`
  - Meaning: maximum number of concurrent publish tasks (calls into `ManifestPublisherClient`).

- `SF_VISIBILITY_BARRIER_MAX_PENDING_INTENTS_PER_COLLECTION`
  - Type: `usize`
  - Default: `4096`
  - Meaning: per-collection pending intent cap enforced at `RegisterWriteIntent`.
  - Notes:
    - `0` disables the cap (not recommended for production).
    - When the cap is reached, the barrier fails closed with retryable `SF_RATE_LIMITED`.

## Boot locally

From the repository root:

```bash
cd rust
cargo run -p sf-visibility-barrier
```

Or override the listen address:

```bash
cd rust
SF_VISIBILITY_BARRIER_LISTEN_ADDR=127.0.0.1:50562 cargo run -p sf-visibility-barrier
```

## Notes (current bootstrap limitations)

The current bootstrap binary wires:

- an in-memory durable store adapter (intended for early smoke tests), and
- a placeholder manifest publisher client that returns `SF_BACKEND_UNAVAILABLE`.

As a result, publish completion and `SliceVisible` emission are not expected in the standalone
bootstrap process without additional wiring.

