Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
- uses: actions/setup-go@v7
with:
go-version: "1.26.11"
cache-dependency-path: |
go.sum
test/smoke/go.sum

- name: Check formatting
run: make fmt-check
Expand All @@ -37,6 +40,9 @@ jobs:
- name: Check coverage
run: make cover-check

- name: Run smoke contract (distribution plan COMP-kafgraph-01..14)
run: make test-smoke

- name: Check license headers
run: bash hack/license-header.sh

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ test-unit: ## Run unit tests only (exclude e2e and integration)
test-e2e: ## Run E2E tests (in-process, uses temp BadgerDB)
CGO_ENABLED=1 $(GO) test $(GOFLAGS) -tags=e2e -v ./test/e2e/...

.PHONY: test-smoke
test-smoke: ## Run the distribution smoke plan (test/smoke, COMP-kafgraph-01..14)
cd test/smoke && $(GO) vet ./... && $(GO) test -count=1 -v ./...

.PHONY: test-integration
test-integration: ## Run integration tests (requires docker-compose)
CGO_ENABLED=1 $(GO) test $(GOFLAGS) -tags=integration -v -timeout 300s ./test/integration/...
Expand Down
16 changes: 11 additions & 5 deletions SPEC/ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@ The phase history up to Phase 8 is in [PLAN.md](PLAN.md).
## Release v1.1.0: ready for the distribution

Goal: KafGraph passes the distribution's component smoke plan for KafGraph
(`tests/smoke/components/kafgraph/PLAN.md` in the distribution repository,
cases COMP-kafgraph-01 to -14) and meets the distribution's release-gate
(cases COMP-kafgraph-01 to -14) and meets the distribution's release-gate
contract: one CI workflow on `main` that covers every artefact (Go, Helm
chart, compose files, multi-arch image).

The smoke plan is `sao/tests/smoke/components/kafgraph/PLAN.md` at tag
`pre-consolidation-2026-11-30` of the distribution repository. On 2026-11-30
the distribution removed `sao/` and `components/kafgraph` from `main` (v1.0.1
keep list). The plan is copied unchanged to
[test/smoke/PLAN.md](../test/smoke/PLAN.md); `make test-smoke` runs it.

| ID | Item | Status | Depends on | Done when |
|----|------|--------|------------|-----------|
| KG-00 | Roadmap and factory config (`SPEC/ROADMAP.md`, `.swfactory.yaml`) | done (#46) | – | merged to `main` |
Expand All @@ -29,14 +34,15 @@ chart, compose files, multi-arch image).
| KG-04 | `docker.yml` publishes only after green CI for the tagged commit, as a multi-arch image | open | KG-03 | a tag on a red commit publishes nothing; a published tag is a manifest list with amd64 and arm64 |
| KG-05 | Branch protection on `main`: pull request and green CI required (repository admin) | open | KG-03 | protection active |
| KG-06 | `GET /health` and `GET /ready`; readiness reports ingest status and lag (COMP-kafgraph-01, -02) | open | KG-01 | cases 01 and 02 pass |
| KG-07 | `CALL dbms.components()` returns the component KafGraph with its semver (COMP-kafgraph-04) | open | KG-01 | case 04 passes |
| KG-07 | `CALL dbms.components()` returns the component KafGraph with its semver (COMP-kafgraph-04) | open | KG-01, KG-15 | case 04 passes |
| KG-08 | Graph metrics on `/metrics`, including `kafgraph_nodes_total` (COMP-kafgraph-13) | open | KG-01 | case 13 passes |
| KG-09 | Erasure endpoint `DELETE /api/v1/entities/{id}`: 204, a follow-up query returns 0 rows (COMP-kafgraph-12) | open | KG-01 | case 12 passes |
| KG-09 | Erasure endpoint `DELETE /api/v1/entities/{id}`: 204, a follow-up query returns 0 rows (COMP-kafgraph-12) | open | KG-01, KG-15 | case 12 passes |
| KG-10 | Reflection API v1: `GET /api/v1/reflections`, `POST /api/v1/reflections/run` (202 with `job_id`), `GET /api/v1/reflections/jobs/{id}` (COMP-kafgraph-08 to -10) | open | KG-01 | cases 08 to 10 pass |
| KG-11 | Ingest of topic `ops.agent.decisions` into `Decision` nodes with `trace_id` (COMP-kafgraph-07) | open | KG-01 | case 07 passes |
| KG-12 | TLS for HTTP and Bolt, configurable, off by default; Helm values for it | open | KG-03 | E2E test over TLS passes; `helm lint` green with TLS values |
| KG-13 | `CHANGELOG.md`, docs in sync, tag `v1.1.0` and GitHub Release. A human sets the tag: it publishes to ghcr.io | open | KG-01, KG-04, KG-05, KG-06, KG-07, KG-08, KG-09, KG-10, KG-11, KG-12 | release exists; all 14 smoke cases pass without skips |
| KG-13 | `CHANGELOG.md`, docs in sync, tag `v1.1.0` and GitHub Release. A human sets the tag: it publishes to ghcr.io | open | KG-01, KG-04, KG-05, KG-06, KG-07, KG-08, KG-09, KG-10, KG-11, KG-12, KG-15 | release exists; all 14 smoke cases pass without skips |
| KG-14 | Handover to the distribution (work happens in the distribution repo): subtree-sync to `v1.1.0`, PROVENANCE, DEVIATIONS, CI workflow name in `components.yaml`, distribution smoke test implements the plan, consumers checked | open | KG-13 | distribution release candidate with KafGraph `v1.1.0`, smoke passed |
| KG-15 | Bolt works with the official Neo4j driver (`neo4j-go-driver/v5`): the handshake accepts a version range that contains 4.4, the PULL summary carries `stats` counters, nodes are returned as Bolt node structures (COMP-kafgraph-03, -05, -06, -11) | open | KG-01 | cases 03, 05, 06 and 11 pass |

