---
url: "https://vueda.dev/v3/reference/api/py/vueda.history.visibility.md"
title: "history.visibility"
---

# history.visibility

## Overview

Which history events a requester may read.

The rule has two halves. Events on the requested object are visible, because the endpoint has
already authorized that object. Events on a related row follow that row: visible while the
requester can read it, and after deletion only when the model's visibility never depended on the
row in the first place.

Every part of the rule is a query predicate, so the filter runs before pagination and a hidden
event leaves no trace in a page count.

## `related_tracked_models` {#related_tracked_models}

Every tracked model whose events can reference ``model``, excluding the model itself.

The schema decides this list, so the number of subqueries the predicate builds depends on the
shape of the models rather than on how much history exists.

### Signature {#related_tracked_models-signature}

`related_tracked_models(model)`

#### Parameters {#related_tracked_models-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="related_tracked_models-param-model">model</span> |  | yes |  |  |

### Source {#related_tracked_models-source}

`server/vueda/history/visibility.py:43`

## `self_predicate` {#self_predicate}

A predicate that selects the events written to the requested object itself.

### Signature {#self_predicate-signature}

`self_predicate(instance)`

#### Parameters {#self_predicate-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="self_predicate-param-instance">instance</span> |  | yes |  |  |

### Source {#self_predicate-source}

`server/vueda/history/visibility.py:57`

## `visibility_predicate` {#visibility_predicate}

A predicate over the aggregate event columns for one requested object and one requester.

### Signature {#visibility_predicate-signature}

`visibility_predicate(instance, user)`

#### Parameters {#visibility_predicate-parameters}

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| <span id="visibility_predicate-param-instance">instance</span> |  | yes |  |  |
| <span id="visibility_predicate-param-user">user</span> |  | yes |  |  |

### Source {#visibility_predicate-source}

`server/vueda/history/visibility.py:62`

## Source

`server/vueda/history/visibility.py`
