Commit graph

2,157 commits

Author SHA1 Message Date
Trevon
ed6a9ec551
Merge pull request #486 from trvon/release-please--branches--main--components--yams
chore(main): release 0.22.1
2026-11-07 17:44:34 -07:00
trvon
054f66de8a
docs(changelog): point 0.22.1 at the unpublished 0.22.0 notes
Signed-off-by: trvon <git@trevon.dev>
2026-11-07 17:37:37 -07:00
github-actions[bot]
f3e173813d
chore(main): release 0.22.1 2026-11-08 00:36:51 +00:00
Trevon
c7183f2fcb
Merge pull request #485 from trvon/experimental
chore: promote experimental to main
2026-11-07 17:36:25 -07:00
Trevon
98e06ac4aa
Merge pull request #484 from trvon/chore/release-as-0.22.1
chore: release 0.22.1
2026-11-07 17:33:40 -07:00
trvon
c0d3ecb860
chore: release 0.22.1
0.22.0 was tagged but never published: its packaging failed on macOS
x86_64 and Windows (fixed in #483). The only changes since are ci
commits, which do not trigger a release on their own.

Release-As: 0.22.1
Signed-off-by: trvon <git@trevon.dev>
2026-11-07 17:31:23 -07:00
Trevon
3e359a3806
Merge pull request #483 from trvon/ci/release-static-table-fetch
fix(release): fetch the static-embedding table without the built CLI
2026-11-07 17:30:30 -07:00
trvon
e67b513990
ci(release): fetch the static-embedding table without the built CLI
The 0.22.0 release failed on two platforms in this step. On macOS x86_64
the built yams-cli could not verify GitHub's TLS certificate; on Windows
it exited at once, most likely unable to load its DLLs from the build
tree. Fetch the table with curl instead and check the sha256 pinned in
src/cli/static_tables.cpp, which the script reads so the pin has one
source.

Signed-off-by: trvon <git@trevon.dev>
2026-11-07 13:53:40 -07:00
Trevon
b88f391c34
Merge pull request #481 from trvon/ci/static-analysis-timeout
ci: give Static Analysis 60 minutes for promotion PRs
2026-11-07 10:05:56 -07:00
Trevon
35bfc30ac6
Merge branch 'experimental' into ci/static-analysis-timeout 2026-11-07 10:05:49 -07:00
Trevon
b9f05fef9a
Merge pull request #482 from trvon/chore/backmerge-main-0.22.0
chore: back-merge main into experimental after 0.22.0
2026-11-07 10:05:38 -07:00
trvon
20c1a0a6bf
Merge branch 'main' into experimental
Signed-off-by: trvon <git@trevon.dev>
2026-11-07 10:05:02 -07:00
Trevon
220230c538
Merge pull request #470 from trvon/release-please--branches--main--components--yams
chore(main): release 0.22.0
2026-11-07 10:04:20 -07:00
trvon
fa8927b767
ci: give Static Analysis 60 minutes for promotion PRs
On a promotion PR the changed lines are all of experimental vs main, and
cppcheck ran past the 20-minute limit on #467 and #478, so the job was
cancelled on every release.

Signed-off-by: trvon <git@trevon.dev>
2026-11-07 08:00:23 -07:00
trvon
0e99cd9763
docs(changelog): drop duplicate and review-follow-up entries for 0.22.0
Signed-off-by: trvon <git@trevon.dev>
2026-11-07 07:59:59 -07:00
github-actions[bot]
94ddda6c48
chore(main): release 0.22.0 2026-11-07 14:59:21 +00:00
Trevon
660c9a186e
Merge pull request #478 from trvon/experimental
chore: promote experimental to main
2026-11-07 07:57:09 -07:00
Trevon
d534c41a62
Merge pull request #480 from trvon/fix/candidate-review
fix(daemon): stop WorkCoordinator's context when stop() throws in the destructor
2026-11-06 23:34:31 -07:00
trvon
6cafa68871
test(daemon): destructor returns when WorkCoordinator::stop() throws
A detached strand on an executor that throws from execute() makes stop()
throw while posting its cancellation, before the work guard is released.
The coordinator is destroyed on its own thread so a regression fails
instead of hanging the suite. Fails without the previous commit.

Signed-off-by: trvon <git@trevon.dev>
2026-11-06 23:30:48 -07:00
trvon
12799263bc
fix(daemon): stop WorkCoordinator's context when stop() throws in the destructor
The destructor now swallows a stop() exception instead of terminating.
stop() can throw before it resets the work guard, and the workers' join
would then wait forever. Stop the io_context and drop the guard in that
path.

Also document that the benchmark's nDCG uses trec_eval's linear gain.

Signed-off-by: trvon <git@trevon.dev>
2026-11-06 23:17:37 -07:00
Trevon
650d752c42
Merge pull request #479 from trvon/chore/backmerge-main-0.22
chore: back-merge main into experimental
2026-11-06 22:33:00 -07:00
trvon
843a45152c
Merge branch 'main' into experimental
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 22:32:21 -07:00
Trevon
45c6a1badb
ci(lint): skip Release Please bot commits in the DCO check (#477)
The release PR's commit is authored by github-actions[bot], which cannot
add a sign-off, so dco-check failed on every release PR.

Also drop the 5 ms wall-clock limit from the community detection timing
test. It took 10.4 ms on the linux-arm64 runner; the test now only checks
that the timing key is present, which is what its name says.

Signed-off-by: trvon <git@trevon.dev>
2026-11-06 22:30:34 -07:00
Trevon
5a8a8fa491
fix(bench): fail setup when the index is not fully ready (#474)
Some checks failed
Fuzz Smoke / libFuzzer smoke (push) Has been cancelled
* fix(bench): fail setup when the index is not fully ready

Setup went on to queries once the embed queue had drained and stayed
stable at 90% coverage or more, and only logged when the vector DB
stayed unready. Partly embedded runs scored the index build rather than
retrieval.

Now setup throws below 100% embedded documents (relax with
YAMS_BENCH_MIN_EMBED_COVERAGE=P for corpora with empty documents) and
when the vector DB is still unready 30 s after the drain. The measured
coverage is written to the setup JSON as embedding_coverage_pct.

Signed-off-by: trvon <me@trevon.dev>

* fix(bench): close readiness-gate bypasses

- A failed final status check now fails setup instead of skipping the
  coverage and vector-DB checks.
- The coverage floor is read before the wait, and the stable-drain
  exit uses min(90%, floor), so a lower YAMS_BENCH_MIN_EMBED_COVERAGE
  can end the wait instead of running to the timeout.
- Non-finite floor values (nan, inf) fall back to 100%.

Signed-off-by: trvon <me@trevon.dev>

---------

Signed-off-by: trvon <me@trevon.dev>
2026-11-06 22:29:35 -07:00
Trevon
d78d3d6cc7
fix(bench): sample BEIR subsets by query with a seed (#473)
* fix(bench): sample BEIR subsets by query with a seed

The old subset added the judged documents of every query in ID order,
then ID-ordered filler, and dropped qrels whose documents fell past the
cap, shrinking R and inflating recall.

Now queries are sampled first (YAMS_BENCH_SUBSET_SEED, default 42),
each sampled query keeps its whole relevant set, a query whose set does
not fit the budget is skipped, and the rest of the budget is a seeded
random sample. The shuffle is Fisher-Yates over mt19937_64, so libc++
and libstdc++ pick the same subset.

The subset label (full or seeded:<seed>) is part of the index cache key
and is written to the setup and debug JSON. Caches built before this
are rebuilt.

Signed-off-by: trvon <me@trevon.dev>

* test(bench): cover seeded filler documents in subset reproducibility

The test compared only sampled query IDs; a seed regression in filler
sampling would have changed the corpus unnoticed.

Signed-off-by: trvon <me@trevon.dev>

---------

Signed-off-by: trvon <me@trevon.dev>
2026-11-06 22:29:35 -07:00
Trevon
8b1302dc70
fix(bench): score retrieval with trec_eval metric definitions (#472)
* test(bench): pin retrieval metrics to trec_eval definitions

Red: P@k divides by returned count, AP by relevant seen, nDCG uses
exponential gain, and grade-0 qrels count as relevant.

Signed-off-by: trvon <me@trevon.dev>

* fix(bench): score retrieval with trec_eval metric definitions

Match pytrec_eval as used by BEIR, so bench numbers compare with
published ones:
- relevant means grade > 0; grade-0 qrels no longer enter relevant sets
- P@k divides by k, not by the number of results returned
- AP and recall divide by R, all relevant documents
- nDCG uses linear gain; ungraded relevant documents count as grade 1

Absolute scores change; old runs are not comparable.

Signed-off-by: trvon <me@trevon.dev>

* fix(bench): skip queries with only grade-0 qrels when capping queries

A query whose included qrels were all grade 0 took a query slot, then
dropped out in generateTestQueries, so capped runs scored fewer queries
than requested.

Signed-off-by: trvon <me@trevon.dev>

---------

Signed-off-by: trvon <me@trevon.dev>
2026-11-06 22:29:34 -07:00
Trevon
e3d7a7e496
fix: resolve clang-tidy correctness findings (#475)
* fix: resolve clang-analyzer findings

Remove dead stores (an unused grep cold-doc cap and context locals, audio
metadata flags, a duplicate reward assignment, simeon recipe labels),
stop fread loops at a short read, guard null cli_/state_ uses, report
integrity_check step errors, and name the class on destructor shutdown
calls. vector_database now re-validates a batch after dimension
reconciliation; the early 'validated = true' skipped that pass. The
vector pipeline clears its pointer to stack diagnostics before return.

Suppressed with reasons: struct padding, a MSG_DONTWAIT recv, two
stores read only through references or in TSAN builds, and fold
expressions over static constexpr tuples.

Signed-off-by: trvon <me@trevon.dev>

* fix: resolve small bugprone findings

- use-after-move: count archive entries before moving them into the list.
- optional-value-conversion: pass and return optionals as they are.
- reserved-identifier: drop file-level _CRT_SECURE_NO_WARNINGS; meson
  sets it for Windows builds.
- unused-local-non-trivial-variable: drop two unused strings.
- branch-clone: merge identical branches and switch cases.

Suppressed with reasons: four moves that happen only on a path that
never reads the value again, a placeholder SIGHUP case, and the MCP
registry lookup order.

Signed-off-by: trvon <me@trevon.dev>

* fix: keep exceptions out of destructors and noexcept functions

Destructors that call stop()/shutdown() now catch and drop exceptions
instead of terminating during teardown. JsonResumeStore::remove() is
noexcept but json::dump throws on invalid UTF-8 and fs::exists on
permission errors; it is now best effort.

Suppressed: noexcept functions and main() where only allocation or
mutex failures can escape.

Signed-off-by: trvon <me@trevon.dev>

* chore: fix NOLINT comments for asio error_code overloads

Multi-line NOLINTNEXTLINE comments suppressed the next comment line, not
the call. Each call now has a one-line suppression directly above it.

Signed-off-by: trvon <me@trevon.dev>

* fix: widen operands before multiplying

Constant products assigned to 64-bit types now multiply in 64 bits,
and time arithmetic widens minutes before scaling.

Signed-off-by: trvon <me@trevon.dev>

* fix: use the env boundary and reentrant libc calls (mt-unsafe)

concurrency-mt-unsafe:
- Raw std::getenv reads now use yams::config::getenv_optional/nonempty,
  the boundary that set_environment() locks against.
- strerror(errno) becomes std::generic_category().message(errno).
- localtime/gmtime become localtime_r/gmtime_r helpers.
- The object-storage loader called dlerror() twice when dlopen failed;
  the second call returned null, which went to the formatter.

Suppressed with reasons: dlerror (per-thread on glibc and macOS), CLI
std::exit paths, fixed systemctl commands and one benchmark env read.
The portability allowlist drops the entries for removed raw reads.

Signed-off-by: trvon <me@trevon.dev>

* fix: make narrowing conversions explicit

Each implicit narrowing conversion that clang-tidy reports now goes
through a static_cast to the destination type. The values are the same.
The embedding backend divided a signed duration by an unsigned count,
which ran the division in unsigned arithmetic; it now casts the count.

Signed-off-by: trvon <me@trevon.dev>

* chore: mark best-effort empty catch blocks

Every empty catch reported by bugprone-empty-catch guards logging,
joins, parsing or status output that must not fail the caller; each
now carries a NOLINT next to its existing comment. Two catches after
a model load now log a warning, and a try block around strtol (which
does not throw) is gone.

Signed-off-by: trvon <me@trevon.dev>

* chore: suppress unchecked-optional-access on guarded accesses

The check cannot follow guards through Result<std::optional<T>>::value()
or helper predicates. Each reported access has a guard on the same
value earlier in the function; those were checked, and the accesses
carry NOLINTNEXTLINE.

Signed-off-by: trvon <me@trevon.dev>

* chore: put NOLINTs on the lines clang-tidy reports

bugprone-use-after-move reports the first use, not the move. Also mark
the best-effort lexical_hits parse in the search command.

Signed-off-by: trvon <me@trevon.dev>

* fix(daemon): let failed shutdown in destructors terminate again

Swallowing an exception from stop()/shutdown() let the destructor
return before tracked coroutines quiesced, while they still used the
object. Restore the original bodies so a throw ends in std::terminate,
with a reasoned NOLINT for bugprone-exception-escape.

Also guard the second readiness block in the no-metrics status path,
which still read state_ without a null check.

Signed-off-by: trvon <me@trevon.dev>

* test(vector): reject a bad tail record after batch dimension reconciliation

Fails on the old early exit, which skipped validating records after the
first one that matched the stored schema.

Signed-off-by: trvon <me@trevon.dev>

---------

Signed-off-by: trvon <me@trevon.dev>
2026-11-06 22:29:34 -07:00
Trevon
a11bc57165
Merge pull request #471 from trvon/ci/promotion-lint-checks
ci: let promotion PRs pass DCO and commitlint on settled history
2026-11-06 19:58:04 -07:00
trvon
2fa55f492d
ci: let promotion PRs pass DCO and commitlint on settled history
Promotion PRs lint every commit since main, and #467 failed both checks
on history that cannot change:
- DCO flagged GitHub's merge-button merge commits, which cannot carry a
  sign-off. lint.sh dco now skips merge commits.
- DCO also flagged 24 commits from before the auto sign-off hook
  (56ca5db9). They are listed by SHA in scripts/ci/dco-exempt-commits.txt
  and skipped; any other unsigned commit still fails.
- commitlint flagged two landed commits (type 'obs'; a sentence-case
  subject). commitlint.config.js ignores exactly those two headers.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 18:46:43 -07:00
Trevon
6928477041
Merge pull request #467 from trvon/experimental
chore: promote experimental to main
2026-11-06 18:43:02 -07:00
Trevon
65782f0a54
Merge pull request #469 from trvon/fix/refcount-contention-test
test(storage): release the contention test's lock even under a reader
2026-11-06 18:24:12 -07:00
trvon
a0b78ba53a
test(storage): release the contention test's lock even under a reader
The reference-counter contention test held a write lock on a second
connection and released it with COMMIT after 400 ms, ignoring the
result. COMMIT needs an exclusive lock, so it fails with SQLITE_BUSY
while the connection under test holds a shared lock between its
retries; with no busy timeout it failed silently and the lock was never
released. A slow macOS runner hit this: init retried six times over 13 s
and every attempt found the database locked.

The holder now waits for the shared lock to clear (busy_timeout), and
the test checks that the COMMIT succeeded.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 18:22:34 -07:00
Trevon
1052e656cc
Merge pull request #468 from trvon/fix/post-release-followups
chore: report reference counter init errors and explain release symbols
2026-11-06 16:20:24 -07:00
trvon
2bb0b439fd
chore: report reference counter init errors and explain release symbols
- The reference-counter contention test failed once on a slow macOS
  runner without saying why: its INFO came after the failing REQUIRE, so
  the constructor's error was never printed. It is now reported with the
  failure. The retry budget (about 11.75 s of backoff against a 400 ms
  hold) is not the tight part, so the timing is unchanged.
- setup.sh now notes, for release and debugoptimized builds, that
  -Ddebug=true keeps -g symbols for packaging and that a plain install
  ships them, and shows the --strip and split-debug-symbols options.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 16:19:10 -07:00
Trevon
a9758fed9d
Merge pull request #465 from trvon/perf/daemon-thread-names
Some checks failed
Fuzz Smoke / libFuzzer smoke (push) Has been cancelled
perf(daemon): name threads, size pools via TuneAdvisor, stop per-cycle snapshot copies
2026-11-06 16:03:44 -07:00
trvon
c3760cea8c
fix: address review findings on the thread naming change
- WriteCoordinator::writerLoop() is a coroutine on the shared
  WorkCoordinator executor and can resume on any worker, so naming
  'this thread' from it mislabeled a pool worker. The call is removed.
- boost::asio::thread_pool creates its threads internally, so the search
  runtime, repair and blocking pools stayed unnamed.
  nameThreadPoolWorkers() posts one task per worker that names its
  thread and holds it until all have arrived; every wait is bounded.
- The WorkCoordinator naming test read /proc once, possibly before the
  workers had named themselves; it now waits (bounded) for the names.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 15:53:08 -07:00
trvon
9b1b221356
perf(memory-sync): keep the committed snapshot across unchanged cycles
perf on the idle daemon put most of the memory-sync worker's CPU in
refreshCommittedState(): every reconcile cycle copied the loop's whole
committed state (every merged record and every cached blob) into a new
snapshot and freed the old one, about 12 ms per 1 s cycle, even when the
cycle reused the last complete scan because nothing had changed.

sync() now records whether it returned the previous complete scan
unchanged, and the worker and syncOnce() keep the published snapshot in
that case. Writes, erases and quarantine changes still refresh it.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 15:49:27 -07:00
trvon
a138203e89
perf(daemon): name every thread and size pools through TuneAdvisor
Profiling the installed daemon could not attribute CPU to a pool: 57 of
its 60 threads were named 'yams-daemon'. YAMS_SET_THREAD_NAME only
reached Tracy, and the pools never named their threads.

- yams::setCurrentThreadName() sets the OS thread name (Linux and
  macOS), and YAMS_SET_THREAD_NAME now calls it in every build.
- Work, request and I/O pool workers, the WAL sync, checkpoint, writer,
  connection-pool maintenance, memory-sync and P2P threads are named.
- RequestExecutor and the search runtime pool sized themselves from
  hardware_concurrency() directly. TuneAdvisor now provides both, with
  the same defaults; YAMS_REQUEST_THREADS still applies.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 15:49:27 -07:00
trvon
5887bf6b5c
fix: address review findings on the backfill and repair fixes
- Topology backfill skipped any InvalidArgument as unpublishable, but a
  backend that rejects the write (or a sync service without an
  identity) also answers InvalidArgument, so those records were consumed
  and never published after recovery. The adapter now reports record-
  local failures (no key, text that is not UTF-8, over the resident
  publish limit) as InvalidData, and backfill skips only those; other
  failures back off and retry.
- Manifest::isValid() now also requires the chunk sizes to add up to
  fileSize, as its comment claimed; a mismatched manifest would
  reconstruct the wrong content.
- The repair scan's terminal rule used repair_attempts as a budget, but
  that counter moves on every status write (Processing then Failed per
  attempt). For a document with no extracted text one failed embedding
  attempt is already conclusive, and the rule stops applying once
  extraction produces text, so it no longer uses the counter.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 15:49:11 -07:00
trvon
adba570e5c
fix(repair): re-embed documents whose embedding derivation is open
A document whose content changed under an in-flight embed keeps
has_embedding = 0 while its superseded vector rows remain. The repair
scan took its 'already embedded' snapshot from vector rows, so it never
queued such a document and its derivation stayed open for good. Nine
documents on the dev corpus were stuck this way, and because the
metadata embedded count never matched the vector count, the startup
reconcile rewrote the embedding status of every document (a 1-3 s
write-connection hold) on every daemon start.

The scan now drops documents with an open derivation from the vector
snapshot, matching what hasDocumentEmbeddingByHash() reports.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 14:24:16 -07:00
trvon
d3be3186ce
fix(daemon): size embed_jobs once and keep connection counters on
- Five call sites created the embed_jobs channel with three capacity
  formulas. The channel bus keeps the first, so the post-ingest queue's
  8192 silently overrode the embedding service's clamp to the post-ingest
  queue size and a warning was logged on every start.
  TuneAdvisor::embedJobChannelCapacity() now sizes it for every creator.
- Connection FSM counters were enabled only at debug log level, while
  status reported them unconditionally, so status showed zero
  transitions and bytes for a daemon serving requests. They are sharded
  relaxed atomics and now stay on.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 14:11:04 -07:00
trvon
533eb67175
fix(repair): stop re-queuing unextracted documents repair gave up on
A document whose extraction never completed has no text and so no
embedding, and the startup scan queued it for embedding on every sweep.
Embedding failed for lack of content, repair marked it Failed, and the
next sweep queued it again: nine such documents on the dev corpus had
62 to 160 repair attempts, still climbing on every daemon start.

Once repair has failed it maxRetries times, an unextracted document is
terminal like a failed extraction, until the extractor set changes or
an explicit repair asks for it. A document that still has text is
retried as before.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 14:04:38 -07:00
trvon
399c92b78a
fix(memory-sync): stop backfill wedging on records that can never publish
The daemon log held 31,704 'backfill domain failed' warnings: one bad
record failed again on every 5 s cycle, pinned its domain's cursor and
kept every later record from reaching peers.

- Record text (paths, metadata values, graph labels, chunk text) is not
  always UTF-8, and nlohmann::json threw on it out of every sync
  adapter. Encoding now goes through encodeRecordJson(), which reports
  InvalidData; the bytes are not rewritten, because a replaced character
  would replicate a different path or label.
- Topology nodes and edges that can never publish (invalid text, over
  the resident limit, invalid key) are skipped and logged on the first
  pass, as documents and vectors already were.
- A domain that keeps failing for another reason (backend outage, a
  writer history that needs a bootstrap) backs off from 5 s to 10 min
  and logs its name, failure count and retry delay only when the
  failure or the delay changes.
- Manifest::isValid() rejected the zero-chunk manifest older stores wrote
  for an empty file, so empty documents read back as ManifestInvalid and
  backfill skipped them as corrupt.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 13:59:49 -07:00
Trevon
26664459d4
Merge pull request #463 from trvon/fix/copilot-stack-followups
fix: address review findings on the lifecycle fixes
2026-11-06 13:45:09 -07:00
trvon
5be5ad48c6
fix: address review findings on the lifecycle fixes
- ONNX provider: a load_model() that finished after unload_model() still
  published Ready, so the model stayed unloaded but marked Ready and later
  loads skipped it. unload_model() now bumps a per-model generation, and a
  load publishes Ready or Failed only if its generation is still current.
- IntegrityVerifier: a stop that had already published running=false
  could set shouldStop on a run a concurrent start had just begun. Start,
  stop, pause and resume now share a lifecycle mutex.
- SearchEngineFsm: the transition comment said RebuildStarted enters
  Building from any state; debug builds reject it while already Building.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 13:24:59 -07:00
Trevon
1697382fdb
Merge pull request #462 from trvon/fix/racy-lifecycle-flags
Some checks failed
Fuzz Smoke / libFuzzer smoke (push) Has been cancelled
fix: close racy start/stop and state transitions
2026-11-06 12:41:06 -07:00
trvon
14cacc8857
fix: close racy start/stop and state transitions
- Compression transaction, recovery and monitor managers checked
  running_ and set it separately, so concurrent start() calls all passed
  and assigned worker threads to the same members. start() and stop()
  now share a lifecycle mutex the worker loops never take.
- IntegrityVerifier claims a start with compare-exchange, so only one of
  several concurrent starts succeeds.
- WorkCoordinator::started_ was a plain bool, and isRunning() and
  getWorkerCount() read the worker vector without a lock while stop and
  join cleared it. Both now read atomics, published after the workers
  start and cleared before the vector is.
- StdioTransport: a receive() already past its loop check overwrote
  Closing with Disconnected or Error. Closing is now terminal.
- ONNX provider: unload_model left the model marked Ready, so a later
  load_model returned early and never reloaded it. Unload now marks it
  Unloaded.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 12:38:44 -07:00
trvon
ec95fa31c4
fix(daemon): give every daemon FSM its own state
The embedding-provider, plugin-host, search-engine and daemon-lifecycle
FSMs wrapped tinyfsm machines, whose state and mutex are static, so every
instance in a process shared one state. PluginManager and
EmbeddingLifecycleManager both own an EmbeddingProviderFsm, and its
constructor reset the shared snapshot, so creating one wiped the provider
state the other read; the daemon and EmbeddedServiceHost likewise shared
one lifecycle. This is the problem 0ebe9c5c fixed for ServiceManagerFsm.

Each wrapper now keeps its snapshot and mutex per instance. Public
interfaces and transitions are unchanged; the transition rules are
written out next to each implementation.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 12:16:45 -07:00
trvon
78cb3ab747
fix(search): count every lexical match and keep grouped JSON parseable
With overlay matches merged in, lexical_hits reported the limited page
size instead of the full-text match count; count every full-text match
plus the overlay documents it added. --json-grouped dropped the field,
printed a human summary line after the JSON and printed "(no results)"
instead of JSON for an empty result, so its stdout never parsed. Emit
lexical_hits there and keep stdout a single JSON document.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 11:30:46 -07:00
trvon
2672027563
feat(search): report lexical_hits in search --json
Scores are normalised to the top hit, so a query that matches no indexed
term still returns results scored 1.0 and nothing told a caller that
nothing matched. Count the documents a text component matched: the
engine records it before fusion, the metadata path from full-text and
overlay matches (fuzzy near-misses count as 0), and search --json emits
it. Ranking is unchanged.

Signed-off-by: trvon <me@trevon.dev>
Signed-off-by: trvon <git@trevon.dev>
2026-11-06 10:42:55 -07:00