## Later

Expand Down
43 changes: 43 additions & 0 deletions test/smoke/PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Component Smoke Test Plan — KafGraph

**Image:** `ghcr.io/scalytics/kafgraph:latest`
**Swagger / OpenAPI:** `http://localhost:7474/openapi.json` (REST facade). Native Bolt v4 on `:7687` — tested via `github.com/neo4j/neo4j-go-driver/v5`. Browser UI at `http://localhost:7474/`.

## Foundational tests (run against bp-001 Ops Foundation)

| ID | Test | Method | Endpoint / Action | Assertion |
|----|------|--------|-------------------|-----------|
| COMP-kafgraph-01 | HTTP liveness | GET | `http://localhost:7474/health` | 200, `{"status":"ok"}` |
| COMP-kafgraph-02 | HTTP readiness | GET | `http://localhost:7474/ready` | 200, reports Kafka consumer lag |
| COMP-kafgraph-03 | Bolt handshake | Bolt | driver connect `bolt://localhost:7687` | session established within 5s |
| COMP-kafgraph-04 | version | Bolt | `CALL dbms.components()` | response contains `KafGraph` component, semver |
| COMP-kafgraph-05 | write decision node | Bolt | `CREATE (:Decision {trace_id:'smoke-<ts>', immutable:true})` | 1 node created |
| COMP-kafgraph-06 | read decision node | Bolt | `MATCH (d:Decision {trace_id:'smoke-<ts>'}) RETURN d` | 1 row, `immutable=true` |
| COMP-kafgraph-07 | audit trail append | Kafka | produce to `ops.agent.decisions`, then query KafGraph after 10s | node with matching `trace_id` appears |
| COMP-kafgraph-08 | reflection endpoint | GET | `http://localhost:7474/api/v1/reflections` | 200, array with cycle types daily/weekly/monthly |
| COMP-kafgraph-09 | trigger reflection | POST | `http://localhost:7474/api/v1/reflections/run` body `{"cycle":"daily"}` | 202, returns `job_id` |
| COMP-kafgraph-10 | reflection result | GET | `http://localhost:7474/api/v1/reflections/jobs/<id>` | 200, terminal `status` within 60s |
| COMP-kafgraph-11 | schema lineage query | Bolt | `MATCH (s:Schema)-[:EVOLVED_FROM]->(p:Schema) RETURN count(*)` | >= 0, query executes without error |
| COMP-kafgraph-12 | GDPR erasure | DELETE | `http://localhost:7474/api/v1/entities/<id>` | 204, follow-up query returns 0 rows |
| COMP-kafgraph-13 | prometheus metrics | GET | `http://localhost:7474/metrics` | 200, contains `kafgraph_nodes_total` |
| COMP-kafgraph-14 | browser UI | GET | `http://localhost:7474/` | 200, HTML contains knowledge-graph shell |

## Claims covered

