Skip to content

perf(devtools): ingest write-amplification measurement probe (#1851) - #1900

Merged
Sinity merged 2 commits into
masterfrom
feature/perf/ingest-amplification-measurement-1851
Jun 15, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/perf/ingest-amplification-measurement-1851

Conversation

@Sinity

@Sinity Sinity commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

Adds devtools ingest-amplification-probe — a deterministic, host-independent measurement of per-tier write bytes per live-ingest batch, establishing the post-fix baseline for #1851 (slices 1-2/4). Additive tooling; no production ingest/daemon/storage code touched.

Problem

#1851 wanted the amplification not just fixed (#1895) but measured and attributed, with a repeatable artifact comparable across PRs. There was no such measurement.

Solution

devtools/ingest_amplification_probe.py (new) bootstraps a fresh 5-tier archive in an env-isolated temp dir (XDG_DATA_HOME + POLYLOGUE_ARCHIVE_ROOT — never touches real data), builds a deterministic synthetic corpus, ingests N single-session append batches through the existing public parse_sources_archive path (read-only use), and after each batch attributes bytes via PRAGMA page_count * page_size + WAL size per tier DB plus the blob store. Emits a stable JSON report (per-batch + per-tier deltas, amplification ratios, per-component shares). Registered as a CommandSpec.

Key finding: on the parse_sources_archive path the raw payload is not materialized to source.db/blob (only a 32-byte hash + small rows) — the full blob is written by the daemon's lease path. So this probe measures the parsed-index durable footprint vs raw wire payload (~0.8–1.0× post-fix, 100% in index.db); blob_store is kept as an attributed component (shows 0 here rather than hiding it).

Verification

devtools test tests/unit/devtools/test_ingest_amplification_probe.py   # 5 passed
devtools test test_command_catalog test_cli_wrapper                    # 11 passed
devtools verify --quick   # exit 0

Deterministic: two runs produce byte-identical JSON.

Ref #1851

Sinity and others added 2 commits June 15, 2026 14:14
Problem: #1851's targeted-FTS-repair fix for daemon live-ingest write
amplification has landed, but the issue still wants a deterministic,
repeatable measurement artifact to establish the post-fix baseline and
compare future changes. There was no way to attribute per-tier write
bytes per ingest batch.

What changed: new additive devtools command `ingest-amplification-probe`
plus its measurement module and tests. It builds a deterministic
synthetic fixture corpus (one session per file) under a private temp dir,
ingests N single-session append batches through the existing public
batch-ingest path (`parse_sources_archive`, unmodified), and attributes
bytes written per archive component after each batch using
`PRAGMA page_count * PRAGMA page_size` plus on-disk WAL size for each tier
DB (source/index/embeddings/user/ops) and the content-addressed blob
store. Emits a stable, host-independent JSON report: per-batch and
per-component byte deltas plus a summary with bytes-per-payload-byte
amplification ratios. No wallclock thresholds — every value is a byte
count or derived ratio, reproducible for a given SQLite build + seed.

Does not change any production ingest/daemon/storage code.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 55 minutes and 34 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9ecd2bbd-2af2-4b8b-aa08-76074c5d4c89

📥 Commits

Reviewing files that changed from the base of the PR and between a7f7ce5 and 7221b8c.

📒 Files selected for processing (4)
  • devtools/command_catalog.py
  • devtools/ingest_amplification_probe.py
  • docs/devtools.md
  • tests/unit/devtools/test_ingest_amplification_probe.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/perf/ingest-amplification-measurement-1851

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions Bot pushed a commit that referenced this pull request Jun 15, 2026
@Sinity
Sinity merged commit bbbc20d into master Jun 15, 2026
12 checks passed
@Sinity
Sinity deleted the feature/perf/ingest-amplification-measurement-1851 branch June 15, 2026 12:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7221b8cfc6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread devtools/ingest_amplification_probe.py Resolved
@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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