# K1 access discovery
This library owns the access projection's synchronous discovery view. It grants no authority: current records and exact immutable-authority filters decide only which stale discovery IDs are exposed. Profile metadata is ignored.
## Public API
```rust
pub struct AccessDiscovery { ... }
impl AccessDiscovery {
pub fn open(root: &Path) -> Result<Self, String>;
pub fn checkpoint(&self) -> Result<Option<TxId>, String>;
pub fn complete(&self, records: &[StoredAccess]) -> Result<bool, String>;
pub fn commit(
&self,
callback_txid: TxId,
discovery: Option<(AccessId, &AccessPolicy)>,
) -> Result<(), String>;
pub fn missing(
&self,
context: &AccessContext,
records: &[StoredAccess],
access_id: AccessId,
expected_subsystem: SubsystemId,
) -> Result<bool, String>;
pub fn list_user(
&self,
context: &AccessContext,
records: &[StoredAccess],
subsystem: SubsystemId,
) -> Result<Vec<AccessId>, String>;
pub fn list_group(
&self,
context: &AccessContext,
records: &[StoredAccess],
group: GroupId,
subsystem: SubsystemId,
) -> Result<Vec<AccessId>, String>;
pub fn list_user_groups(
&self,
context: &AccessContext,
records: &[StoredAccess],
groups: &[GroupId],
subsystem: SubsystemId,
) -> Result<Vec<(AccessId, Target)>, String>;
pub fn discard(&self) -> Result<(), String>;
}
```
`complete`, `commit`, and `missing` fan out the authority, user and group editors, and user and group viewers; model viewers are excluded. Successful commits advance the durable checkpoint after fanout, including checkpoint-only commits.
Listings preserve discovery order. Combined listings put the user's list first, then unique groups in `GroupId` order, and retain only the first occurrence of each ID. Unknown IDs, wrong-subsystem records, and records whose exact immutable authority is filtered are omitted before IDs or targets are returned. Filtering is not authorization, and stale discovery remains awareness.
`open` and `discard` are not yet benchmarked and perform local filesystem work proportional to dependency-owned state. `checkpoint` is not yet benchmarked and reads one bounded checkpoint value. `complete` is not yet benchmarked and scales with records and their non-model policy subjects. `commit` is not yet benchmarked and scales with one policy's non-model subjects. `missing` is not yet benchmarked and scales with record lookup plus one policy's non-model subjects. `list_user` and `list_group` are not yet benchmarked and scale with one stored discovery list and current-record lookup. `list_user_groups` is not yet benchmarked and scales with the selected discovery lists, unique groups, and current-record lookup.