Skip to content

docs(python): bring README + Counters docstring in sync with current API - #6

Merged
Xof merged 1 commit into
mainfrom
claude/python-docs-staleness-catchup
May 14, 2026
Merged

docs(python): bring README + Counters docstring in sync with current API#6
Xof merged 1 commit into
mainfrom
claude/python-docs-staleness-catchup

Conversation

@Xof

@Xof Xof commented May 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes seven specific documentation-staleness items in the Python binding, surfaced by a fresh API-vs-docs review against the current Rust side. The .pyi stubs, PyO3 wrapper, and exception mapping were already correct; only the human-readable docs had drifted since the spillway feature landed (2026-05-04).

What was stale (and why each fix matters)

# Where Stale Fix
1 python/README.md "Opening a database" cache_size=1024 (the old per-page kwarg) cache_max_bytes=8_388_608 (current per-byte kwarg). The old form raises TypeError if copied verbatim — most user-impacting bug here.
2 python/README.md operational-error table TransactionInProgressError row absent Added with explanatory text that it's currently unreachable (the v1 binding doesn't expose the runtime config setters that produce it)
3 python/README.md operational-error table SpillwayFullError row absent Added with explanatory text that it's currently unreachable (binding hard-codes spillway_max_bytes=0)
4 python/README.md Engine counters bullets fsync_calls: "two per commit" Three per commit post-spillway (pre-drain + main + superblock); see ARCHITECTURE.md ADR-5
5 python/README.md Engine counters example # commit cost: 2 (data + superblock) # commit cost: 3 (pre-drain + data + superblock)
6 python/README.md CacheFullError row + pages_allocated bullet "hard ceiling" terminology Pre-spillway terminology; the cache is now a strict bound. Reworded to match.
7 python/chisel/__init__.py Counters docstring fsync_calls: "two per commit" Same as #4

Out of scope (deliberate)

The PyO3 wrapper at python/src/db.rs::open() hard-codes spillway_max_bytes: 0 and drain_insertion: LruTail with a comment that says "deferred until the Rust side has shipped and stabilized." The Rust side has shipped and stabilized, so that comment is itself stale — but the decision of whether to expose spillway controls (and the three runtime config setters: set_cache_max_bytes/set_spillway_max_bytes/set_drain_insertion) is its own design call. That's a separate follow-up PR, not this one.

Test plan

  • grep -n 'cache_size=1024|two per commit|hard ceiling|commit cost: 2' python/README.md python/chisel/__init__.py python/chisel/chisel.pyi — 0 matches
  • python3 -c "import ast; ast.parse(open('python/chisel/__init__.py').read())" — syntax OK
  • Diff scope: 2 files, +9/-6, no code changes

Seven specific staleness items in the Python-binding documentation,
spread across two files. The .pyi stubs and the PyO3 wrapper were
already correct; only the human-readable docs had drifted since the
spillway feature landed (2026-05-04).

README.md fixes:

1. "Opening a database" snippet — replaced the old kwarg
   `cache_size=1024  # pages in the LRU` with the current
   `cache_max_bytes=8_388_608  # bytes`. The old form raises
   TypeError if a user copies the snippet verbatim.

2. Operational-error table — added two previously-undocumented
   rows that are already registered, in __all__, and in the .pyi:
   - TransactionInProgressError (reserved for future use; the
     v1 binding doesn't expose the runtime config setters that
     produce it)
   - SpillwayFullError (reserved for future use; spillway is
     currently hard-coded to 0 in the binding)

3. "Engine counters" bullet list — fsync_calls description was
   "two per commit (data pages, then superblock)"; post-spillway
   the no-spill commit cost is three (pre-drain flush + main
   pages flush + superblock).

4. "Engine counters" code-example comment — same "commit cost: 2"
   issue; now "commit cost: 3 (pre-drain + data + superblock)".

5. CacheFullError row + pages_allocated bullet — removed
   "hard ceiling" terminology. Pre-spillway the cache had an
   elastic 8x ceiling that could grow past cache_max_bytes;
   post-spillway the cache is a strict bound and overflow goes
   to the spillway sidecar (when enabled). Since the binding
   currently disables the spillway, CacheFullError fires at the
   strict cap; description now reflects that.

chisel/__init__.py fixes:

6. Counters docstring fsync_calls field description — same
   "two per commit" → "three per commit" fix as README #3.

