Skip to content

Unify the mapped-file format across C#, C++ and Rust - #134

Merged
konard merged 5 commits into
mainfrom
issue-101-cd0e917e6967
Nov 29, 2026
Merged

konard merged 5 commits into
mainfrom
issue-101-cd0e917e6967

Conversation

@konard

@konard konard commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Fixes #101.

Changes

  • Define one headerless, native-endian mapped-file format for C#, C++ and Rust. The default working file reserves whole pages and a successful close leaves exactly the stored bytes. Older page-padded files still count every complete element, including zero values.
  • Make C++ Close() flush, unmap and truncate to UsedCapacity. C# keeps its existing dispose behavior and stops allocating an extra page on aligned reopen.
  • Make Rust close and Drop remove spare capacity. Typed open and adopt_stored report incomplete elements as invalid data. Rust retains the original bytes when a caller adopts only part of an existing file and reports an error if truncation would invalidate an independently owned view.
  • Pin the Rust implementation, documentation and tests through the existing submodule. Rust diff · Related discussion

Reproduction and verification

  • Rust. Write three u64 values using FileMapped and close it. The close regression test found 4,096 bytes on the previous release and 24 bytes with the fix. The partial-element regression test also failed on the previous release and passed with the fix.
  • C++. Reserve a mapped file and leave its used length at zero. The fixture found a nonempty file after the previous implementation closed it and an empty file with the fix.
  • C#. Reopen a two-page file. The previous implementation reserved three pages. The new byte-length regression covers both sides of the page boundary and verifies that the two-page file reserves exactly two pages.

The fixture check writes empty, short, page-aligned and cross-page files in all three languages. Every reader opens every writer's files and checks the logical size, values, and final bytes. All nine combinations passed locally. Fixture commands

The 67 focused Rust tests passed locally and cover explicit close, drop, legacy input, partial elements, resize failures and mapper behavior. GitHub Actions runs the fixture and checks Rust on Linux and Windows. Workflow runs

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #101
@konard konard self-assigned this Nov 29, 2026
@konard konard changed the title [WIP] Uniform on-disk format: C# truncates mapped files to UsedCapacity bytes, mem-rs keeps whole pages Unify the mapped-file format across C#, C++ and Rust Nov 29, 2026
@konard
konard marked this pull request as ready for review November 29, 2026 17:22
@konard

konard commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

Working session summary

PR #134 implements issue #101 and is ready for review. C#, C++, and Rust now share a headerless, native-endian format. They reserve whole pages by default while open and truncate to the stored byte length on successful close. Rust rejects trailing partial elements on typed reopen, and the PR pins the Rust changes through the existing submodule.

All nine writer–reader combinations and all seven PR checks passed, including the C++ suite, Rust tests on Linux and Windows, and Codacy. The regression tests reproduced the previous failures and passed with the fix. CI results

The PR remains open. No review feedback arrived during the 15-minute review window. Total elapsed time was about 40 minutes.


This summary was automatically extracted from the AI working session output.

@konard

konard commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: GPT-6.2 Sol
  • Provider: OpenAI
  • Public pricing estimate: $3.790368

📊 Context and tokens usage:

  • 232.1K / 272K (85%) input tokens, 59.8K / 128K (47%) output tokens

Total: (232.1K + 9.8M cached) input tokens, 59.8K output tokens, $3.790368 cost

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-6.2-sol
  • Thinking level: xhigh (~31999 tokens)
  • Model: GPT-6.2 Sol (gpt-6.2-sol)

📎 Log file uploaded as Gist (840KB)


This AI session has ended. Monitoring of this pull request continues. Feel free to review and add feedback while checks are running.

@konard
konard merged commit ec64227 into main Nov 29, 2026
7 checks passed
@konard

konard commented Nov 29, 2026

Copy link
Copy Markdown
Member Author

🎉 Auto-merged

This pull request has been automatically merged by hive-mind.

  • All CI checks have passed

Linked issues

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.

Uniform on-disk format: C# truncates mapped files to UsedCapacity bytes, mem-rs keeps whole pages

1 participant