Skip to content

perf(history): skip unchanged partial-tail reads and SQLite metadata rewrites - #7680

Merged
lidge-jun merged 10 commits into
lidge-jun:devfrom
luvs01:perf/history-unchanged-partial-tail
Oct 25, 2026
Merged

lidge-jun merged 10 commits into
lidge-jun:devfrom
luvs01:perf/history-unchanged-partial-tail

Conversation

@luvs01

@luvs01 luvs01 commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Avoid rereading an unchanged unterminated request-history ledger tail and rewriting the same SQLite metadata on every refresh. Retain one small observation per live database handle, keyed by path, exact bigint file revision, next offset and optional end offset; no ledger bytes are cached.

Keep expected-file identity checks before the skip and preserve the surrounding schema, quick-check, source identity and truncation gates. Clear observations on reset/source replacement and before a new attempt; publish a new observation only after successful ingestion and metadata updates with an unchanged final file revision.

Verification

Candidate a70ae65a14faa36da3029ce649339f839594ad7d normally merges dev@0aeaf0cb6b0a7c2f117d8c75f8fa396cf2ea6e39 and shared #7627 (f011a94be1b468b7b785cb54976d4cb4a9b6a563). Runtime and testRunnerBun are both pinned to 1.4.4. The PR remains based on dev.

Current candidate validation: Official native Windows Bun 1.4.4, CI=true bun test --isolate --timeout 60000, fresh processes for the history rebuild-worker and index files: 42 passed / 0 failed / 0 skipped / 1,688 assertions. Reference TypeScript, official Structure and skill-surface checks, and all 13 changed-file privacy/size/diff checks passed. All six units returned native exit 0 and complete child output; matching installed dependencies were reused without reinstalling.

Both change-owned blobs remain unchanged; the 11-file Bun baseline is shared with #7627.

Previously reported at c6261d671b709580ceea3ac2830303a3b7a27717: official Bun 1.4.4 on Windows passed 42 tests / 0 failures / 1,688 assertions in tests/usage/request-history-rebuild-worker.test.ts and tests/usage/request-history-index.test.ts. TypeScript, Structure, diff and privacy/size checks over both changed files passed; unrelated sparse-absent paths were not evaluated. The earlier isolated dependencies matched their frozen inputs without reinstalling. These results are historical, not refreshed-candidate validation.

Independent source review covered append/truncate/replacement, path/offset changes, reset, expected identity, failed reads and mutation during a read. Exact restored-mtime behavior, split UTF-8 and injected transaction/metadata failures were reviewed but not separately exercised by the new cases. Production callers do not wrap all ingestion in an outer rollback transaction; no broader durability guarantee is claimed.

Focused checks used the shared-worktree resource exception. Full-suite and native macOS/Linux coverage, benchmarks and final-head CI remain pending; earlier source-head CI is not current-merge success.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com

luvs01 and others added 7 commits October 23, 2026 21:25
Cache only successful stable partial-tail observations per database handle,
bound to exact file identity, nanosecond timestamps and read bounds.
Preserve index integrity gates, newline offsets and worker snapshot fences.
Add six focused regressions in the existing history worker suite.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 24, 2026
@lidge-jun
lidge-jun marked this pull request as ready for review October 25, 2026 06:46
@lidge-jun

Copy link
Copy Markdown
Owner

Integration evidence (owner decision decision:b607a677, approved): after #7627 landed the maintainer merged origin/dev into this branch, leaving only this PR's own change (history partial-tail ingestion (src/routing/history/ingest.ts)); independent gpt-6.1-sol review PASS at exact head 1aaf1ed. Exact-head PR CI run 40156531500 and exact-head ci.yml lane=all run 40156827556 (maintainer mirror branch at this SHA) both succeeded.

Static merge simulation on current dev ac65aa7 (this Mac): dev=ac65aa79246e69e2cc3b2d6707d1ee88fc1b880c base=323a5e11772c38c15b271d23c7696c5947bb97da pr_files= 2 overlap=[]; merge clean; install exit=0; gui install exit=0; tsc exit=0; tsc doctor exit=0; structure:check exit=0; privacy:scan exit=0; layout+ratchet guards exit=0 54 pass 0 fail ;

Merged by the triage manager as maintainer integration (MAINTAINERS.md, dev only) with green exact-head PR CI, an independent review PASS, and the owner's approval of this bundle.

@lidge-jun
lidge-jun merged commit 6728882 into lidge-jun:dev Oct 25, 2026
62 of 64 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-25T06:47:55.523400Z
We couldn’t complete this review. Comment @codex review to try again.
1aaf1ed Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants