Skip to content

[upstream-cq] cli/v0.15.1 / sdk/go v0.14.0: context.Context added to all Store interface methods — fork Go adapters must rebase method signatures #412

Description

@dwinter3

Triggering Event

Release: https://github.com/mozilla-ai/cq/releases/tag/cli/v0.15.1
PR mozilla-ai#476: mozilla-ai#476feat(sdk/go): add context.Context to Store interface methods
PR mozilla-ai#477: mozilla-ai#477fix(sdk): stamp writer metadata on every store mutation (Go half)

What Changed

Breaking: Go Store SPI — context.Context on every method (PR mozilla-ai#476)

context.Context is now the first parameter on all seven Store interface methods:

Method Old signature New signature
Unit Unit(id string) Unit(ctx, id)
All All() All(ctx)
Insert Insert(ku) Insert(ctx, ku)
Update Update(ku) Update(ctx, ku)
Delete Delete(id) Delete(ctx, id)
Query Query(opts) Query(ctx, opts)
Stats Stats() Stats(ctx)

Close is unchanged (no cancellable I/O). All three upstream implementations (in-memory, SQLite, PostgreSQL), the Client, and the conformance suite (storetest) have been updated. The SQLite store now uses context-aware database/sql methods (QueryContext, ExecContext, BeginTx, PrepareContext). postgres.New also gains a context.Context parameter to avoid indefinite blocking on pool creation, ping, and schema migration.

This is a compile-time break. Any fork code that implements or embeds the Go Store interface will fail to compile against sdk/go v0.14.0+ until every method signature is updated.

Go-side writer-stamp fix (PR mozilla-ai#477, companion to #411)

The atomic writer-metadata stamping fix (tracked for Python in #411) also covers the Go SDK in this release:

  • stampWriter is now a free function taking an execer interface, runs within the mutation's transaction
  • PostgreSQL Delete is wrapped in a transaction so stamp is atomic with the delete
  • SQLite and PostgreSQL both now stamp last_writer / last_write_at on every Insert, Update, Delete (not just at store construction)

The Python side of this is tracked in #411. The Go side is new here.

Why It Matters for 8th-layer

  1. 8th-layer-agent's Go Store adapters (any custom store implementing the SPI, crosstalk store bridges, harness adapters) will not compile against Go SDK v0.14.0 until method signatures are updated. This blocks any Go SDK version bump.
  2. The conformance suite (storetest) has been updated — running it against fork adapters will catch missed signatures.
  3. The context threading enables proper timeout/cancellation propagation through the full store call stack — the fork should adopt this for AIGRP/DSN request lifecycles where bounded latency is critical.
  4. The writer-stamp atomicity fix ensures last_writer is accurate in multi-agent shared PostgreSQL stores — relevant for 8th-layer's multi-agent crosstalk scenarios.

Recommended Actions

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions