Skip to content

Add performance and harness certification#29

Merged
TerminallyLazy merged 4 commits into
mainfrom
codex/performance-harness-certification-design
Jul 9, 2026
Merged

Add performance and harness certification#29
TerminallyLazy merged 4 commits into
mainfrom
codex/performance-harness-certification-design

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • add a repeatable scripts/certify-tree-ring.sh certification suite for local verification
  • batch JSONL import writes through SQLite while preserving duplicate/replace semantics
  • report integration markers with project vs home origins so harness readiness is explicit
  • document latest local install-size, import, recall, adapter, and Agent Zero certification results
  • simplify small code paths around defaults, welcome branching, and ring-mark sampling

Verification

  • cargo fmt --check
  • cargo test --locked
  • cargo clippy --locked --all-targets
  • cargo build --release --locked
  • git diff --check
  • sh -n scripts/certify-tree-ring.sh
  • TREE_RING_AGENT_ZERO_ROOT=/Users/lazy/a0-ready-test sh scripts/certify-tree-ring.sh

Certification Evidence

Latest local certification generated at 2026-07-09T02:42:24Z with Agent Zero plugin smoke enabled:

  • release binary: 6,104,272 bytes
  • project install with init: 6,032 KB
  • global install: 5,988 KB
  • CLI import: 10,000 memories in 5s, about 2,000/sec
  • 10k recall: avg 3.887 ms, max 6.740 ms
  • 30k recall: avg 8.300 ms, max 14.705 ms
  • DOX/Revolve adapter smokes: passed
  • integration scan marker-origin smoke: passed
  • Agent Zero plugin smoke: passed

Summary by CodeRabbit

  • New Features

    • Added a local certification workflow script for running checks, smokes, and performance validation in one place.
    • Integration scans now distinguish markers coming from the project vs. the user’s home config.
  • Bug Fixes

    • Improved integration output so marker details are shown more clearly in the CLI and TUI.
    • JSONL imports now handle large batches more efficiently while preserving existing import behavior.
  • Documentation

    • Expanded README and architecture docs with updated certification steps, workflow guidance, and latest performance results.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TerminallyLazy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f4879aab-9971-4401-8cc8-5b92e7125181

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4ab1b and d16317e.

📒 Files selected for processing (2)
  • crates/tree-ring-memory-cli/src/integrations.rs
  • crates/tree-ring-memory-sqlite/src/lib.rs
📝 Walkthrough

Walkthrough

This PR adds marker-origin tracking (project vs home) to integration detection, refactors SQLite JSONL import to batch writes for throughput, adds a new certification shell script and accompanying docs/plans/specs, and includes unrelated cleanup in ring-mark sampling, derived Default implementations, and a welcome-screen logo fix.

Changes

Certification, Marker Origin, and Batched Import

