Skip to content

Harden SQL persistence and parser integrity - #2

Merged
hskl18 merged 2 commits into
mainfrom
portfolio-polish/sql-storage-integrity
Jul 12, 2026
Merged

hskl18 merged 2 commits into
mainfrom
portfolio-polish/sql-storage-integrity

Conversation

@hskl18

@hskl18 hskl18 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace undefined fixed-width writes with explicit zero-padded 100-byte slots
  • reject wrong row arity, oversized values, duplicate schemas, invalid projections, missing tables, partial rows, and malformed metadata before data is treated as valid
  • make unmatched quotes, unknown characters, and malformed parentheses fail closed
  • preserve CLI sessions by converting storage and command exceptions into specific user-facing errors
  • fix empty B+ tree iteration, const lookup, and table assignment metadata
  • add deterministic parser, storage, CLI, and B+ tree property coverage
  • add a Linux ASan/UBSan CI gate alongside the Linux/macOS release matrix
  • replace the stale design note with explicit format, index, and product limitations

Reproduced failures

Before this change:

  • select * from does_not_exist terminated the CLI with an uncaught char const* exception
  • a three-value insert into a two-column table created two physical records and corrupted the persisted row layout
  • a malformed closing parenthesis could degrade into an unfiltered select
  • every short fixed-width write asked the stream to read 100 bytes from a smaller string allocation
  • iterating an empty B+ tree after erasing its final key caused an out-of-bounds read

Verification

  • fresh Release configure and build with warnings as errors
  • 3/3 CTest targets pass in Release
  • fresh AddressSanitizer and UndefinedBehaviorSanitizer configure and build
  • 3/3 CTest targets pass under ASan/UBSan
  • CLI end-to-end reproduction now reports errors, continues the session, and preserves the valid row
  • fixed-seed B+ tree coverage compares insertion, lookup, bounds, copy, assignment, iteration, shuffled erase, and missing-key behavior against std::set
  • exact schema metadata size tests cover a trailing byte and a truncated file
  • git diff --check
  • independent blocker review completed with no remaining blockers

Compatibility and limits

  • The existing fixed-width on-disk layout is preserved.
  • Values are still strings and range comparison remains lexical.
  • The engine still has no transactions, concurrency control, write-ahead log, joins, updates, deletes, optimizer, or crash-recovery guarantee.
  • B+ tree range bounds currently scan the linked leaf sequence and are not presented as logarithmic query-planning evidence.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 59 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: 6d2113be-4285-4f38-abe6-ff7390ddcf76

📥 Commits

Reviewing files that changed from the base of the PR and between d8c467f and 1e4a4c3.

📒 Files selected for processing (19)
  • .github/workflows/ci.yml
  • .gitignore
  • CMakeLists.txt
  • DESIGN.md
  • README.md
  • design.txt
  • includes/binary_files/file_record.cpp
  • includes/binary_files/file_record.h
  • includes/binary_files/utilities.cpp
  • includes/map/bplustree.h
  • includes/parser/parser.cpp
  • includes/sql/sql.cpp
  • includes/sql/sql.h
  • includes/table/table.cpp
  • includes/table/table.h
  • run_sql.cpp
  • tests/bplustree_tests.cpp
  • tests/parser_tests.cpp
  • tests/sql_tests.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch portfolio-polish/sql-storage-integrity

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.

@hskl18
hskl18 marked this pull request as ready for review July 12, 2026 17:48
@hskl18
hskl18 merged commit b53cc14 into main Jul 12, 2026
4 checks passed
@hskl18
hskl18 deleted the portfolio-polish/sql-storage-integrity branch July 12, 2026 17:48
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