Skip to content

Preserve input stores during plain export - #213

Merged
konard merged 5 commits into
mainfrom
issue-210-dd8476117a36
Nov 29, 2026
Merged

konard merged 5 commits into
mainfrom
issue-210-dd8476117a36

Conversation

@konard

@konard konard commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #210.

Plain --out exports in Rust, C#, and the JavaScript server CLI share the file lock for an initialized store and preserve the bytes and modification times of both the data and names files. Existing shared lock sidecars open with read access. Rust and JavaScript skip store serialization, and C# uses private copy-on-write mappings so allocator metadata updates stay in memory.

Store initialization, imports, mutation commands, and transaction recovery keep their exclusive write paths. The read-only mount case uses the existing flock sidecar and a writable output path. The JavaScript server package advances to 0.2.1, and the Rust and C# patch release notes use their respective release mechanisms.

The draft branch's placeholder .gitkeep was removed because it failed the repository-layout check at the JavaScript stage.

Reproduction

Run as an unprivileged Unix user.

work=$(mktemp -d)
mkdir "$work/state"
printf '(root: root root)\n' > "$work/input.lino"
clink --db "$work/state/bot.links" --in "$work/input.lino"
chmod 400 "$work/state/"*
chmod 500 "$work/state"
clink --db "$work/state/bot.links" --out "$work/export.lino"
cmp "$work/input.lino" "$work/export.lino"
chmod 700 "$work/state"

Verification

  • All 14 GitHub Actions workflows passed on 64da4417. PR checks
  • The new Rust, C#, and JavaScript export regressions failed before the fix. They now export a named link from a writable directory and with read-only inputs and lock sidecar on Unix. They compare the source bytes and fixed modification times.
  • Focused export, import, migration, and locking suites cover the write and recovery paths. Tests also exercise shared lock admission and the native lock open modes.
  • C# mapping tests exercise private-byte preservation across two growth steps, cleanup after a failed names open, and exclusive initialization when a names file is missing. The Ubuntu CI report exercised all 10 branches of the private mapping.
  • The Windows C# matrix exercised every new native lock-open line. The raw Windows report is retained separately from Codecov's Ubuntu upload. Windows coverage artifact
  • JavaScript server coverage passed 1,798 tests at 100% lines, branches, and functions on Node.js. Focused lock suites also passed on Bun and Deno.
  • Manual pre-commit checks covered staged file hygiene, repository JavaScript lint and tests, parity, Rust formatting and Clippy, C# formatting, and the tracked secrets scan. The pre-commit tool was unavailable. The commit uses the normal Git command.
  • Local dotnet format under SDK 10.0.112 reported whitespace in files identical to the base branch. The pinned SDK 10.0.403 passed the format check on this PR head.

Issue investigation and regression tests

GitHub's separate CodeQL comparison check is neutral because main retains the retired C# autobuild analysis category. The Security workflow passed, and all five current CodeQL configurations uploaded analyses with zero findings. The neutral comparison comes from the historical repository configuration. CodeQL comparison Security workflow

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

Issue: #210
@konard konard self-assigned this Nov 29, 2026
@konard konard changed the title [WIP] Plain export rewrites the input database and fails on read-only mounts Preserve input stores during plain export Nov 29, 2026
@konard
konard marked this pull request as ready for review November 29, 2026 00:43
@codecov-commenter

codecov-commenter commented Nov 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 89.47368% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ndation.Data.Doublets.Cli.Library/StoreFileLock.cs 0.00% 6 Missing ⚠️
....Data.Doublets.Cli.Library/ReadOnlyMappedMemory.cs 96.29% 1 Missing ⚠️
csharp/Foundation.Data.Doublets.Cli/Program.cs 95.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@konard

konard commented Nov 29, 2026 •

Copy link
Copy Markdown
Member Author

The follow-up covers private mapping growth, cleanup after a failed names open, and exclusive initialization when the names file is missing. Patch coverage rose to 89.47%. The Ubuntu artifact records all 10 branches and 26 of 27 lines in ReadOnlyMappedMemory. The remaining line supplies the name for a disposed-object error. Coverage follow-up Ubuntu coverage artifact

Program.cs is partially covered on the export admission condition. I verified exports with --embed-triggers, --tokens self, and separate token and trigger stores with read-only input files and directories. All three acquired shared locks and produced matching output while preserving the original bytes and modification times.

The C# Windows matrix executed every new native lock-open line. Codecov receives the Ubuntu report, and the matrix retains the Windows results as a separate artifact. Windows coverage artifact

@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: $8.973097

📊 Context and tokens usage:

  • 441.9K input tokens across requests (cumulative, larger than the 272K context window, so not one request's context), 88.9K / 128K (69%) output tokens

Total: (441.9K + 29.4M cached) input tokens, 88.9K output tokens, $8.973097 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 (1435KB)


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 34b33b6 into main Nov 29, 2026
111 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.

Plain export rewrites the input database and fails on read-only mounts

2 participants