feat(ops-run): carry harness_profile_ref and attribution refs
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 0s
Build and Publish Container Image / build-and-push (push) Successful in 19s

ACTIVITY-WP-0032-T02 / ACT-ADR-006. ops_runs grows harness_profile_ref (text,
indexed) and execution_refs (jsonb), migration 0008, threaded through the
emission path, queue projection, and run artefacts.

The important part is the enforcement, not the columns. ACT-ADR-006 says
approach_hint must never override, synthesize, or fall back from an absent or
invalid harness_profile_ref — a silent fallback would reintroduce the
claim-time routing failure of 2026-08-17. resolve_execution_selector never
consults the hint: a malformed ref raises even when a hint is present, and
ACTIVITY_CORE_REQUIRE_HARNESS_PROFILE turns an absent ref into an error once
definitions have migrated.

Validation is structural only, since the glas-harness catalogue is
authoritative and must not be mirrored. Requiring the <id>@<version> pin is
worth doing locally: GlasProfiles.resolve matches an unpinned ref against every
version and refuses it as ambiguous, so the pin converts a late failure into an
emission-time error without knowing any profile id.

Migration verified on real PostgreSQL 16: upgrade, downgrade, re-upgrade, and a
legacy-shaped row still inserts and stays claimable.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-08-21 14:14:08 +02:00
parent 1c4b3c592c
commit 5bd0ee5ff9
10 changed files with 428 additions and 7 deletions

View file

@ -117,10 +117,27 @@ Written up as `docs/adr/adr-006-glas-profile-execution.md`.
```task
id: ACTIVITY-WP-0032-T02
status: todo
status: done
priority: high
```
Done 2026-08-21. `ops_runs` grows `harness_profile_ref` (text, indexed) and
`execution_refs` (jsonb, default `{}`), migration `0008`, threaded through
`ops_run_queue.py`, `activities.py`, and `run_artifacts.py`.
`src/activity_core/glas_profile.py` holds the selection rules;
`docs/ops-run-queue.md` documents the contract.
The no-fallback rule is enforced in `resolve_execution_selector`, not merely
documented: a malformed ref raises even when a hint is present, and
`ACTIVITY_CORE_REQUIRE_HARNESS_PROFILE` makes an absent one an error once
definitions have migrated. 34 tests, with the `TestNoFallbackToApproachHint`
class covering the property directly.
Migration verified against a real PostgreSQL 16: upgrade → columns and index
present → downgrade 0007 → clean re-upgrade. A legacy-shaped row (approach_hint
only, no profile) still inserts, defaults `execution_refs` to `{}`, and stays
`open`/claimable — existing production runs are unaffected.
Add `harness_profile_ref` and the correlation/attribution refs
to the ops_run model, emission path (`activities.py`), queue projection
(`ops_run_queue.py`), and run artefacts (`run_artifacts.py`), with a migration.