Skip to content

Releases

pgokf 0.7.0

Choose a tag to compare

@LogicOcean LogicOcean released this 22 Nov 21:01

A companion release: one pooled connection lifecycle shared by the
long-running companions, so pgokf-mcp survives a dropped link to
PostgreSQL. The catalog is unchanged - no SQL object or data differs from
0.6.0 - so the receipt-only pgokf--0.6.0--0.7.0.sql edge carries an
installed 0.6.0 catalog to 0.7.0 through an ordinary
ALTER EXTENSION pgokf UPDATE, and the committed pgokf--0.7.0.sql install
script is the 0.6.0 one regenerated under the new version.

Security

  • url 2.5.9 for RUSTSEC-2026-0592 (a stack overflow in
    Url::origin() on a URL nested in many blob: prefixes).
    pgokf-confluence calls Url::origin(), but only on http, https and
    mailto links and on API links of at most 16 KiB, too short to nest deeply
    enough to overflow, so it was not exploitable; the update keeps the
    advisory gates passing and removes the flaw. The lockfile changes url
    and the form_urlencoded 1.2.3 it requires, and the third-party notices
    follow.
  • quinn-proto 0.11.19 and quinn-udp 0.5.16 for RUSTSEC-2026-0523,
    RUSTSEC-2026-0524 and RUSTSEC-2026-0538
    (a peer opening streams beyond
    the stream limit, a long Retry token that can panic or exhaust a client's
    memory, and a receive loop that can spin on a truncated datagram).
    quinn is in the lockfile only through reqwest's optional HTTP/3
    support, which no pgokf crate enables, so no pgokf binary links it. The
    lockfile changes those two entries, so cargo audit passes again.
  • Two unmaintained-crate notices are accepted, not fixed.
    RUSTSEC-2026-0543 marks chrono unmaintained and RUSTSEC-2026-0542
    marks humantime unmaintained; neither reports a vulnerability. chrono
    comes in through arrow and parquet (the extension's Parquet export) and
    humantime through object_store (pgokf-ingest), and the latest
    releases of both still require them. deny.toml and the new
    .cargo/audit.toml ignore exactly those two IDs, each with its reason,
    so cargo deny check and cargo audit pass again and any other advisory
    still fails.

Fixed

  • pgokf-mcp reconnects instead of exiting. It held its catalog
    connections for its whole life and stopped when any of them closed,
    leaving the restart to a supervisor. Anything that closes idle
    connections turned that into a restart loop with a growing back-off:
    Azure Container Apps' TCP ingress closes a connection idle for 300
    seconds, so an idle server exited every five minutes. Its reader, writer
    and token-lookup connections now come from pools that replace a closed
    connection on the next request. The health check asks on a connection of
    its own, so /healthz reports 503 only while the catalog cannot be
    reached, not while every reader is busy.

Changed

  • pgokf-pgconn owns the connection lifecycle. Besides the connect
    step and TLS policy it now provides:

    • Session: the tenant and the statement and lock bounds applied to
      every new connection.
    • Pool: the pool pgokf-web used, set up from a Session.
    • Borrowed: the guard for one piece of work.
      • finish takes the guard and returns the connection at once, so
        finished work cannot keep a connection while it borrows another.
      • transaction commits or rolls back and returns the connection only
        once the transaction has ended cleanly.
      • Work abandoned mid-flight closes its connection instead of returning
        it, and every pooled connection has the server check each second that
        its client is still there (client_connection_check_interval), so
        the abandoned statement stops too and the pool's backends stay within
        its size.

    pgokf-web and pgokf-mcp build their pools through it, and
    pgokf-confluence sets its import session up through Session.

  • pgokf-mcp connections.

    • Plugin builds no longer queue behind one another: each borrows a
      reader connection of its own. Writes still run one at a time.
    • A request waits at most a minute for a free connection.
    • A refused read (a bad cursor or limit) rolls back and hands its
      connection back rather than closing it.
    • Each process opens at most twelve connections: eight readers, one for
      the health check, two for token lookups and one writer.
  • PostgreSQL 19 is tested as the GA 19.0. PostgreSQL 19.0 shipped on
    2026-11-20 and the pinned 19 RC 2 base image and packages no longer
    exist, so CI's PG19 leg (clippy, the in-database suite, an image smoke
    test) now builds from postgres:19 and PGDG's 19.x packages exactly as
    15-18 do, and the verifier refuses a prerelease tag or package for any
    major. PG19 packages and images are still not published.

pgokf 0.6.0

Choose a tag to compare

@LogicOcean LogicOcean released this 13 Nov 19:59

A companion release: pushed Confluence events through a private Forge app,
and a supply-chain advisory fix. The catalog is unchanged - no SQL object or
data differs from 0.5.0 - so the receipt-only pgokf--0.5.0--0.6.0.sql
edge carries an installed 0.5.0 catalog to 0.6.0 through an ordinary
ALTER EXTENSION pgokf UPDATE, and the committed pgokf--0.6.0.sql
install script is the 0.5.0 one regenerated under the new version.

Added

  • Pushed Confluence events. A private Forge app
    (integrations/confluence-forge) has Confluence Cloud push page, comment,
    and task events through Forge Remote to a new receiver,
    pgokf-confluence-events, in the companions image. The receiver accepts a
    delivery only when its Forge Invocation Token verifies against Atlassian's
    published keys and names the configured app and no Confluence site but the
    configured one, drops events the app caused itself, and writes accepted
    events as JSON lines with a key that is identical for redeliveries. A
    delivery whose signing key cannot be read yet, or whose sink is slow or
    failing, is answered 503 so Forge retries it; a body declared as anything
    but JSON, a body that is not the documented envelope, and an event naming a
    page, space, or comment by anything but a canonical Confluence ID are
    refused, and refusal reasons are logged one line each. The companions
    smoke test runs the new binary. Recording events in the catalog is not part
    of this change.

Security

  • ammonia 4.1.9 for RUSTSEC-2026-0533 (mutation XSS through embedded
    SVG and MathML). The advisory concerns sanitizers that allow a raw-text
    element such as script or style; pgokf-web allows none (ammonia's
    defaults plus heading ids and one span class), so it was not exploitable.
    The lockfile changes that one entry, so cargo deny check passes again.

Fixed

  • Advance required nonproduction PostgreSQL 19 compatibility from RC 1 to
    RC 2 after PGDG's candidate changed. Pin the official postgres:19rc2
    image index and require RC 2 server and development packages. Stable
    distribution remains PostgreSQL 15–18; no stable PG19 artifact is published.

pgokf 0.5.0

Choose a tag to compare

@LogicOcean LogicOcean released this 12 Nov 03:56

pgokf 0.5.0

A companion release: the Confluence Cloud ingestion companion, an enforced
--tls for every companion, and a supply-chain advisory fix. The catalog
is unchanged - no SQL object or data differs from 0.4.0 - so the
receipt-only pgokf--0.4.0--0.5.0.sql edge carries an installed 0.4.0
catalog to 0.5.0 through an ordinary ALTER EXTENSION pgokf UPDATE, and
the committed pgokf--0.5.0.sql install script is the 0.4.0 one
regenerated under the new version.

Added

  • pgokf-confluence, a Confluence Cloud ingestion companion. One run
    reads every current page visible to one token in one selected space,
    converts the complete space to OKF Markdown (pages/<page-id>.md, so
    renames keep concept identity; links between imported pages become
    relative links and graph edges), and - only with --apply - replaces a
    dedicated content bundle in one transaction through
    register_bundle_content_with_context. Without --apply it is a read-only
    preview that never connects to PostgreSQL and can export the converted
    bundle for review. Safety model: the token comes only from a file or
    CONFLUENCE_API_TOKEN, never an argument; the crawl inventories the space
    before and after reading bodies and refuses an empty, changing, partial or
    over-limit snapshot; conversion is bounded per page (input bytes, depth,
    nodes, table cells, rendered size); a durable, locked checkpoint binds runs
    to one source, bundle, tenant and database endpoint, refuses foreign or
    externally modified bundles, and turns page removals into an explicit,
    reviewed --allow-deletions; the per-bundle advisory lock spans the crawl
    and the transaction. The snapshot being committed is recorded in a
    .pending checkpoint just before COMMIT and promoted after it, so a run
    that dies in between is settled against the catalog by the next one even
    when pages changed meanwhile. Untrusted storage cannot produce live
    Markdown: code text stays inside its code span, headings and link labels
    stay on one line, and frontmatter escapes the characters YAML forbids. A
    whole-snapshot byte budget (--max-snapshot-bytes) keeps one import within
    a single PostgreSQL message, and a scoped token's cloud ID is verified
    against the site's public tenant record; the source identity is the site
    and space alone. Each import records producer provenance
    (producer pgokf-confluence, the space as origin, a manifest hash, and
    a source generation over page versions) in the change-event outbox and a
    new bundle's freshness row. It follows the shared companion conventions
    (OKF_PG_URL, OKF_BUNDLE_NAME, OKF_TENANT, OKF_PG_TLS; empty means
    unset). Shared-audience only: Confluence page restrictions are not
    reproduced. The companions image now ships the binary, the companions smoke
    test runs it, CI runs its catalog workflow against PostgreSQL 18, and
    docs/confluence-integration.md plus
    deploy/confluence/ cover individual setup and a scheduled Azure Container
    Apps Job.

Security

  • --tls (OKF_PG_TLS) can no longer fall back to plaintext. Every
    companion (pgokf-ingest, pgokf-embed, pgokf-mcp, and pgokf-web's
    connection pool) chose a TLS connector under --tls but kept the connection
    string's sslmode. Under prefer - the default when no sslmode is given -
    a server that declined TLS received a plaintext startup message and
    authentication exchange; under disable TLS was never requested. The new
    pgokf_pgconn::connection_config raises a weaker sslmode to require
    whenever TLS is forced, and every connection and pool is built from it, so a
    declining server is refused before any startup data is sent. Connections
    without --tls are unchanged.
  • rustix 1.1.6 for RUSTSEC-2026-0486 (extended-attribute buffers marked
    initialized when empty). Only the release verifier and test tooling link
    rustix; no shipped extension or companion binary does. The lockfile
    changes that one entry, so cargo deny check passes again.

