> Fetch the index of the TinyStore docs, every page as markdown, at https://tinyshed.org/tinystore/llms.txt

# TinyStore 0.8.0

TinyStore 0.8.0 came out on 16 November 2026. A migration still being
written can be a draft, applied again after an edit with one command, and a
search by words and a vector together says what each half gave every hit.
Most of the release is fixes: fifty-four of them, from a write queue that
could wait for good to a read token that made files. A read token now only
reads, and a semaphore keeps one limit a name in a program, so a server
given read tokens and a program that opened one semaphore with two limits
need a look.

- **SQL**
  - [A migration still being written](#a-migration-still-being-written): `….draft.sql`, and `tinystore migrate --redo-drafts`.
- **Search**
  - [Each half's score](#each-halfs-score): `textScore` and `similarity` on every hit, and a `minSimilarity` floor.

> \[!WARNING]
> **A read token reads only what the store holds**
> In 0.7.1 a connection with a `read` token could open a name the store did
> not hold, and the store made it: a bucket, a queue, a set of files, a
> database's file. It now opens only what is there, as it is. A name the
> store lacks is `not found`, and an open that would make or change anything
> is `permission`. Give a program that opens new names a `data` token.
>
> **A semaphore has one limit a name in a program**
> A second open of a name in the same store with another limit fails
> `invalid` and names both:
>
> ```diff
> - const gpu = store.semaphore('gpu', { limit: 1 }); const batch = store.semaphore('gpu', { limit: 3 })
> + const gpu = store.semaphore('gpu', { limit: 1 }); const batch = store.semaphore('gpu-batch', { limit: 3 })
> ```

## A migration still being written

A migration you are still writing is a draft: add `.draft` to its name. It
applies like any other, and before the first draft applies, the store copies
the database to `sql/<name>.before-drafts`
([#61](https://github.com/tinyshed/tinystore/issues/61)).

```sql title="migrations/0003_orders_note.draft.sql"
alter table orders add column note text;
```

Edit the draft, and the next open fails and names the command that applies
it again. Stop the program and run it:

```sh
tinystore migrate ./data shop ./migrations --redo-drafts
```

```text
● shop  took back 0003_orders_note.draft.sql, applied 0003_orders_note.draft.sql
```

The database goes back to its copy from before the first draft, and every
draft applies again as it reads now. To ship a draft, drop `.draft` from its
name and leave its text as it is: the next open records the new name and
removes the copy.

- The store never takes a draft back on its own: an edited draft only stops
  the open (contract SQL-12).
- Drafts come after every migration that shipped: a shipped step after a
  draft is refused.
- Rows written since the drafts are gone after `--redo-drafts`, and so is
  anything else the database's file holds; the bytes of its `db.files` stay.

[A migration still being written](https://tinyshed.org/tinystore/docs/guides/sql/migrations.md#a-migration-still-being-written)
has the details.

## Each half's score

A hit's `score` is the sum of its words' and its vector's halves, which only
ranks one search's hits. Each hit now keeps what each half gave it
([#62](https://github.com/tinyshed/tinystore/issues/62)):

```ts
const { hits } = await docs.search({ text: question, vector: q, minSimilarity: 0.58 })
hits[0] // { id: 'd-1', value: …, score: …, textScore: …, similarity: … }
```

```python
result = await docs.search(question, vector=q, min_similarity=0.58)
result.hits[0]  # Hit(id='d-1', value=…, score=…, text_score=…, similarity=…)
```

```go
result, err := docs.Search(ctx, question, search.Vector(q), search.MinSimilarity(0.58))
hit := result.Hits[0] // hit.TextScore and hit.Similarity are *float64, nil when absent
```

```rust
let found = docs.search(question).vector(&q).min_similarity(0.58).run()?;
let hit = &found.hits[0]; // hit.text_score and hit.similarity are Option<f64>
```

- `textScore` is the score its words gave it, absent where the words did
  not find it among their best hundred; `similarity` is the cosine of its
  vector with the search's, absent where the document has no vector.
- `minSimilarity` keeps documents under that cosine out of the vectors'
  half. Before, a question about nothing in the index still gave the whole
  vector weight to whatever was least far. It is `invalid` beside `rerank`.

[Each half's score](https://tinyshed.org/tinystore/docs/guides/search/hybrid.md#each-halfs-score) and
[A similarity floor](https://tinyshed.org/tinystore/docs/guides/search/hybrid.md#a-similarity-floor) have the
details.

## Changed names

- A `read` token opens only what the store holds, as it is, and makes or
  binds nothing: a name it lacks is `not found`, a name of another kind
  `invalid`, and every write `permission`.

- A semaphore opened again in the same store with another limit fails
  `invalid`, in every language:

  ```ts
  store.semaphore('gpu', { limit: 3 }) // 0.7.1: its own limit; 0.8.0: InvalidError, open with a limit of 1, not 3
  ```

- A queue's `list` cursor from 0.7.1 is refused `invalid`: a page now lists
  the jobs added without an id too, and its cursor says where in them it
  stands. Start a walk again from its first page.

## Fixes

- **Writes**
  - A blocking and an awaited write to one file, together past 8 MiB, could
    leave the file's queue with no one leading it, and every later write
    waited for good.
  - A write whose completion panicked left the writes beside it waiting.
    They are answered, and the panic is said once in the log.
  - A deferred foreign key one write left broken failed every write of its
    commit `outcome unknown`. It fails that write alone, `invalid`.
  - `store.close()` from inside a worker's, a schedule's or a
    subscription's handler waited out the handler's timeout for itself. It
    fails `invalid` at once.
  - An engine that opened while its store closed stayed open and wrote on.
- **SQL**
  - `limit(10).delete()` in Bun and Node, Python and Go deleted every row
    that matched. The SDKs refuse a step a delete or an update would drop,
    as Rust does.
  - `limit` or `offset` before `list` was dropped without a word, and
    `list` paged every row. Both are refused.
  - A condition ending in a `-- comment` hid what the builder wrote after it.
  - The Bun, Python and Go builders counted a parenthesis inside quotes or
    a comment.
  - A statement holding a NUL ran only what came before it. It is `invalid`.
  - Two statements in one text failed `internal`; they are `invalid`, and
    the error says a batch runs several.
  - A column whose declared type, in a file another program wrote, is not
    UTF-8 panicked out of the read. It is `invalid`.
  - A database named as Windows names a device, `con`, `nul`, `com1`, is
    refused on every platform, and a restore on Windows refuses a backup
    that holds one before it writes anything.
- **Wire and the server**
  - A `read` token made files and names (above).
  - A transaction over the wire kept every call it queued without a bound,
    and a call that did not decode rolled it back as though the client had
    left.
  - `kv.take` and `kv.delete` took a `ttl`, and a read's ETag had to match
    with its quotes and its case.
  - Under Node on Windows, a private child's or an MCP server's answer
    could stop part way, when a write to the pipe took no byte. The write
    goes on.
  - A private child whose answers could no longer be written stayed up.
  - The command line and MCP sent again a job or an event with no id whose
    answer was lost, which wrote it twice. They say `outcome unknown`.
  - `tinystore logs` and `events list` show a stored line as the console
    does, its further lines indented below it.
- **KV**
  - A key written with a `ttl` of zero was gone at once and answered that
    it was written. It is refused.
  - A value `Some(None)` or `Some(())` read back as `None`. It is refused.
  - An idle key's renewal could bring back a key that had already expired.
- **Jobs**
  - A queue of jobs added without an id listed as empty. `list` and `all`
    give them after the jobs with ids (contract JOB-13).
  - A page of jobs in one state could be empty or short with a `next`. It
    holds its `limit` (contract JOB-14).
  - A job whose value no longer reads stopped `all`. It goes on past it,
    giving an error that names the job.
  - `update` of a job waiting for a retry kept the steps of its old value.
  - A worker's or a schedule's `stop` from one of its own handlers waited
    for itself.
  - A retry or a snooze outside the years 1 to 9999 read as a parked job;
    a repeat, a rate or a timeout too long overflowed. Both are refused.
  - An awaited `claim` dropped before it answered left its job leased to
    nobody.
- **Blobs**
  - A database's transaction whose commit's outcome was unknown removed the
    bytes it put, where its row had committed.
  - A rollback that could not remove its bytes left their id to the next
    file, whose bytes maintenance then removed.
  - The scrub stopped for good at a file the disk would not read. It marks
    it damaged and goes on, and passes over one another program holds.
- **Backup**
  - A backup whose process died left its snapshot, a copy of the store, in
    the store's directory for good. The next open removes it.
  - A restore whose process died left half a store that opened as though
    whole. It refuses to open and says to restore again.
  - A backup whose manifest passed 64 MiB did not restore.
  - A backup did not look at the free disk, and over the wire it waited for
    a client that took nothing for ever.
- **Search**
  - A row SQLite removed for a `replace` stayed in its table's index.
  - A damaged search.db panicked; it answers `corrupt`.
- **Records**
  - The events of one `appendAll` without a time got one time, and more
    than a page of them did not read.
  - On Windows a page several windows fill read some events again.
- **Metrics**
  - A read's page or an aggregate's page could hold nothing and still have
    a `next` (contract MET-22).
- **Config**
  - A config's errors and `Debug` printed a TOML line, a `.env` line, an
    environment's variables and a value of a map or a list, secrets in
    them.
  - Another program's kept change of a live map holding a secret changed
    that secret while the program ran.
- **Console**
  - A message, an event's name, a value or a source could write escape
    sequences, carriage returns or forged lines to the terminal.
- **MCP**
  - `sql_query` answered the first 200 rows of more as though they were
    all. It is refused.

## Install

```sh for=bun
bun add @tinyshed/tinystore@0.8.0
npm install @tinyshed/tinystore@0.8.0
```

```sh for=python
pip install tinyshed-tinystore==0.8.0
```

```sh for=go
go get tinyshed.org/tinystore@v0.8.0
```

```sh for=rust
cargo add tinystore@0.8.0
cargo install tinystore-cli@0.8.0
```

0.8.0 changes no table of a store's files, so 0.7.1 and 0.8.0 open each
other's stores. A read token reads only, and drafts and each half's score
come, where the core runs: a program that reaches a server gets them once the
server is 0.8.0. The server image is `ghcr.io/tinyshed/tinystore:0.8.0`.

Every commit since 0.7.1 is in the
[GitHub release](https://github.com/tinyshed/tinystore/releases/tag/v0.8.0).
