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>
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>
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>
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>
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>
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>
* 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>
* 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>
* 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>
* 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>
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>
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>
- 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>
- 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>
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>
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>
- 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>
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>
- 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>
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>
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>
- 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>
- 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>
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>
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>
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>