pgokf 0.4.0

Choose a tag to compare

@LogicOcean LogicOcean released this 11 Nov 03:47

pgokf 0.4.0

pgokf 0.4.0 is the first stable release of the 0.4 line. It brings the MCP server up to the 2026-07-28 protocol revision with structured results, Resources and Skills. It also completes the catalog reconciliation upgrade chain from 0.3.1, clears the open RustSec advisories, and hardens packaging and release verification. Stable artifacts cover PostgreSQL 15–18 on amd64 and arm64. PostgreSQL 19 RC 1 is tested for compatibility only.

Coming from 0.2.0? 0.2.0 is the last release published as packages. 0.3.0 was an unpublished candidate, and 0.3.1 was finalized in source but never published as a release. This release therefore also carries the 0.3 feature set (catalog generations, freshness, a durable change-event outbox, generation-bound typed relationships, and freshness-aware workspace plugins). See the 0.3.1 changelog entry. ALTER EXTENSION pgokf UPDATE takes you from 0.2.0 straight to 0.4.0.

Highlights

  • MCP 0.4. The server implements MCP 2026-07-28 and still accepts the legacy 2024-11-05, 2025-03-26 and 2025-06-18 initialization revisions. It adds a Tools registry with strict input/output schemas and validated structuredContent, stable URI-addressed Resources, and the optional io.modelcontextprotocol/skills extension.
  • Catalog reconciliation upgrade chain. The ordinary update path is 0.3.1 → 0.4.0-dev1 → 0.4.0-dev2 → 0.4.0-dev3 → 0.4.0. It repairs search-function and web-identity drift on catalogs that followed an early 0.3.0-dev build, and leaves factory catalogs unchanged.
  • Security. The current RustSec advisory set is cleared, including the critical zip advisory GHSA-m665-v7pm-7grj and four rustls advisories.
  • Packaging. Debian packages and multi-architecture server and companion images for PostgreSQL 15–18 on amd64 and arm64. Debian metadata rendering is hardened, and every package ships a deterministic third-party notices file.
  • PostgreSQL 19 RC 1. Compatibility testing moves from Beta 3 to RC 1. This is non-production, and no PG19 image or .deb is published.
  • Release verification. Release gates now run in the Rust pgokf-verifier with contained process supervision. Publication happens only through an explicit dispatch.

Upgrading

ALTER EXTENSION pgokf UPDATE;   -- from 0.3.1, 0.3.0, 0.2.0 or any earlier 0.1.x / dev point version
SELECT extversion FROM pg_extension WHERE extname = 'pgokf';   -- 0.4.0

Every earlier version, including all 0.1.x releases and the 0.3.0-dev and 0.4.0-dev point versions, has an ordinary update path to 0.4.0. Take a backup first (pg_dump, or pgokf-backup in the images). The steps are:

Step What it does
0.3.1 → 0.4.0-dev1 Additive. Adds and backfills the exact SKILL.md SHA-256 and byte-size columns, then registers dump relations.
0.4.0-dev1 → 0.4.0-dev2 Reconciles search-function drift on catalogs that followed an early unpublished 0.3.0-dev build. It drops the superseded 0.2.0 concept_search_semantic / concept_search_hybrid overloads, whose overlapping defaults made defaulted calls ambiguous. It also replaces the 11-argument bm25_hits helper with the 12-argument one and restores fresh-install ACLs, comments and initial privileges. Each retired object is dropped only in its exact published shape, RESTRICT. Any other shape or custom grant aborts the update with a named diagnostic and changes nothing.
0.4.0-dev2 → 0.4.0-dev3 Restores the seven superseded pgokf_web comments (the schema, pgokf_web.users and five of its columns) verbatim from the fresh-install source, and nothing else.
0.4.0-dev3 → 0.4.0 Receipt-only finalization. Changes no objects or data beyond the standing dump-relation registration.

Declared catalog exception. A catalog that followed an early 0.3.0-dev build keeps display_name/provider at the end of pgokf_web.users, and provider at the end of pgokf_web.sessions. The physical column order is not rebuilt. Shipped code reads and writes both tables by named columns only, and the upgrade gate replays the product's statements against both orders. See "Declared catalog exceptions" in docs/api-stability.md.

