Skip to content

Competitive feature parity: embeddings, structured output, sequential responses, Docker - #42

Merged
jpr5 merged 7 commits into
mainfrom
feat/competitive-parity
Mar 20, 2026
Merged

jpr5 merged 7 commits into
mainfrom
feat/competitive-parity

Conversation

@jpr5

@jpr5 jpr5 commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds four high-value features that fill real gaps relative to VidaiMock, dwmkerr/mock-llm, and piyook/llm-mock:

  • Embeddings endpoint (POST /v1/embeddings) — deterministic embedding generation via SHA-256 hash, fixture matching on inputText, onEmbedding() convenience, automatic fallback to deterministic embeddings when no fixture matches
  • Structured output / JSON mode — responseFormat matching on response_format.type, onJsonOutput() convenience, validation that JSON-mode fixtures contain valid JSON
  • Sequential/stateful responses — sequenceIndex on fixtures enables multi-turn sequences (first call → tool call, second call → text), per-fixture match counting in Journal with sibling propagation
  • Docker + Helm — multi-stage Dockerfile (node:22-alpine), GHCR publish workflow (linux/amd64+arm64), basic Helm chart with deployment/service templates

Also includes:

  • Documentation website — 14 static HTML pages in docs/ covering all features with unit test and integration test examples
  • Updated competitive matrix — added VidaiMock, mock-llm, piyook/llm-mock as columns + 7 new feature rows
  • Embeddings drift test — three-way SDK/real/mock shape comparison for OpenAI embeddings
  • 109 new tests (658 total, up from 549)

Test Plan

  • pnpm test — 658 tests passing
  • pnpm run build — clean
  • pnpm run format:check — clean
  • pnpm run lint — clean
  • Full 6-agent code review loop — 2 rounds, zero actionable feedback in Round 2
  • pnpm test:drift — drift tests (requires API keys)
  • docker build -t llmock . — Docker build verification

@pkg-pr-new

pkg-pr-new Bot commented Mar 19, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/CopilotKit/llmock/@copilotkit/llmock@42

commit: c1bb46e

@jpr5
jpr5 force-pushed the feat/competitive-parity branch from c1bb46e to c9f1a21 Compare March 19, 2026 19:36
@jpr5
jpr5 changed the base branch from main to fix/drift-remediation March 19, 2026 19:36
@jpr5
jpr5 force-pushed the feat/competitive-parity branch 2 times, most recently from 3a4f226 to 10ea4b2 Compare March 19, 2026 21:24
@jpr5
jpr5 force-pushed the fix/drift-remediation branch 2 times, most recently from aad3d74 to 9597d18 Compare March 19, 2026 22:55
@jpr5
jpr5 force-pushed the feat/competitive-parity branch from 10ea4b2 to 20cffb0 Compare March 19, 2026 23:11
@jpr5
jpr5 force-pushed the fix/drift-remediation branch from 9597d18 to 162cb80 Compare March 19, 2026 23:23
@jpr5
jpr5 force-pushed the feat/competitive-parity branch from 20cffb0 to 272918d Compare March 19, 2026 23:24
@jpr5
jpr5 force-pushed the fix/drift-remediation branch 3 times, most recently from e3f117d to 4b6f190 Compare March 19, 2026 23:34
@jpr5
jpr5 force-pushed the feat/competitive-parity branch from 272918d to e3590d1 Compare March 19, 2026 23:38
jpr5 added a commit that referenced this pull request Mar 19, 2026
- fixture-loader: add isEmbeddingResponse to validateFixtures type check
  and add embedding-specific validation (empty array, non-number elements)
- drift-report-collector: add "OpenAI Embeddings" to PROVIDER_MAP and
  sync the test copy in drift-collector.test.ts