Layer / File(s) Summary
Integration marker origin model and detection
crates/tree-ring-memory-cli/src/integrations.rs
Adds IntegrationMarker/MarkerOrigin types, updates detect() to record project/home origins, adds format_markers, scan_integrations_with_home, and origin-aware tests.
Marker rendering wiring
crates/tree-ring-memory-cli/src/main.rs, crates/tree-ring-memory-cli/src/tui/render.rs
Updates CLI and TUI marker display to use format_markers instead of joining raw strings.
Batched SQLite JSONL import
crates/tree-ring-memory-sqlite/src/lib.rs
Refactors import_jsonl to batch-fetch existing IDs, classify inserts/replacements/skips, and bulk-write via put_many; adds existing_memory_ids, a chunk constant, a list_all prepare fix, simplified IN placeholder generation, and a duplicate-import test.
Certification script
scripts/certify-tree-ring.sh
New script running formatting/test/clippy/build checks, install and CLI smokes, marker-origin validation, import throughput and performance benchmarks, optional Agent Zero plugin smoke, and metrics/summary output.
Certification documentation
README.md, docs/architecture/rust-core-status.md, docs/superpowers/plans/*, docs/superpowers/specs/*
Documents the certification workflow, marker origin reporting, batched import behavior, and latest run metrics; adds implementation plan and design spec.

Code Simplification Cleanup

Layer / File(s) Summary
Ring-mark sampling geometry refactor
crates/tree-ring-memory-cli/src/ring_mark.rs
Introduces SamplingGeometry/SubPixelSample types, restricts layer_at to test-only, and updates sample_cell/sample_subpixel to use geometry-driven parameters.
Derived defaults and minor fixes
crates/tree-ring-memory-core/src/maintenance.rs, crates/tree-ring-memory-core/src/models.rs, crates/tree-ring-memory-cli/src/welcome.rs, crates/tree-ring-memory-core/src/import_export.rs
Replaces manual Default impls with derived Default, fixes welcome logo fallback rendering, and updates tests to use slice::from_ref.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.74% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a performance and harness certification workflow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/performance-harness-certification-design

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.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a comprehensive local certification suite (scripts/certify-tree-ring.sh), optimizes bulk JSONL imports in the SQLite store using transaction-backed batch writes, and enhances integration scanning to distinguish between project and home configuration markers. Review feedback focuses on further optimizing the bulk import logic by eliminating redundant vector allocations and cloning of MemoryEvents, as well as simplifying the marker sorting logic by deriving PartialOrd and Ord on the integration marker types.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines 455 to 478
let mut imported_events = Vec::new();
let mut batch_events = Vec::new();
for event in events {
if self.get(&event.id)?.is_some() {
if known_ids.contains(&event.id) {
if replace_existing {
self.put(&event)?;
batch_events.push(event.clone());
imported_events.push(event);
report.replaced_count += 1;
} else {
report.skipped_duplicate_count += 1;
}
} else {
self.put(&event)?;
known_ids.insert(event.id.clone());
batch_events.push(event.clone());
imported_events.push(event);
report.inserted_count += 1;
}
}
if !batch_events.is_empty() {
self.put_many(&batch_events)?;
}
for event in imported_events {
self.apply_supersedes(&event)?;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

In import_jsonl, both batch_events and imported_events contain the exact same set of events in the same order. By eliminating imported_events and iterating directly over batch_events after insertion, we can completely avoid cloning each MemoryEvent inside the loop. This significantly improves performance and reduces memory allocations during bulk imports.

        let mut batch_events = Vec::new();
        for event in events {
            if known_ids.contains(&event.id) {
                if replace_existing {
                    batch_events.push(event);
                    report.replaced_count += 1;
                } else {
                    report.skipped_duplicate_count += 1;
                }
            } else {
                known_ids.insert(event.id.clone());
                batch_events.push(event);
                report.inserted_count += 1;
            }
        }
        if !batch_events.is_empty() {
            self.put_many(&batch_events)?;
            for event in &batch_events {
                self.apply_supersedes(event)?;
            }
        }

Comment on lines +22 to +33
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct IntegrationMarker {
pub path: String,
pub origin: MarkerOrigin,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum MarkerOrigin {
Project,
Home,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Deriving PartialOrd and Ord on IntegrationMarker and MarkerOrigin allows us to sort markers directly using markers.sort() instead of writing a custom sort_by closure. Swapping the order of Home and Project in the MarkerOrigin enum ensures that Home is sorted before Project by default, preserving the original alphabetical sorting behavior.

Suggested change
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
pub struct IntegrationMarker {
pub path: String,
pub origin: MarkerOrigin,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum MarkerOrigin {
Project,
Home,
}
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)]
pub struct IntegrationMarker {
pub path: String,
pub origin: MarkerOrigin,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum MarkerOrigin {
Home,
Project,
}

Comment on lines +196 to +200
markers.sort_by(|left, right| {
left.path
.cmp(&right.path)
.then_with(|| left.origin.as_str().cmp(right.origin.as_str()))
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

With PartialOrd and Ord derived on IntegrationMarker and MarkerOrigin, we can simplify the sorting logic to a single markers.sort() call. This eliminates the custom sorting closure and avoids manual string conversions and comparisons.

    markers.sort();

@TerminallyLazy TerminallyLazy merged commit 7d00800 into main Jul 9, 2026
1 of 2 checks passed
@TerminallyLazy

Copy link
Copy Markdown
Owner Author

Addressed the Gemini review feedback in d16317e: removed the duplicate import event vector/per-event clone from JSONL import, applied supersedes from the same batch, and simplified integration marker sorting with derived ordering. Local focused tests, full locked tests, fmt, Clippy, and remote Rust checks pass.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
scripts/certify-tree-ring.sh (1)

175-181: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Second-granularity timing can misrepresent import throughput.

import_seconds is derived from date +%s (1-second resolution) and floored to 1 when the measured delta is 0. For the default 10,000-record import this is fine, but if TREE_RING_CERT_IMPORT_COUNT is lowered for a quick local run, sub-second imports get rounded to "1 second," producing an artificially low (or occasionally misleading) events/s figure against the 1500/s gate.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/certify-tree-ring.sh` around lines 175 - 181, The throughput check in
the import benchmark uses second-level timing via the import_start/import_end
date +%s calculation, which can distort results for fast local runs. Update the
timing logic in the benchmark/import section to use higher-resolution elapsed
time (for example, milliseconds or another sub-second source) and compute
import_rate from that precise duration instead of flooring zero-second runs to
1. Keep the existing import_seconds/import_rate gating around the import command
and fail threshold, but make the measurement accurate for small
TREE_RING_CERT_IMPORT_COUNT values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/tree-ring-memory-sqlite/src/lib.rs`:
- Around line 450-476: The import path in the event handling logic is cloning
each accepted event twice by maintaining both `batch_events` and
`imported_events` with identical contents. Update the import flow around the
existing `existing_memory_ids`, `put_many`, and `apply_supersedes` logic to
build only one owned collection for the accepted events, pass that collection as
a slice to `put_many`, and then reuse it for the supersedes application so the
extra `batch_events` clone is removed.

---

Nitpick comments:
In `@scripts/certify-tree-ring.sh`:
- Around line 175-181: The throughput check in the import benchmark uses
second-level timing via the import_start/import_end date +%s calculation, which
can distort results for fast local runs. Update the timing logic in the
benchmark/import section to use higher-resolution elapsed time (for example,
milliseconds or another sub-second source) and compute import_rate from that
precise duration instead of flooring zero-second runs to 1. Keep the existing
import_seconds/import_rate gating around the import command and fail threshold,
but make the measurement accurate for small TREE_RING_CERT_IMPORT_COUNT values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04f38594-2289-4a39-98ce-b7cbbd0f3c11

📥 Commits

Reviewing files that changed from the base of the PR and between 24679c3 and 3e4ab1b.

📒 Files selected for processing (14)
  • README.md
  • crates/tree-ring-memory-cli/src/integrations.rs
  • crates/tree-ring-memory-cli/src/main.rs
  • crates/tree-ring-memory-cli/src/ring_mark.rs
  • crates/tree-ring-memory-cli/src/tui/render.rs
  • crates/tree-ring-memory-cli/src/welcome.rs
  • crates/tree-ring-memory-core/src/import_export.rs
  • crates/tree-ring-memory-core/src/maintenance.rs
  • crates/tree-ring-memory-core/src/models.rs
  • crates/tree-ring-memory-sqlite/src/lib.rs
  • docs/architecture/rust-core-status.md
  • docs/superpowers/plans/2026-07-09-tree-ring-performance-harness-certification-implementation-plan.md
  • docs/superpowers/specs/2026-07-09-tree-ring-performance-harness-certification-design.md
  • scripts/certify-tree-ring.sh
💤 Files with no reviewable changes (1)
  • crates/tree-ring-memory-cli/src/welcome.rs

Comment thread crates/tree-ring-memory-sqlite/src/lib.rs Outdated
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