MCP server (pgokf-mcp)

  • Implements MCP 2026-07-28. Legacy stdio clients still initialize before calling tools, and legacy HTTP remains sessionless. Successful legacy text payloads keep their shape, with structured content added beside them.
  • Tools: all 14 legacy tool names plus traverse_concepts, with strict schemas and structured results. Unknown arguments and wrong-typed optional filters now fail closed. Writer tools are hidden when no usable writer connection is configured. Execution errors carry stable domain codes and safe messages, without SQL error chains.
  • Resources: resources/list, resources/templates/list and resources/read over canonical okf://catalog/... URIs, with exact stored-byte reads.
  • Skills: the optional io.modelcontextprotocol/skills extension (skills/list, skills/get, and per-file bytes via resources/read) publishes the canonical pgokf.skills packages. It is modern-only; legacy clients keep get_skill. Skill manifests are served as bare text/markdown, and the exact SKILL.md SHA-256 and byte size now persist through upgrades.
  • Transports: newline-delimited stdio, and authenticated POST JSON over HTTP.
  • Not implemented: subscriptions, list-change notifications, SSE, Tasks, prompts, completions, sampling, elicitation and OAuth discovery. Details are in docs/mcp-0.4-development.md and spec/pgokf-0.4.0-mcp.md.

Web UI sign-in

The pgokf-web sign-in modes (OKF_WEB_AUTH = none, header for a trusted proxy, users for built-in accounts, and oidc for OpenID Connect with PKCE) are unchanged in 0.4.0, and existing configurations keep working. The only 0.4.0 change touching their tables is the 0.4.0-dev3 comment restoration and the declared column-order exception described under Upgrading.

Packaging and distribution

Artifact status: the images below are published to ghcr.io/logicocean (amd64 + arm64) and the eight .deb files are attached to this release, produced by the v0.4.0 tag CI run and the publish dispatch. PostgreSQL 19 RC 1 remains compatibility-testing only.

  • Debian packages: postgresql-<N>-pgokf_0.4.0-1_<arch>.deb for N = 15, 16, 17, 18 and arch = amd64, arm64. Each depends on postgresql-<N> and installs the extension library, control file, install script and full upgrade chain. The license and THIRD-PARTY-NOTICES.txt go under /usr/share/doc/postgresql-<N>-pgokf/.
  • Build hardening: packaging/deb/build-deb.sh now validates the MAINTAINER and DEB_REVISION overrides before any build step. They are rendered as pure data through a fixed-format token renderer, which closes a sed-program injection. A maintained 12-assertion suite (packaging/deb/test-build-deb.sh) must pass before CI runs the production .deb build.
  • Server images: ghcr.io/logicocean/pgokf:0.4.0-pg15 … 0.4.0-pg18 (linux/amd64 + linux/arm64). Each is a drop-in postgres image with pgokf, pgvector and pg_cron, plus the pinned, checksum-verified pg_textsearch 1.4.0 BM25 provider on PostgreSQL 17 and 18.
  • Companions image: ghcr.io/logicocean/pgokf-companions:0.4.0 (pgokf-ingest, pgokf-embed, pgokf-mcp, pgokf-web).
  • Third-party notices: THIRD-PARTY-NOTICES.txt is generated deterministically by a checksum-pinned cargo-about 0.9.2 plus an authenticated inventory of the vendored JavaScript. CI fails on any drift.
  • PostgreSQL 19: RC 1 (postgres:19rc1, pinned by index digest, and PGDG 19~rc1) is a required compatibility leg in CI. It is non-production, and no PG19 image or .deb is published. GA support will need its own reviewed change.
  • Homebrew: the formula stays on 0.2.0 inside this tag by design, because a formula cannot contain the digest of its own archive. The LogicOcean/homebrew-pgokf tap moves to 0.4.0 in a separate step after the tag.

Security

  • RustSec/GHSA updates: zip 9.4.1 (GHSA-m665-v7pm-7grj, critical) and rustls 0.23.46 (GHSA-vp88-798v-h67f, GHSA-c8m5-c952-6cm4, GHSA-w44r-93j7-qv28, GHSA-h2v8-394m-p7vv). Patch-line updates also cover Arrow/Parquet, QUIC, the sanitizer, TLS, async, Markdown, WebPKI and Zstandard.
  • The deprecated serde_yaml/unsafe-libyaml stack is replaced with the maintained yaml_serde/libyaml-rs. Askama's unused external-config feature is disabled, so the unmaintained basic-toml parser is no longer linked.
  • MCP cursor and resource digests use the workspace's HMAC 0.13 and SHA-2 0.11 generations, and the fixed wire and digest vectors are preserved.

Release engineering

  • Images can only be published from an explicit workflow_dispatch of the packages workflow naming the current tag. The resolver proves the checked-out source is that tag's commit before any registry write. Branch and tag pushes only build and smoke-test.
  • Documentation-site (GitHub Pages) deployment is manual-only, through a default-false dispatch input.
  • Release, packaging and compatibility gates run in the Rust pgokf-verifier. This includes source-guard, workflow execution-context digests, deterministic notices, Debian and image smoke tests, and reconciliation mutation campaigns. Child processes are contained with Linux pidfd and macOS launchd supervision, and CI shells are bound to the system Bash without startup hooks.