7. (No __init__.py edit for pages_allocated; the docstring
   there is already terse and doesn't reference "hard ceiling".)

No code changes. Behavior is unchanged.

A follow-up will decide whether to expose spillway controls in
the binding's open() and add the runtime config setters
(set_cache_max_bytes / set_spillway_max_bytes / set_drain_insertion)
to PyChisel. The current "deferred until the Rust side has
stabilized" comment in src/db.rs is itself stale — the Rust side
HAS stabilized — but that decision is intentionally not bundled
with this docs catch-up.
@github-actions

Copy link
Copy Markdown

🚦 Bench results: PR vs main

⚠️ 1 regression(s) detected across 1 scenario/mode pair(s)

Scenario Mode Δ throughput Worst Δ
ycsb-a redb-strict +0.1% p99 +28.6% ⚠️
document-store chisel-strict +12.0%
document-store redb-strict -0.1%
document-store sqlite-strict +0.0%
mutation-log chisel-strict +17.6%
mutation-log redb-strict +0.3%
mutation-log sqlite-strict +3.1%
ycsb-a chisel-strict +15.1%
ycsb-a sqlite-strict -0.8%
ycsb-b chisel-strict +8.0%
ycsb-b redb-strict -0.1%
ycsb-b sqlite-strict -0.0%
Per-scenario detail (4 metrics × cells)

document-store

Mode Throughput p50 p95 p99
chisel-strict 3048 ops/s → 3413 ops/s (+12.0%) 20.3 µs → 19.4 µs (-4.4%) 1.01 ms → 913.7 µs (-9.8%) 1.89 ms → 1.73 ms (-8.0%)
redb-strict 4142 ops/s → 4139 ops/s (-0.1%) 11.1 µs → 10.9 µs (-1.5%) 531.7 µs → 523.3 µs (-1.6%) 2.14 ms → 1.88 ms (-12.2%)
sqlite-strict 5127 ops/s → 5128 ops/s (+0.0%) 19.1 µs → 19.0 µs (-0.4%) 403.5 µs → 408.1 µs (+1.2%) 1.17 ms → 1.16 ms (-0.5%)

mutation-log

Mode Throughput p50 p95 p99
chisel-strict 1342 ops/s → 1579 ops/s (+17.6%) 858.9 µs → 746.7 µs (-13.1%) 1.18 ms → 1.08 ms (-8.8%) 1.56 ms → 1.29 ms (-17.2%)
redb-strict 1802 ops/s → 1807 ops/s (+0.3%) 199.8 µs → 193.9 µs (-3.0%) 298.2 µs → 279.7 µs (-6.2%) 29.73 ms → 30.91 ms (+4.0%)
sqlite-strict 4614 ops/s → 4756 ops/s (+3.1%) 130.1 µs → 128.2 µs (-1.4%) 354.2 µs → 349.1 µs (-1.5%) 469.2 µs → 464.9 µs (-0.9%)

ycsb-a

Mode Throughput p50 p95 p99
chisel-strict 1883 ops/s → 2168 ops/s (+15.1%) 535.7 µs → 492.5 µs (-8.1%) 1.27 ms → 1.11 ms (-12.3%) 1.56 ms → 1.30 ms (-16.5%)
redb-strict 2680 ops/s → 2682 ops/s (+0.1%) 162.9 µs → 154.7 µs (-5.0%) 257.2 µs → 262.2 µs (+2.0%) 366.3 µs → 471.3 µs (+28.6%) ⚠️
sqlite-strict 149464 ops/s → 148228 ops/s (-0.8%) 6.9 µs → 6.9 µs (+0.2%) 8.7 µs → 8.8 µs (+0.9%) 11.1 µs → 10.6 µs (-4.4%)

ycsb-b

Mode Throughput p50 p95 p99
chisel-strict 18850 ops/s → 20351 ops/s (+8.0%) 6.5 µs → 6.4 µs (-1.5%) 541.9 µs → 487.7 µs (-10.0%) 1.11 ms → 989.8 µs (-11.0%)
redb-strict 26976 ops/s → 26954 ops/s (-0.1%) 2.5 µs → 2.5 µs (+1.3%) 160.4 µs → 159.4 µs (-0.6%) 237.1 µs → 242.4 µs (+2.3%)
sqlite-strict 184843 ops/s → 184822 ops/s (-0.0%) 5.4 µs → 5.4 µs (+0.2%) 7.5 µs → 7.4 µs (-0.5%) 9.6 µs → 9.6 µs (+0.3%)
Generated by chisel-bench-diff at 2026-05-14T16:28:05Z. Compares PR HEAD against main. Never blocks merge — signal, not gate. Thresholds: throughput 5%, p50 5%, p95 10%, p99 10%.

@Xof
Xof merged commit 09c6f59 into main May 14, 2026
8 checks passed
@Xof
Xof deleted the claude/python-docs-staleness-catchup branch May 14, 2026 17:44
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