# ov.base

Single source of truth (SSOT) for the `ov` artifact schema.

One Pydantic v2 model tree defines *what a capture is* and \*what an analysis
produces\*. Every other module reads from these models rather than inventing its
own shapes – this is the SSOT discipline from the build specification (§3.3).

The tree has four families:

* **Operate value types** – [`Action`](#ov.base.Action), [`Affordance`](#ov.base.Affordance),
  [`Observation`](#ov.base.Observation), [`ActionResult`](#ov.base.ActionResult), [`ProgressSignal`](#ov.base.ProgressSignal). These
  > are the deterministic, model-free currency of the `operate/` “hands”.
* **Capture artifacts** – [`Artifact`](#ov.base.Artifact), [`JourneyStep`](#ov.base.JourneyStep),
  [`CaptureRun`](#ov.base.CaptureRun). What a browser session records.
* **Inferred facts** – [`Scored`](#ov.base.Scored), [`TechFinding`](#ov.base.TechFinding),
  [`Endpoint`](#ov.base.Endpoint). Probabilistic conclusions that always carry confidence and
  > provenance (D2: outputs are never ground truth).
* **Analysis outputs** – [`Evidence`](#ov.base.Evidence), [`Severity`](#ov.base.Severity),
  [`Finding`](#ov.base.Finding), [`EvidenceBundle`](#ov.base.EvidenceBundle). The normalized currency of the
  > analysis lenses and the grounded LLM layer (D3 + D4).
* **Review/regression outputs** – [`FindingDelta`](#ov.base.FindingDelta), [`RunDiff`](#ov.base.RunDiff). The
  own-target *drift* between a run and a stored prior baseline (review mode,
  §10); cheap by design because artifacts are content-addressed.

## Design notes

* IDs are generated by [`new_id()`](#ov.base.new_id) (prefix + short uuid) so artifacts and
  findings are addressable and joinable across the store.
* `confidence` appears twice on purpose, matching the spec: [`Scored`](#ov.base.Scored)
  uses an integer 0-100 (Wappalyzer-style) for *detected technologies*;
  [`Finding`](#ov.base.Finding) carries a float 0-1 for *analysis judgments*.

### Functions

| [`new_id`](#ov.base.new_id)([prefix])   | Return a short, unique, prefixed id, e.g. `"step_3f9a1c2b"`.         |
|---------------------------------------------------------------------|----------------------------------------------------------------------|
| [`utcnow`](#ov.base.utcnow)()           | Timezone-aware current UTC time (the project's canonical timestamp). |

### Classes

| [`Action`](#ov.base.Action)(\*, type[, ref, description, text, ...])    | A single deterministic operation against the target.                              |
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [`ActionResult`](#ov.base.ActionResult)(\*, action, ok[, error, ...])         | Outcome of `ov.operate.act.act()` -- success/error *plus* a fresh read.           |
| [`Affordance`](#ov.base.Affordance)(\*, ref, role[, name, bbox, ...])       | One actionable element as perceived by a perception strategy.                     |
| [`Artifact`](#ov.base.Artifact)(\*[, artifact_id, step_id, uri, ...])     | A content-addressed blob in the store, referenced by id everywhere else.          |
| [`CaptureRun`](#ov.base.CaptureRun)(\*[, run_id, target_url, mode, ...])    | Everything one `observe` produced; artifacts live in the store by id.             |
| [`Endpoint`](#ov.base.Endpoint)(\*[, confidence, provenance, kind, ...])  | One synthesized API endpoint, with GenSON-merged request/response schemas.        |
| [`Evidence`](#ov.base.Evidence)(\*[, evidence_id, artifact_id, ...])      | The addressable unit an LLM claim must cite (D4).                                 |
| [`EvidenceBundle`](#ov.base.EvidenceBundle)(\*[, step_id, contract, ...])       | The grounded bundle a vision LLM reasons over (assembled model-free; §8.1).       |
| [`Finding`](#ov.base.Finding)(\*[, finding_id, title, ...])              | SSOT for every UX / a11y / perf / arch / robustness finding (D3 + D4).            |
| [`FindingDelta`](#ov.base.FindingDelta)(\*, key, status[, direction, ...])    | One finding's status between a run and its baseline (review-mode currency).       |
| [`JourneyStep`](#ov.base.JourneyStep)(\*[, id, intent, action, ...])         | One recorded step of the user journey -- doubles as UX evidence (§2.3).           |
| [`Observation`](#ov.base.Observation)(\*, strategy[, url, affordances, ...]) | The uniform result of any perception strategy (a pure read).                      |
| [`ProgressSignal`](#ov.base.ProgressSignal)(\*[, repeated_action, ...])         | Deterministic loop / no-progress *facts* (the package never decides to stop).     |
| [`RunDiff`](#ov.base.RunDiff)(\*, run_id, baseline_run_id[, ...])        | Own-target regression: a run vs a stored prior baseline run (review mode, §10).   |
| [`Scored`](#ov.base.Scored)(\*[, confidence, provenance])               | Mixin for every inferred (non-observed) fact.                                     |
| [`Severity`](#ov.base.Severity)(\*, impact_tier[, reach, score])          | D3: `severity = impact_tier x reach` (prioritizes high-reach over rare-critical). |
| [`TechFinding`](#ov.base.TechFinding)(\*[, confidence, provenance, ...])     | One detected technology (framework, library, CDN, analytics, hosting).            |

### *class* ov.base.Action(\*, type, ref=None, description=None, text=None, url=None, key=None, value=None, args=<factory>)

Bases: `BaseModel`

A single deterministic operation against the target.

Mirrors Playwright-MCP’s require-description-and-ref safety: actions that
touch an element carry a `ref` (a stable affordance handle) *and* a human
`description` so the journal records intent legibly.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.ActionResult(, action, ok, error=None, observation=None, t_ms=0.0)

Bases: `BaseModel`

Outcome of `ov.operate.act.act()` – success/error *plus* a fresh read.

The fresh [`Observation`](#ov.base.Observation) is the contract that lets the host (policy
layer) decide the next step without a second explicit observe call.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Affordance(, ref, role, name='', bbox=None, enabled=True, editable=False)

Bases: `BaseModel`

One actionable element as perceived by a perception strategy.

`bbox` is `(x, y, w, h)` in CSS pixels when a strategy can compute it
(always for Screenshot/Hybrid, optional for pure AX snapshots).

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Artifact(\*, artifact_id=<factory>, kind, step_id=None, uri='', content_hash=None, content_type=None, size=None, meta=<factory>)

Bases: `BaseModel`

A content-addressed blob in the store, referenced by id everywhere else.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.CaptureRun(\*, run_id=<factory>, target_url='', mode='reconstruct', started_at=<factory>, finished_at=None, steps=<factory>, artifacts=<factory>, fingerprint=<factory>, rendering_model=None, source_maps_present=None, api_surface=<factory>, findings=<factory>, settings_snapshot=<factory>, notes=<factory>)

Bases: `BaseModel`

Everything one `observe` produced; artifacts live in the store by id.

#### artifact_by_id(artifact_id)

Return the [`Artifact`](#ov.base.Artifact) with `artifact_id` or `None`.

* **Return type:**
  [`Artifact`](#ov.base.Artifact) | [`None`](https://docs.python.org/3/builtins/constants.html#None)

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {'validate_assignment': False}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Endpoint(\*, confidence=50, provenance=<factory>, method, path_template, kind='rest', request_schema=None, response_schema=None, auth=None, coverage=<factory>)

Bases: [`Scored`](#ov.base.Scored)

One synthesized API endpoint, with GenSON-merged request/response schemas.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Evidence(\*, evidence_id=<factory>, kind, artifact_id=None, summary='', meta=<factory>)

Bases: `BaseModel`

The addressable unit an LLM claim must cite (D4).

The model is shown the derived `summary` (a fact, not raw bytes); the
`artifact_id` resolves – via a lookup tool – to the screenshot crop,
network record or metric, for just-in-time retrieval during verification.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.EvidenceBundle(\*, step_id=None, contract='', marked_image_artifact_ids=<factory>, crop_artifact_ids=<factory>, facts=<factory>, marks=<factory>, token_budget=<factory>, task='')

Bases: `BaseModel`

The grounded bundle a vision LLM reasons over (assembled model-free; §8.1).

Layout contract: `[role/system + cite-or-abstain] -> [marked image(s)] ->
[facts keyed to mark/fact ids] -> [task last]`. Token cost is *computed*
(`token_budget`), not hoped for.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Finding(\*, finding_id=<factory>, type, signal, category, title='', wcag_criterion=None, heuristic=None, engine_rule_id=None, severity=None, evidence_refs=<factory>, judgment=None, location=None, observed='', metric_detail=None, suggested_fix=None, source_layer='deterministic', confidence=1.0, needs_human_review=False, diff_status=None)

Bases: `BaseModel`

SSOT for every UX / a11y / perf / arch / robustness finding (D3 + D4).

The hard fact/judgment split lives here: `evidence_refs` are *cited*
(never authored by a model), `judgment` is model interpretation only. A
finding with no resolvable evidence is rejected (cite-or-abstain); the
honest “can’t tell from the evidence” outcome is `type="undetermined"`.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.FindingDelta(, key, status, direction='neutral', signal='', category='', title='', finding_id=None, baseline_finding_id=None, severity_score=None, baseline_severity_score=None, severity_tier=None, detail=None)

Bases: `BaseModel`

One finding’s status between a run and its baseline (review-mode currency).

`status` is the per-finding cross-run verdict; `direction` rolls it into
the regression/improvement framing a downstream modification agent acts on.
A finding is matched across runs by a stable semantic `key` (see
[`ov.analysis.diff.finding_key()`](ov.analysis.diff.html.md#ov.analysis.diff.finding_key)) – never by its per-run `finding_id`.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.JourneyStep(\*, id=<factory>, intent='', action=None, affordances_seen=<factory>, outcome='ok', artifact_ids=<factory>, pre_obs_hash=None, post_obs_hash=None, network_delta=0, console_delta=0, note=None, t_ms=0.0)

Bases: `BaseModel`

One recorded step of the user journey – doubles as UX evidence (§2.3).

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Observation(\*, strategy, url=None, affordances=<factory>, aria_snapshot=None, screenshot_artifact_id=None, obs_hash='', title=None, t_ms=0.0)

Bases: `BaseModel`

The uniform result of any perception strategy (a pure read).

`obs_hash` is a content hash of the salient observable state; it is what
[`ProgressSignal`](#ov.base.ProgressSignal) uses to detect no-progress without an LLM.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.ProgressSignal(\*, repeated_action=False, no_new_signal_steps=0, url_stasis=False, ax_stasis=False, repeated_error=False, loop_suspected=False, detail=<factory>)

Bases: `BaseModel`

Deterministic loop / no-progress *facts* (the package never decides to stop).

The host (policy layer) interprets these against its budgets. See §2.3: “the
package detects and reports no-progress; the host decides to abort.”

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.RunDiff(\*, run_id, baseline_run_id, target_url='', created_at=<factory>, finding_deltas=<factory>, tech_added=<factory>, tech_removed=<factory>, endpoints_added=<factory>, endpoints_removed=<factory>, rendering_model_change=None, source_maps_change=None, notes=<factory>)

Bases: `BaseModel`

Own-target regression: a run vs a stored prior baseline run (review mode, §10).

Produced by [`ov.analysis.diff.diff_runs()`](ov.analysis.diff.html.md#ov.analysis.diff.diff_runs) from two analyzed
`CaptureRun`s of the same target. The :attr:`finding_deltas` list is
the SSOT; [`counts`](#ov.base.RunDiff.counts)/[`has_drift`](#ov.base.RunDiff.has_drift) are *derived* (`@computed_field`,
so they serialize) and [`regressions`](#ov.base.RunDiff.regressions)/[`improvements`](#ov.base.RunDiff.improvements) are views over
the deltas – nothing is stored twice.

```pycon
>>> d = RunDiff(run_id="run_b", baseline_run_id="run_a", finding_deltas=[
...     FindingDelta(key="k1", status="new", direction="regression"),
...     FindingDelta(key="k2", status="resolved", direction="improvement"),
... ])
>>> d.counts["new"], d.counts["resolved"], d.has_drift
(1, 1, True)
>>> [r.key for r in d.regressions], [i.key for i in d.improvements]
(['k1'], ['k2'])
```

#### *property* counts *: [dict](https://docs.python.org/3/builtins/stdtypes.html#dict)[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [int](https://docs.python.org/3/builtins/functions.html#int)]*

Per-status tallies derived from the deltas (the headline of a diff).

#### *property* has_drift *: [bool](https://docs.python.org/3/builtins/functions.html#bool)*

`True` if anything changed across runs (findings, stack, API, or model).

#### *property* improvements *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[FindingDelta](#ov.base.FindingDelta)]*

Deltas that were resolved or got better since the baseline.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

#### *property* regressions *: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[FindingDelta](#ov.base.FindingDelta)]*

Deltas that got worse or are newly present (a downstream fix list).

### *class* ov.base.Scored(\*, confidence=50, provenance=<factory>)

Bases: `BaseModel`

Mixin for every inferred (non-observed) fact.

Map-backed reconstructions must rank above name-lost (un-mapped) ones; that
ordering is expressed through `confidence` + `provenance`.

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.Severity(\*, impact_tier, reach=<factory>, score=0.0)

Bases: `BaseModel`

D3: `severity = impact_tier x reach` (prioritizes high-reach over rare-critical).

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### *class* ov.base.TechFinding(\*, confidence=50, provenance=<factory>, name, categories=<factory>, version=None)

Bases: [`Scored`](#ov.base.Scored)

One detected technology (framework, library, CDN, analytics, hosting).

#### model_config *: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[ConfigDict]* *= {}*

Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].

### ov.base.new_id(prefix='id')

Return a short, unique, prefixed id, e.g. `"step_3f9a1c2b"`.

```pycon
>>> i = new_id("run")
>>> i.startswith("run_")
True
>>> len(new_id("x").split("_")[1])
8
```

* **Return type:**
  [`str`](https://docs.python.org/3/builtins/stdtypes.html#str)

### ov.base.utcnow()

Timezone-aware current UTC time (the project’s canonical timestamp).

* **Return type:**
  [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime)