Full changelog: CHANGELOG.md · Source diff since the last tag: [v0.3.0...v0.4.0](https://github.com/LogicOcean/...

Read more

pgokf 0.2.0

Choose a tag to compare

@LogicOcean LogicOcean released this 09 Sep 20:40

Skill packages are catalog content, and a web UI to work with them.

A bundle may now carry Agent Skills packages whose exact bytes the catalog stores and serves back. pgokf-web puts a UI and a JSON API over the whole catalog, with an optional human workflow — upload, edit, review — once an identity mode and a writer connection are configured. pgokf-workspace turns a catalog selection into an agent-harness tree for twelve named harnesses. And pgokf-mcp speaks HTTP as well as stdio, with bearer tokens and four roles.

ALTER EXTENSION pgokf UPDATE TO '0.2.0' is additive: it creates the new tables empty. A bundle that already carried a SKILL.md projects into pgokf.skills / pgokf.scripts / pgokf.reference_documents on its next refresh_bundle.

Highlights

  • Skill packages, byte for byte. The sync classifies every file of a package, projects the manifest as a virtual type: Skill concept, and keeps exact bytes regardless of store_source. Three audited, reader-level, tenant-scoped readers return them, and the plugin builder copies packages through those readers whole — scripts still executable.
  • A web UI over the whole catalog. Search with facets, a 3D link graph, bundle and concept browsing, an operations page, and a five-step plugin builder. Roles are a ladder — viewer, uploader, editor, approver, admin — with identity from a password kept in the catalog, an authenticating proxy, or any number of OpenID Connect providers and GitHub, all set up from the Admin page rather than a config file.
  • The human workflow, and the rule behind it. A verification is granted by an approver reviewing a document; it is never something a contributor types into one. A verified list in an upload or an edit is set aside under superseded_verifications, with who set it aside and why, so the derived trust tier cannot be claimed.
  • MCP for agents, over stdio or HTTP, with four token roles: reader, builder, writer, admin. A writer token may add or replace documents in a content bundle and an admin token may manage bundles — and what an agent writes arrives unverified whatever it claims, for a person to review. The two writing roles need the server to hold a writer connection of its own (OKF_PG_WRITER_URL); without one their tools are listed and say so.
  • The web UI's identity state lives in the catalog, in four extension-owned pgokf_web tables granted to pgokf_writer only: people, sessions, MCP token digests, and identity providers. Transactional, shared by every instance, and carried by pg_dump.
  • Sessions can be ended, not merely left to expire. Every issued session is a row; a cookie the catalog does not list is refused. Signing out ends it everywhere, and an admin can end anyone's.

Security

This release includes fixes for issues found in review before it shipped, several in code that predated it: a cross-tenant content write, a content rewrite that silently dropped a bundle's index.md and log.md, concurrent writers overwriting each other, an unbounded sign-in throttle, a symlink-following temp write, and an OIDC login that accepted an unverified email claim. See the changelog for the full list.

Install

docker pull ghcr.io/logicocean/pgokf:0.2.0-pg18
docker pull ghcr.io/logicocean/pgokf-companions:0.2.0

Images are multi-architecture (linux/amd64, linux/arm64) for PostgreSQL 15–18. The extension builds from source on 15–19.

The full changelog is in CHANGELOG.md.

pgokf 0.1.16

Choose a tag to compare

@LogicOcean LogicOcean released this 05 Sep 22:30

Deny-by-default tenancy, on demand. The new durable policy key
require_tenant (default false) makes a session that has not set
pgokf.tenant see nothing and refuse to ingest, instead of the see-all
behavior every earlier release had. Nothing changes until an administrator
turns it on; ALTER EXTENSION pgokf UPDATE TO '0.1.16' adds one column and
rewrites the thirteen tenant-isolation policies in place.

Added

  • require_tenant policy key and the reader-level
    pgokf.tenant_required() function every row-level-security policy consults
    (as an uncorrelated sub-select: one evaluation per statement, never a
    per-row call). With the policy on, an unscoped session sees no rows through
    the policies and every reader built on them, the SECURITY DEFINER readers
    apply the same rule (health() counts, list_sync_log, list_sync_changes,
    list_access_log, and the ParadeDB bm25_hits path come back empty;
    get_concept_source raises the same not-found 22023 a foreign tenant
    gets), and the ingestion tier, the bundle-addressed writers and exports, and
    purge_retired refuse it with SQLSTATE 42501. set_config / reset_config never need a
    tenant, so the policy can always be turned off again. health() gains
    tenant_required. The function is executable by any role with USAGE on
    schema pgokf, because the policies depend on it.
  • Companions: pgokf-ingest accepts --tenant / OKF_TENANT like
    pgokf-embed and pgokf-mcp; all three apply it through one shared
    pgokf-pgconn helper. The compose stack passes OKF_EMBED_TENANT and
    OKF_INGEST_TENANT through (next to the existing OKF_MCP_TENANT).

Changed

  • schedule_refresh pins the bundle's tenant into the pg_cron job command
    (set_config('pgokf.tenant', ...) before refresh_bundle), so the cron
    worker's own, tenant-less session satisfies the tenant rules. Jobs
    scheduled by earlier releases run the bare call; re-schedule them
    (schedule_refresh updates a job in place) before turning require_tenant
    on, or pin the job role's tenant with ALTER ROLE ... SET pgokf.tenant.
  • The write-side tenant rule (enforce_bundle_tenant) now also refuses an
    unscoped session when a tenant is required, with a distinct 42501 message
    naming the fix, rather than the unknown-bundle 22023 used for cross-tenant
    ids.

Images: ghcr.io/logicocean/pgokf:0.1.16-pg{15,16,17,18} and ghcr.io/logicocean/pgokf-companions:0.1.16 (linux/amd64 + linux/arm64). Homebrew: brew tap logicocean/pgokf && brew install pgokf.

pgokf 0.1.15

Choose a tag to compare

@LogicOcean LogicOcean released this 05 Sep 17:15

A PostgreSQL-licensed BM25 backend. The bm25 search backend now runs on
a selectable provider, and Tiger Data's pg_textsearch (PostgreSQL license,
PostgreSQL 17 and 18) joins ParadeDB's pg_search. The Docker image bundles
pg_textsearch on the 17 and 18 images and no longer bundles pg_search by
default. ALTER EXTENSION pgokf UPDATE TO '0.1.15' adds one policy column
with its default and touches no existing row.

