Repository navigation
perf(codex): validate audit UTF-8 without round-trip Buffer copies - #7672
Conversation
Decode complete audit byte views with a fatal UTF-8 decoder while preserving BOM rejection, original record bytes, and foreign-file nonmutation. Remove per-row validation re-encoding. Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
…rk759-dev-bd5-20261024
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Bun defaults and role contract package.json, .github/actions/setup-project-bun/action.yml, .github/workflows/ci.yml, CONTRIBUTING.md, Dockerfile, docs-site/src/content/docs/contributing.md, structure/runtime.md |
The test-runner pin changes to 1.4.4, matching the shipped runtime. The related text retains separate runtime and test-runner roles and specifies a successful full cross-platform lane=all run on the exact candidate head for promotion. |
Runner resolution tests tests/ci-workflows/install-scripts.test.ts, tests/ci-workflows/ci-scope-gaps.test.ts, tests/test-layout-tooling.test.ts |
Tests expect the 1.4.4 pin and cover runner resolution when caller and pinned Bun versions match or differ, plus rejection of an incorrect override. |
Catalog Audit Record Decoding
| Layer / File(s) | Summary |
|---|---|
Decode and validate audit records src/codex/catalog/write-audit.ts, structure/codex-home.md, tests/codex-integration/codex-catalog-write-audit.test.ts |
Audit rows now use fatal UTF-8 decoding before JSON parsing. Tests cover compaction of complete records, rejection of malformed UTF-8 and BOM-prefixed rows, and foreign-owner refusal without file changes. |
Buffered Upload Early-Response Test
| Layer / File(s) | Summary |
|---|---|
Exercise early TLS responses tests/claude-integration/claude-picker-upload.test.ts |
The test fixture can send a 413 response before receiving the full request body. The buffered early-response test checks that the response flushed while the body was incomplete. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Possibly related PRs
- lidge-jun/opencodex#7627: Both PRs align the test-runner Bun pin with the shipped 1.4.4 runtime and retain independent runner-role validation.
- lidge-jun/opencodex#7606: That PR changes the shipped runtime pin to 1.4.4; this PR updates the test-runner pin to match it.
Merge Risk: 
Minimal · up to 7834a
-
The audit regression test covers the claimed failure, and no remaining issue is established that should delay merging.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title clearly and concisely describes the main implementation change in src/codex/catalog/write-audit.ts: validating audit UTF-8 without round-trip Buffer allocations. It matches the primary PR objective.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 6 files. (8 skipped: 8 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
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.
Comment @coderabbitai help to get the list of available commands.
|
✅ Deterministic PR hygiene checks passed. |
…7672-dev-0ae-7627-20261025
…7672-dev-0ae-7627-20261025
…native-audit-utf8 # Conflicts: # tests/claude-integration/claude-picker-upload.test.ts
|
Integration evidence (owner decision decision:e6895606, approved): independent gpt-6.1-sol review PASS at ebeebdf; the current head only adds merges of origin/dev (the author's #7627 merge, then the maintainer's dev merge after #7627 landed), so this PR's diff is again src/codex/catalog/write-audit.ts, its test and structure/codex-home.md. Exact-head PR CI run 40150118941 and exact-head ci.yml lane=all run 40150182583 (maintainer mirror branch at this SHA) both succeeded. Static merge simulation on current dev 5d995c9 (this Mac): dev=5d995c956dd970be3cb9fc1cad9cb78300060ba0 base=c2bcb529fa5762833aa32ef8ebd76c5b41b733f3 pr_files= 3 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. |
Summary
Validate catalog-audit lines with a fatal UTF-8
TextDecoderinstead of decoding and allocating another Buffer solely for a byte round trip. Preserve BOM characters withignoreBOM: trueso the existing JSON parser continues to reject BOM-prefixed records.Keep valid record bytes, CRLF handling, malformed/unterminated-tail classification, owner compaction and foreign-append refusal unchanged. Extend the existing audit regressions for invalid encodings, BOMs, valid replacement characters, escaped surrogates and non-mutating refusal.
Verification
7834a093157102f78ea4c28c7f354ee009b8f0fbpreserves the published change and mergesdev@0aeaf0cbplus the shared chore(test): align Bun runner with the 1.4.4 security baseline #7627 setup/CI change. Runtime and test runner both use Bun 1.4.4. The three change-owned files are preserved.CI=true:bun test --isolate --timeout 60000 tests/codex-integration/codex-catalog-write-audit.test.ts— 39 passed / 0 failed / 195 assertions.skipped; those Windows branches do not execute successful POSIX owner compaction. Native macOS compaction, the complete native platform matrix and performance measurements remain unverified.7834a093157102f78ea4c28c7f354ee009b8f0fb: 17 successful jobs / 6 conditionally skipped jobs, including aggregateci. Skipped platform jobs are not native-platform execution evidence.Checklist
Co-authored-by: luvs01 27862058+luvs01@users.noreply.github.com
Summary by CodeRabbit