| Claim | Source datasheet | Proven by test IDs |
|-------|-----------------|--------------------|
| "Knowledge graph + reflection + audit trail" | bp-001 | COMP-kafgraph-05, COMP-kafgraph-07, COMP-kafgraph-08 |
| "KafGraph ready for audit" | bp-001 | COMP-kafgraph-07 |
| "Full Audit Trail — Every transformation, every agent decision, every schema version" | bp-002 | COMP-kafgraph-07, COMP-kafgraph-11 |
| "Immutable audit trail, schema lineage, GDPR-ready erasure" | bp-002 | COMP-kafgraph-05, COMP-kafgraph-11, COMP-kafgraph-12 |
| "Knowledge graph, reflection engine, audit queries" | bp-003 | COMP-kafgraph-03, COMP-kafgraph-08, COMP-kafgraph-09 |
| "Daily/weekly/monthly reflection cycles" | bp-003 | COMP-kafgraph-08, COMP-kafgraph-09, COMP-kafgraph-10 |
| "Immutable audit trail. Replay any decision. Prove source provenance." | bp-003 | COMP-kafgraph-06, COMP-kafgraph-07 |

## Implementation notes

- Test framework: Go + testify + `neo4j-go-driver/v5` (Bolt) + `net/http` (REST)
- Requires: bp-001 deployed; KafGraph pointed at pre-provisioned `ops.agent.decisions`
- Immutability assertion relies on KafGraph server-side constraint rejecting UPDATE on `Decision.immutable=true`; test attempts update and expects server error
- Cleanup: `MATCH (n {trace_id:'smoke-<ts>'}) DETACH DELETE n` for nodes created with the smoke trace prefix
- Reflection run uses `cycle=daily` with a small sample window configured via Helm test-mode values
50 changes: 50 additions & 0 deletions test/smoke/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Smoke contract (distribution plan COMP-kafgraph-01 to -14)

This suite runs the component smoke plan of the distribution against a running
KafGraph: HTTP with `net/http`, Bolt with the official Neo4j Go driver
(`neo4j-go-driver/v5`), as the plan prescribes. Roadmap entry: KG-01 in
[SPEC/ROADMAP.md](../../SPEC/ROADMAP.md).

## Source of the plan

[PLAN.md](PLAN.md) is an unchanged copy of
`sao/tests/smoke/components/kafgraph/PLAN.md` at tag
`pre-consolidation-2026-11-30` (commit `1f6fe6e67`) of
`scalytics/LASCARIS-distribution`, git blob
`b624f914ae2ad1372e18f3079a912b958417e0ba`. Check it with
`git hash-object test/smoke/PLAN.md`. The distribution removed `sao/` from
`main` on 2026-11-30 (`a46cca945`). The plan changes only together with the
distribution.

## Run

```bash
make test-smoke
```

Without a target, the suite builds `./cmd/kafgraph` from this repository with
the version stamp of `make build` (`git describe --tags`) and starts it on free
local ports with a temporary data directory. If a run fails, the end of the
server log is printed.

| Variable | Meaning |
|---|---|
| `KAFGRAPH_SMOKE_HTTP_URL`, `KAFGRAPH_SMOKE_BOLT_URL` | test a running KafGraph instead, e.g. `http://localhost:7474` and `bolt://localhost:7687`; set both or neither |
| `KAFGRAPH_SMOKE_KAFKA_BROKERS` | brokers for case 07 |
| `KAFGRAPH_SMOKE_STRICT=1` | run every case, including pending ones (KG-13: all 14 pass without skips) |
| `KAFGRAPH_SMOKE_KEEP=1` | keep the data directory and log of the local instance |

## Pending cases

A case KafGraph does not pass yet is skipped with the roadmap entries that
make it pass (`pending` in [harness_test.go](harness_test.go)). Each entry
removes itself there once it is done; a case runs when its list is empty.
Cases that query over Bolt also wait on KG-15. `TestPendingCasesNameOpenRoadmapEntries`
fails if a pending case names an entry that is missing, done or deferred.

`pending` reflects this checkout, not the version of an external target. To
measure a deployed KafGraph against the whole plan, set
`KAFGRAPH_SMOKE_STRICT=1`. Case 07 also needs a Kafka broker.

The suite is its own Go module, so the Bolt driver is not a dependency of the
KafGraph binary.
12 changes: 12 additions & 0 deletions test/smoke/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module github.com/scalytics/kafgraph/test/smoke

go 1.26.0

toolchain go1.26.11

require (
github.com/neo4j/neo4j-go-driver/v5 v5.28.6
github.com/stretchr/testify v1.12.1
)

require go.yaml.in/yaml/v3 v3.0.5 // indirect
6 changes: 6 additions & 0 deletions test/smoke/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
github.com/neo4j/neo4j-go-driver/v5 v5.28.6 h1:U6lQTe6EBzyMy7tAjpMZj/5vNK9+MPhCtBlfmGGffXo=
github.com/neo4j/neo4j-go-driver/v5 v5.28.6/go.mod h1:Vff8OwT7QpLm7L2yYr85XNWe9Rbqlbeb9asNXJTHO4k=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
Loading