Added

  • bm25_provider policy key (auto | pg_textsearch | pg_search,
    default auto, which prefers pg_textsearch when installed). Both
    providers name their index access method bm25 and cannot coexist in one
    database, so resolution is unambiguous. rebuild_search_index() builds the
    resolved provider's index; search_index_status() reports bm25.provider
    and bm25.provider_setting; health().bm25_ready accepts either provider.
  • pg_textsearch backend. One expression index over title, description,
    and body with the catalog's text-search configuration (baked into the
    index; rebuild after changing it). A page is served by the provider's
    index-ordered top-k scan (ORDER BY <expr> <@> to_bm25query(...) LIMIT n)
    with the structured filters, the keyset predicate, and row-level security
    applied as ordinary quals on that scan - inline with invoker rights, no
    privileged helper - then ordered rank DESC, bundle_id, concept_id in SQL.
    Rows tying the page's last rank are read past the page so keyset pages
    tile exactly, up to 256 tied rows per boundary (beyond that a WARNING
    and approximate paging). Query text is plain terms, as it already was on
    pg_search (neither provider interprets web-search operators). Covered by
    new in-database tests (the query shape is asserted to plan as a bm25
    index scan) that run wherever pg_textsearch is preloaded, including CI's
    PostgreSQL 17 and 18 legs.
  • Image: WITH_PG_TEXTSEARCH (default auto: installed on 17 and 18 from
    the pinned, checksum-verified release package via the shared
    fetch-pg-textsearch.sh, with its PostgreSQL-license notice under
    /usr/share/doc; skipped elsewhere). CI builds the 17/18 images with
    WITH_PG_TEXTSEARCH=1 and the smoke test requires a provider there, so a
    stale checksum table fails the build rather than publishing a provider-less
    image. WITH_PG_SEARCH now defaults to 0; the ParadeDB build path remains
    available. pgokf-restore skips a pg_textsearch extension entry the
    target cannot replay, as it already did for pg_search. The compose stack
    preloads pg_textsearch.