- values.yaml: add nameOverride and fullnameOverride at top
- .dockerignore: remove dead !LICENSE line (no-op since *.md excludes it)
- embeddings.ts/bedrock.ts: thread Logger through defaults, replace
  console.warn with logger.warn, add journal entries on JSON parse
  failure, pass flattenHeaders(req.headers) in all journal.add() calls
- update-competitive-matrix.ts: remove no-op .replace(/\.\.\./g, "...")
@jpr5
jpr5 force-pushed the feat/competitive-parity branch 3 times, most recently from 9ba6a07 to 42aa1da Compare March 20, 2026 00:16
Base automatically changed from fix/drift-remediation to main March 20, 2026 00:32
@jpr5
jpr5 force-pushed the feat/competitive-parity branch from 1c716a1 to 2624669 Compare March 20, 2026 00:34
@jpr5
jpr5 merged commit a165705 into main Mar 20, 2026
9 checks passed
@jpr5
jpr5 deleted the feat/competitive-parity branch March 20, 2026 00:34
jpr5 added a commit that referenced this pull request Apr 3, 2026
… responses, Docker (#42)

## Summary

Adds four high-value features that fill real gaps relative to VidaiMock,
dwmkerr/mock-llm, and piyook/llm-mock:

- **Embeddings endpoint** (`POST /v1/embeddings`) — deterministic
embedding generation via SHA-256 hash, fixture matching on `inputText`,
`onEmbedding()` convenience, automatic fallback to deterministic
embeddings when no fixture matches
- **Structured output / JSON mode** — `responseFormat` matching on
`response_format.type`, `onJsonOutput()` convenience, validation that
JSON-mode fixtures contain valid JSON
- **Sequential/stateful responses** — `sequenceIndex` on fixtures
enables multi-turn sequences (first call → tool call, second call →
text), per-fixture match counting in Journal with sibling propagation
- **Docker + Helm** — multi-stage Dockerfile (node:22-alpine), GHCR
publish workflow (linux/amd64+arm64), basic Helm chart with
deployment/service templates

Also includes:
- **Documentation website** — 14 static HTML pages in `docs/` covering
all features with unit test and integration test examples
- **Updated competitive matrix** — added VidaiMock, mock-llm,
piyook/llm-mock as columns + 7 new feature rows
- **Embeddings drift test** — three-way SDK/real/mock shape comparison
for OpenAI embeddings
- **109 new tests** (658 total, up from 549)

## Test Plan
- [x] `pnpm test` — 658 tests passing
- [x] `pnpm run build` — clean
- [x] `pnpm run format:check` — clean
- [x] `pnpm run lint` — clean
- [x] Full 6-agent code review loop — 2 rounds, zero actionable feedback
in Round 2
- [ ] `pnpm test:drift` — drift tests (requires API keys)
- [ ] `docker build -t llmock .` — Docker build verification
jpr5 added a commit that referenced this pull request Jul 15, 2026
… responses, Docker (#42)

## Summary

Adds four high-value features that fill real gaps relative to VidaiMock,
dwmkerr/mock-llm, and piyook/llm-mock:

- **Embeddings endpoint** (`POST /v1/embeddings`) — deterministic
embedding generation via SHA-256 hash, fixture matching on `inputText`,
`onEmbedding()` convenience, automatic fallback to deterministic
embeddings when no fixture matches
- **Structured output / JSON mode** — `responseFormat` matching on
`response_format.type`, `onJsonOutput()` convenience, validation that
JSON-mode fixtures contain valid JSON
- **Sequential/stateful responses** — `sequenceIndex` on fixtures
enables multi-turn sequences (first call → tool call, second call →
text), per-fixture match counting in Journal with sibling propagation
- **Docker + Helm** — multi-stage Dockerfile (node:22-alpine), GHCR
publish workflow (linux/amd64+arm64), basic Helm chart with
deployment/service templates

Also includes:
- **Documentation website** — 14 static HTML pages in `docs/` covering
all features with unit test and integration test examples
- **Updated competitive matrix** — added VidaiMock, mock-llm,
piyook/llm-mock as columns + 7 new feature rows
- **Embeddings drift test** — three-way SDK/real/mock shape comparison
for OpenAI embeddings
- **109 new tests** (658 total, up from 549)

## Test Plan
- [x] `pnpm test` — 658 tests passing
- [x] `pnpm run build` — clean
- [x] `pnpm run format:check` — clean
- [x] `pnpm run lint` — clean
- [x] Full 6-agent code review loop — 2 rounds, zero actionable feedback
in Round 2
- [ ] `pnpm test:drift` — drift tests (requires API keys)
- [ ] `docker build -t llmock .` — Docker build verification
jpr5 added a commit that referenced this pull request Aug 6, 2026
…note overlap no longer discards the run (#357)

Six proven fixes to `Fix Drift`, harvested onto the merged #348 main.
One is a security fix.

## What changes

**The one unpinned executable in the job no longer runs while the app
token is live.**
`sh <(curl https://ollama.com/install.sh)` is arbitrary third-party code
from a mutable URL, and it
sat six steps after an app token with `contents: write` +
`pull-requests: write` was minted into
the job. Everything else in that job is pinned — every `uses:` by commit
SHA, `pnpm install` by the
lockfile. This was the exception. Two changes, because neither alone
closes it: the step now runs
**before** the mint, and the downloaded bytes are checked against a
sha256 with a hard `exit 1`
before `sh` ever sees the file. Reordering alone leaves the real attack
— a compromised script
plants a `git`/`gh`/`node` on PATH and the later token-holding steps run
it.

**A note some open PR already proposed no longer discards the rest of
the run.** The needs-human
step's per-note guard `exit 0`'d the whole step on the first overlapping
note. On a mixed run — a
registry edit applied AND a different family deferred — the registry
edit was committed locally,
never pushed, proposed to nobody, and re-abandoned identically every
morning. The stand-down can
never be right (control only reaches that loop once the changeset guard
has declined, so nothing
this run carries is proposed anywhere), so it is removed rather than
narrowed. The overlap is still
reported, as a warning.

**A rejection survives a human editing the closed PR that records it.**
Closing a drift PR rejects
its changeset, and the record is a marker in that closed PR's body. The
marker self-heal that
exists to repair deleted markers listed `--state open`, so it never saw
the closed PR — a human
writing down *why* they declined destroyed the rejection permanently and
the bot re-proposed every
morning. Both self-heals now list `--state all`; candidacy is unchanged
(every candidate still
carries this run's key as its branch suffix). MERGED reaches neither
self-heal, and on the
needs-human step CLOSED is admitted through the branch-key anchor only,
so the closed backlog
cannot drag a truncated file list into the fail-closed audit.

**The persist step's note scan no longer needs a bash-4 builtin.**
`mapfile` was the only bash-4
construct anywhere in the workflow, and it made that step the one body a
test could not execute on
a stock macOS box — which is exactly how a hand-written mirror gets
written instead of a run.

**Two test/doc commits.** The alert payloads are now POSTed to a socket
that records them, so the
method, header and body are measured on the wire instead of against a
`curl` stub. And DRIFT.md no
longer offers deleting a closed PR's marker as a way to un-suppress a
rejection, because the
self-heal now puts it back.

## Red-green, re-run on this base

These commits were written against an older base. Every proof was re-run
here and watched.

**ollama.** Pre-fix restored: the step sits at index 7 against the
token's index 1, declares no
digest, and hands attacker-substituted bytes straight to `sh`
(`shRan=true`). Post-fix the same
payload is refused with `::error::…does not match its pinned sha256`,
`sh` is never reached, and
the step exits 1 — while bytes that DO match still execute, so the gate
is not "always refuse". The
pin was re-verified against the live URL rather than taken on trust:
15902 bytes,
`25f64b81…82c9f`, byte-for-byte.

**per-note.** Pre-fix restored: `created=false`, `pushed=false`, and
`needs-human: note drift-proposals/openai-mythical-1.new-family.md
already proposed in open PR #42
— not opening a duplicate`. Post-fix it warns, pushes and opens exactly
one PR; the negative
control (a re-fire of the SAME changeset) still opens no second PR.

**rejection.** Eight mutations — reverting either listing to `--state
open`, dropping the MERGED
exclusion, relaxing or removing the state narrowing from either jq
program — all red, none
survived. The pre-fix red is the workflow pushing a branch for a
changeset a human had rejected.

**alerts.** Four mutations on the wire (`-X PUT`, dropped Content-Type,
a literal `\n`, the wrong
`-d` variable) all red.

## Not included

`fd867dc` ("a provider whose live listing was too short to trust is not
a quiet day") is
deliberately absent — it needs the threshold fix that ships with it, and
alone it would red the
daily cron every morning. `scripts/drift-sync.ts` is untouched here.

## Verification

`pnpm build`, `pnpm test` (5044 passed), `pnpm test:drift` (119 passed /
66 skipped),
`pnpm test:exports`, `tsc --noEmit`, `eslint`, `prettier --check`,
`actionlint`, `bash -n` on all
13 `run:` bodies, and `zizmor --min-severity medium` all exit 0.
`fix-drift-workflow.test.ts` goes
130 → 150 tests.

Three files change. No `package.json`, `CHANGELOG.md`, `pnpm-lock.yaml`,
`charts/` or
`.claude-plugin/` — this PR consumes no version.

## Still unproven

The workflow has never executed on Actions; every proof here is a local
run of a `run:` body with
`gh`, `curl` and `git push` stubbed. That Slack *renders* these messages
as intended is also
unproven. And the ollama pin will red the cron on the next upstream
publish — fail-closed, chosen
deliberately, with the digest printed in the error.
akivjaved pushed a commit to akivjaved/aimock that referenced this pull request Aug 7, 2026
…e rest of the run

The needs-human step's per-note guard `exit 0`'d the whole run on the FIRST note
some open PR already proposed. On a mixed run that lost work: drift-sync applies a
mechanical registry edit AND defers a different family to a human, and if the
deferred note is already proposed by a PR from an earlier run — whose outcome set
was different, so it hashes to a different changeset key and the primary guard
legitimately does not fire — the registry edit was committed locally, never pushed,
proposed to nobody, and re-detected and re-abandoned identically every morning. A
note set that merely GREW since the last run ({B} then {B,C}) lost C the same way.

The stand-down can never be right, which is why it is removed rather than narrowed:
control only reaches that loop after the primary changeset guard has declined, so by
construction no open PR carries this run's changeset and the run's content is
un-proposed. The overlap is still REPORTED — two open PRs carrying one note looks
exactly like the duplicate-PR spam this workflow exists to prevent, and the human
reading the second one deserves to know why it exists.

Also adds the harness the red-green needed: `observePrStep` EXECUTES either
PR-open step's own several-hundred-line body against a real git repository with a
real base commit and diff, the real jq, and a scripted `gh`. Only `gh` and
`git push` are stubbed. Hand-mirroring these guards in TypeScript is what produced
most of this PR's review findings, so "the step stood down" is now the observable
ABSENCE of a `pr create` call. A CANARY pins that the harness can make both bodies
push and open a PR, so the stand-down assertions cannot be satisfied by a harness
that runs nothing.

Red-green, EXECUTED: pre-fix the mixed run printed "note … already proposed in open
PR CopilotKit#42 — not opening a duplicate" and exited 0 with created=false, pushed=false;
post-fix it warns about the overlap, pushes, and opens exactly one PR. Two mutations
bound: restoring the run-wide `exit 0` reds three tests, and silencing the warning
reds one. The negative control — a re-fire of the SAME changeset — still opens no
second PR, so the dedup that matters is intact.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant