Skip to content

release: v0.2.5817 — reader.md auto-prepend + perf + security#490

Merged
justrach merged 2 commits into
mainfrom
release/v0.2.5817
May 21, 2026
Merged

release: v0.2.5817 — reader.md auto-prepend + perf + security#490
justrach merged 2 commits into
mainfrom
release/v0.2.5817

Conversation

@justrach
Copy link
Copy Markdown
Owner

TL;DR

v0.2.5817 ships reader.md: a hash-stable, agent-authored codebase map auto-prepended to `codedb_context` responses. Plus all of v0.2.5816's fixes (perf + security), plus three new codedb_context enhancements (inline symbol bodies, callers section, task-length gate).

Bundled

From release/v0.2.5816:

New on this branch:

  • `src/reader_md.zig` — parses YAML frontmatter, recomputes blake2b over source_files, returns ready/stale/missing/malformed
  • `handleContext` integration — auto-prepends `.codedb/reader.md` body when source_hash matches, with task-length gate (skip on ≤80 chars)
  • Inline symbol bodies — when ≤3 symbol_definitions found, inline ~6 lines of each
  • Callers section — pre-surfaces non-test execution sites for the same symbols
  • 3 P1 security guards for reader.md (path-traversal, source_files cap, loc_actual cap)
  • Golden blake2b roundtrip test locks the algorithm against drift

Performance vs v0.2.5815 (Sonnet 4.6 sub-agents, n=3 each)

Task main median calls exp median calls Δ
T1 flask "find before_request decorator" 5 4 −1
T2 regex "where is pattern compiled" 13 7 −6
T3 react "passive effects flush" 13 10 −3

Deterministic microbench (PR #485):

Query v0.2.5815 v0.2.5817 speedup
`Suspense` regex p50 2.82 ms 0.18 ms 15.6×
`useState` regex p99 16.57 ms 2.04 ms 8.1×

Security fixes

  • PR feat(cli): add codedb read subcommand #484 P1: `codedb read` CLI now rejects absolute paths, `..` traversal, sensitive files (`.env`, `id_rsa`, etc.). Anchors fallback reads to project root, not cwd.
  • This branch P1: `.codedb/reader.md` `source_files` now rejects absolute paths and `..` traversal. Caps source_files at 20 (DoS guard). Caps `loc_actual` at 240.

Reader.md lifecycle

```
agent → codedb_context

load .codedb/reader.md

blake2b(source_files) match? → prepend body
↘ "stale, regenerate" hint
↘ silent (missing)

(existing composer output follows)
```

Hash verification fires on every call (re-reads source files, recomputes blake2b — ~0.1 ms overhead).

Release artifacts

All 10 assets built locally, both macOS binaries notarized via Apple notary service (Accepted, gatekeeper source=Notarized Developer ID), linux smoke-tested via docker linux/amd64.

binary sha256
`codedb-darwin-arm64` `dea15a25a088f3b05d620e7a119377d09703c4e73512e35479819542c6c763c6`
`codedb-darwin-x86_64` `8fbea180597a7a8d07bb185aea107c290c3ebd23c2c3322781c1789b423320c2`
`codedb-linux-x86_64` `fb1d263b5847c6019a644e9dfbedbc9decaae418eac6f9fee80df7cc11b4d9e7`

What's deferred (not blockers)

From the Sonnet 4.6 critical-review pass:

  • I04 schema_version not validated (cosmetic — only matters at format v2)
  • I05 reader.md not cached across calls (~0.1 ms per call; matters at scale)
  • I06 codedb_status doesn't surface reader.md state (small ergonomic gap)
  • I09 stale hint doesn't include previous source_files (UX polish)
  • I10 concurrent-write last-write-wins not documented
  • I11 cost-benefit gate for shallow workloads (closed by the task-length gate for codedb_context, but reader.md path still hits I/O on missing case)

All P1 review findings closed. P2 follow-ups remain for v0.2.5818+.

Test plan

  • `zig build test` — 485/490 pass (same 5 pre-existing /private/tmp path-policy failures)
  • Manual smoke: reader.md ready/stale/missing/malformed all behave correctly
  • Manual smoke: 4 P1 attack scenarios blocked (abs path, traversal, sensitive, oversize list)
  • All 3 binaries verified executable on their target platform
  • gatekeeper accepts both macOS binaries (source=Notarized Developer ID)
  • linux x86_64 binary runs cleanly under emulated docker
  • 9 sub-agent eval runs across 3 corpora — all correct, all show wins or ties vs main

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 502223 532496 +6.03% +30273 OK
codedb_changes 55706 56242 +0.96% +536 OK
codedb_deps 9281 9219 -0.67% -62 OK
codedb_edit 6738 5893 -12.54% -845 OK
codedb_find 61999 63948 +3.14% +1949 OK
codedb_hot 98782 104374 +5.66% +5592 OK
codedb_outline 300383 304104 +1.24% +3721 OK
codedb_read 96357 103213 +7.12% +6856 OK
codedb_search 146743 148298 +1.06% +1555 OK
codedb_snapshot 285602 301264 +5.48% +15662 OK
codedb_status 13232 14620 +10.49% +1388 NOISE
codedb_symbol 61179 61578 +0.65% +399 OK
codedb_tree 78385 91137 +16.27% +12752 NOISE
codedb_word 85485 89895 +5.16% +4410 OK

Copy link
Copy Markdown

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

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: 7fd3dd6306

ℹ️ 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 src/main.zig Outdated
Comment on lines +673 to +675
const cached = explorer.getContent(path, allocator) catch null;
const content_owned = if (cached) |c| c else blk: {
break :blk std.Io.Dir.cwd().readFileAlloc(io, path, allocator, .limited(10 * 1024 * 1024)) catch {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Enforce path-safety checks before CLI file reads

The new codedb read branch reads arbitrary user-supplied paths without the safety gates used by codedb_read in MCP (isPathSafe + watcher.isSensitivePath), and the fallback uses std.Io.Dir.cwd() directly. This allows traversal/secret reads such as codedb read ../.env (or absolute paths if provided), which bypasses the repository boundary and sensitive-file protections expected by this codebase.

Useful? React with 👍 / 👎.

justrach and others added 2 commits May 21, 2026 14:30
Bumps semver to 0.2.5816 and consolidates two follow-up fixes from
the v0.2.5815 cross-corpus eval:

- #484 feat(cli): add `codedb read` subcommand
- #485 fix(search): skip Tier 5 full-scan when trigram returned
       candidates

Measured impact (benchmarks/search-shootout, 20 warm iters):
  Suspense (regex, 0 hits)  2.82 ms → 0.14 ms  (20× faster)
  useState (regex)   p99   16.57 ms → 1.67 ms  (10× p99)
  useState (flask)          0.66 ms → 0.18 ms  (3.7× faster)
  React queries: unchanged ±noise; hit counts identical

Recall preserved on every query. Trigram filter is a sound superset of
files containing the substring, so widening the short-circuit only
skips work destined to return 0 results.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… security

Bumps semver to 0.2.5817. Bundles the v0.2.5816 perf+security release
(PRs #484, #485, #483, #486, #487) with the experiment/reader-md feature
that auto-prepends a hash-verified codebase map to codedb_context.

Highlights vs v0.2.5815:

  Performance (PR #485, deterministic microbenchmarks):
    Suspense regex p50:    2.82 ms → 0.18 ms  (15.6× faster)
    useState regex p99:   16.57 ms → 2.04 ms  (8.1× p99 reduction)

  CLI surface (PR #484):
    + codedb read <path> [-L FROM-TO] [--compact]
    + path-safety + sensitive-file guards
    + project-root anchoring (uses configured root, not cwd)

  codedb_context (NEW in 0.2.5817):
    + auto-prepends .codedb/reader.md when source_hash matches
    + inline ~6 lines of body for ≤3 symbol_definitions
    + new "## Callers" section pre-surfaces execution sites
    + skip-on-short-task gate (≤80 chars) to avoid overhead on narrow lookups

  reader.md security (this branch):
    + path-traversal blocked (no absolute / .. in source_files)
    + source_files capped at 20 (DoS guard)
    + loc_actual capped at 240 (body bloat guard)
    + golden blake2b roundtrip test

Eval (Sonnet 4.6, n=3 per task, vs v0.2.5815 main lineage):
  T1 flask median:   5 → 4  (-1)
  T2 regex median:  13 → 7  (-6)
  T3 react median:  13 → 10 (-3)

All 9 runs across the matrix returned correct answers. Branch wins on
median, mode, and best-case for every task.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justrach justrach force-pushed the release/v0.2.5817 branch from 7fd3dd6 to 049786e Compare May 21, 2026 06:30
@justrach justrach merged commit c420570 into main May 21, 2026
1 check passed
@justrach justrach deleted the release/v0.2.5817 branch May 21, 2026 06:31
@github-actions
Copy link
Copy Markdown

Benchmark Regression Report

Thresholds: 10.00% and 50,000 ns absolute delta

NOISE means the percentage threshold was exceeded, but the absolute delta was too small to fail CI.

Tool Base (ns) Head (ns) Delta Abs Delta (ns) Status
codedb_bundle 324465 319985 -1.38% -4480 OK
codedb_changes 31152 34399 +10.42% +3247 NOISE
codedb_deps 4905 4905 +0.00% +0 OK
codedb_edit 6101 5829 -4.46% -272 OK
codedb_find 41529 41766 +0.57% +237 OK
codedb_hot 54423 56865 +4.49% +2442 OK
codedb_outline 193256 201771 +4.41% +8515 OK
codedb_read 67044 60100 -10.36% -6944 OK
codedb_search 115631 123810 +7.07% +8179 OK
codedb_snapshot 251476 221164 -12.05% -30312 OK
codedb_status 10494 10277 -2.07% -217 OK
codedb_symbol 36457 36794 +0.92% +337 OK
codedb_tree 38543 34988 -9.22% -3555 OK
codedb_word 48506 49212 +1.46% +706 OK

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