Changed

  • search_index_status().bm25.available and health().bm25_ready now
    follow the provider bm25_provider resolves to (they were "pg_search
    installed"), so a pinned provider that is missing shows as unavailable
    even when the other one is present, and the fallback warning names what
    is installed instead.
  • concept_search, find_similar, and concept_search_hybrid are now
    PARALLEL RESTRICTED (executed in the leader of a parallel plan, never in
    a worker): the BM25 providers declare their scoring parallel-unsafe, and
    these functions run it through SPI. Results and signatures are unchanged;
    the upgrade script relabels the installed functions.
  • Documentation for search backends, configuration, packaging, and the
    compose deployment covers provider selection and the licensing difference.
  • Compose stack: shared_preload_libraries now names pg_textsearch
    instead of pg_search (overridable through the new PGOKF_PRELOAD
    variable, e.g. pgokf,pg_cron for a 15/16/19 image), and the ParadeDB-only
    paradedb.planner_warnings setting is gone. An older compose file that still preloads pg_search
    will not start the 0.1.15 image (the library is no longer in it): update
    the preload line, or build the image with WITH_PG_SEARCH=1 WITH_PG_TEXTSEARCH=0 to keep ParadeDB. A database that has pg_search
    created must drop it (on the old image, DROP EXTENSION pg_search CASCADE)
    before pg_textsearch can be created; the step-by-step migration is in
    docs/compose-deployment.md.
  • Test harness: the in-database tests that need a preloaded BM25 provider
    now run when PGOKF_TEST_PRELOAD names it (pgrx starts its own instance,
    so the operator's cluster configuration never reached them, and they had
    been skipping silently), and fail instead of skipping when the requested
    provider is unusable.

Images: ghcr.io/logicocean/pgokf:0.1.15-pg{15,16,17,18} and ghcr.io/logicocean/pgokf-companions:0.1.15 (linux/amd64 + linux/arm64). Homebrew: brew tap logicocean/pgokf && brew install pgokf.

pgokf v0.1.14

Choose a tag to compare

@LogicOcean LogicOcean released this 05 Sep 12:55

[0.1.14] - 2026-09-04

Complete logical backups, production container packaging, and native
arm64.
The one in-database change makes pg_dump actually capture the
catalog; everything else is packaging, deployment, companion, and CI work.
ALTER EXTENSION pgokf UPDATE TO '0.1.14' adds a trigger and the backup
registrations and touches no existing row; a catalog upgraded with it is
identical to a fresh 0.1.14 install.

Fixed

  • BM25 search works for non-superuser readers. With search_backend = bm25, any session that is not the table owner - every production reader -
    got Unsupported query shape from pg_search: row-level security wraps
    pgokf.concepts in a security-barrier subquery its custom scan cannot plan.
    The hit query now runs through pgokf.bm25_hits, a SECURITY DEFINER
    helper (pinned search_path, execute granted to pgokf_reader only) that
    applies the same explicit pgokf.tenant predicate the policies enforce, so
    concept_search and the hybrid search keep their invoker-rights contract
    and the result set is unchanged. Covered by a new in-database test that runs
    wherever pg_search is preloaded.
  • pg_dump now captures the catalog. PostgreSQL skips the contents of
    extension-owned tables unless the extension registers them with
    pg_extension_config_dump; pgokf never did, so every archive carried only
    the CREATE EXTENSION statement and a restore came back empty - despite the
    operations guide describing dumps as complete. Every pgokf.* and
    pgokf_private.* table and sequence is now registered (discovered from the
    extension's dependency graph, so future tables are covered automatically),
    and a BEFORE INSERT trigger on the singleton pgokf_private.config row
    folds the restored policy row into the one CREATE EXTENSION seeds instead
    of failing on a duplicate key. Registered relations and the trigger are
    asserted by new in-database tests, and the image smoke test restores a real
    archive.

Added

  • Server image with the optional extensions built in. The Docker image
    now ships pgvector, pg_cron, and ParadeDB pg_search (each a WITH_* build
    argument; pg_search is fetched from its pinned upstream release and verified
    against a committed SHA256 table), a HEALTHCHECK, an OCI version label,
    and first-init hooks that create the extensions when preloaded, create
    least-privilege login roles from PGOKF_{ADMIN,WRITER,READER}_PASSWORD, and
    apply a JSON PGOKF_POLICY through pgokf.set_config. It also carries
    pgokf-backup (a verified pg_dump + roles-dump tool with retention) and
    pgokf-restore (a single-transaction restore that skips the archive entries
    an initialized target cannot replay: pg_search's unowned paradedb schema
    and, for a differently named database, pg_cron's objects).
  • Companions image (Dockerfile.companions): pgokf-ingest,
    pgokf-embed, and pgokf-mcp in one non-root image.
  • Multi-architecture images. CI builds and smoke-tests both images
    natively on amd64 and arm64 runners and merges them into one manifest per
    tag (ghcr.io/logicocean/pgokf:<version>-pg<major>,
    ghcr.io/logicocean/pgokf-companions:<version>), so they run on x86 and
    arm64 servers and on Apple Silicon. The .deb matrix gained arm64 legs.
  • Reference compose deployment (deploy/compose/, documented in
    docs/compose-deployment.md): server, embedding daemon, cron-driven
    backups, and optional ingestion and MCP services, all configured from one
    .env.
  • pgokf-embed --watch / --interval: the embedder runs as a daemon that
    embeds newly registered or refreshed concepts every interval, reconnecting
    per pass and surviving transient outages. The loop and its SIGINT/SIGTERM
    shutdown live in the new pgokf-companion crate, shared with pgokf-ingest
    (which therefore now also stops cleanly on SIGTERM, i.e. docker stop).
  • Packaging lint in CI (hadolint, shellcheck, docker build --check, compose
    render), a .dockerignore, and reusable smoke scripts
    (packaging/docker/smoke-test.sh, smoke-test-companions.sh).

Changed

  • The image's first-init SQL creates vector whenever present and pg_search
    / pg_cron when preloaded, instead of only pgokf.
  • Documentation: new compose deployment guide; packaging, operations, search,
    and deployment-topology guides updated for the bundled extensions, the
    backup tool, the embedder daemon, and multi-arch publishing.

pgokf v0.1.13

Choose a tag to compare

@LogicOcean LogicOcean released this 29 Aug 17:52

[0.1.13] - 2026-08-29

Relicensed to AGPL-3.0 plus commercial, and the first public release. This
release also fixes a set of audited defects in the shipped catalog and
companions. The in-database SQL surface is
unchanged from 0.1.12
- no table, type, function signature, index, grant,
comment, role, or configuration key is added, dropped, renamed, or rewritten, so
ALTER EXTENSION pgokf UPDATE TO '0.1.13' is a documented no-op that yields a
catalog identical to a fresh 0.1.13, with every bundle, concept, embedding, link,
history version, and provenance record intact. Every fix is internal code, a new
input validation, companion behavior, or documentation; loading the 0.1.13
shared library is what activates the corrected code paths. api_stability and
the no-data-loss upgrade guarantees are preserved.

Changed

  • Relicensed to dual AGPL-3.0 + commercial (previously MIT). Every crate in
    the workspace - the extension, the okf-parser / okf-sync libraries, and
    the companion tools (pgokf-ingest, pgokf-embed, pgokf-mcp,
    pgokf-pgconn) - is now AGPL-3.0-only, and a commercial license is
    available for use the AGPL does not permit. See LICENSING.md
    and COMM-LICENSE.md.

Security

  • Denial-of-service in concept_neighbors closed (HIGH). The recursive
    traversal previously enumerated every simple path from the seed
    (≈O(N^hops)), so a reader calling concept_neighbors(seed, 5) on a dense
    bundle could spin the backend on millions of walk rows for a tiny answer. The
    traversal is rewritten as a set-based, cycle-safe breadth-first search that
    records the first (minimum-hop) visit of each neighbor and never re-expands a
    visited node - O(V + E) work - returning identical results (distinct
    neighbors, shortest hop distance, cycle-safe, active-bundle-scoped) for normal
    graphs. A dense K30 bundle that formerly timed out now answers in
    milliseconds.
  • Embedding poisoning rejected at write (HIGH). set_concept_embedding now
    validates that every element of the supplied vector is finite, raising SQLSTATE
    22023 (naming the offending index) for a NaN/Infinity element before the
    upsert. Storage is real[], so such a value inserted silently but was rejected
    by pgvector at every query/index cast - one bad write could break semantic and
    hybrid search and rebuild_embedding_index catalog-wide until the row was found
    and fixed.
  • purge_retired data-loss race closed (HIGH). purge_retired snapshotted
    the eligible bundles and then hard-deleted each without re-checking, so a
    concurrent unretire_bundle that committed in between could have its restored
    bundle (and its concept history) silently deleted. The per-bundle delete now
    re-evaluates the eligibility predicate (retired_at IS NOT NULL AND retired_at < now() - older_than) atomically under the bundle advisory lock, skipping - never
    deleting - a bundle that is no longer eligible.
  • Multi-tenancy trust model documented honestly. docs/security.md and
    docs/multi-tenancy.md now state plainly that the pgokf.tenant GUC is a
    scoping selector, not a hard security boundary against a tenant who can run
    arbitrary SQL (any session can SET/RESET it, and a pinned ALTER ROLE
    default is overridable in-session), that the unset default fails open to
    see-all, and that a hard boundary requires a constrained access layer that
    pins the GUC or a per-tenant-role model.

Fixed

  • log.md midnight-timestamp corruption (MED). A space-separated
    YYYY-MM-DD HH:MM[:SS] leading timestamp in a reserved log.md entry parsed to
    midnight (only the first whitespace token was read). It now parses to the
    real instant, while an untimestamped line still yields a NULL logged_at and
    the entry text stays lossless.
  • concept_neighbors NULL-bundle disambiguation counted inactive bundles
    (LOW).
    With no bundle_id, disambiguation now counts only active bundles
    (enabled AND retired_at IS NULL), so a disabled/retired duplicate of a concept
    id no longer raises a spurious 22023 that blocked the only active bundle.
  • Self-linked seed excluded from its own neighbor set (LOW). A concept that
    links to itself is no longer returned as its own neighbor.
  • Deterministic tiebreak for semantic/hybrid search (LOW).
    concept_search_semantic and concept_search_hybrid now break equal
    distance/fused-score ties on (bundle_id, concept_id) for a stable order.

Companions

  • Optional TLS to PostgreSQL for all three companions (MED). pgokf-ingest,
    pgokf-embed, and pgokf-mcp now share a small pgokf-pgconn helper crate and
    accept a --tls flag (env OKF_PG_TLS); TLS is also enabled by
    sslmode=require in the connection string. When enabled, the link uses rustls
    (reusing the stack already pulled by object_store/reqwest, so cargo deny
    stays green) and verifies the server certificate against the platform trust
    store. NoTls remains the default for a local socket / trusted network.
  • pgokf-ingest unit tests. Added AAA unit tests for the companion's
    path-derivation (prefix strip) and change-detection (content-hash) helpers.

Internal

  • New crates/pgokf-pgconn workspace crate centralizes the companions'
    PostgreSQL connect step. Version bumped to 0.1.13 across the workspace,
    pgokf.control, and META.json; a documented no-op
    pgokf--0.1.12--0.1.13.sql upgrade script ships. Regression tests (Rust unit
    tests and in-database #[pg_test]s) cover every fix above.