feat: Implement fileMenu verbs with v7 save format and db corruption fixes#391
Conversation
… headless mode Implement the missing fileMenu verbs needed for system.startup.startupScript and userland.firstRootRun() to complete successfully: - fileMenu.open(path, hidden): Opens guest database, adds to hodblist, mounts root table into system.compiler.files for bracket syntax access - fileMenu.close(): Closes current target guest database (via langgettarget) - fileMenu.closeall(): Closes all guest databases Convert menu verb stubs from returning not-implemented errors to safe no-ops so webEdit.init() and webEdit.buildServerSubMenu() do not fail: - menu.addSubMenu, addMenuCommand, deleteSubMenu, deleteMenuCommand -> true - menu.remove, setScript, setCommandKey -> true - menu.getScript -> empty string, getCommandKey -> null char - menu.buildMenuBar, clearMenuBar, install -> true (no-ops) - menu.isInstalled -> false (correctly: nothing installed headless) - menu.zoomScript -> kept as stub (requires window) Add error messages to fileMenu.open failure paths so errors are catchable by UserTalk try/else blocks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review: fileMenu.open/close/closeall and menu verb no-opsThis PR implements critical fileMenu verbs and converts menu verbs to safe no-ops for headless mode. The implementation is well-structured with excellent documentation. Here's my detailed review: ✅ Strengths1. Excellent Resource Management
2. Robust Error Handling
3. Idempotency & No-Op Safety
4. Comprehensive Documentation
5. Strong Test Coverage
🔍 Issues & Concerns1. Critical: Potential Resource Leak in
|
| Category | Status |
|---|---|
| Code Quality | |
| Test Coverage | ✅ Excellent |
| Documentation | ✅ Outstanding |
| Error Handling | ✅ Robust |
| Resource Management | |
| Performance | ✅ Appropriate |
| Security | ✅ Acceptable for current phase |
🎬 Recommendation
Request Changes - Address issue #1 (resource leak on mount failure) before merge. Issues #2-4 are minor and could be addressed in follow-up work, but #1 could cause hard-to-debug database orphaning.
Once the mount failure path is clarified/fixed, this is ready to merge. Excellent work on a complex feature with great documentation! 🚀
🤔 Questions for Author
- What is the intended behavior when
hashtableassign()fails infilemenu_open()? Should the operation fail completely? - Is there a documented pattern for when to set
cancoonglobals = nilrelative toodb_guard_exit()? - Should
menu.zoomScriptbe a no-op for consistency, or is keeping it as an error intentional? - What is the specific interop issue blocking the 7 skipped tests?
Code Review - PR #391: feat: Implement fileMenu.open/close/closeall and menu verb no-opsSummaryThis PR implements critical file menu verbs (fileMenu.open, fileMenu.close, fileMenu.closeall) and converts GUI-specific menu verbs to no-ops for headless mode. The implementation is well-structured with comprehensive documentation and testing. Overall quality is EXCELLENT with only minor recommendations. Strengths1. Excellent Documentation
2. Proper Error Handling
3. Context Guard Usage
4. Idempotent Operations
5. Comprehensive Test Coverage
6. Menu Verb No-Ops
Issues & RecommendationsMinor: Resource Leak on odbCloseFile Failure (Line 384)Location: tests/headless_filemenu_verbs.c:380-384 Issue: If odbCloseFile() fails, the function returns early without closing the OS file handle, unlinking from hodblist, or disposing the handle. Recommendation: Continue cleanup even if odbCloseFile fails, since the file handle and memory still need cleanup. Track error but always clean up resources. Severity: Low (odbCloseFile failure is rare, but resource leaks accumulate) Minor: fileMenu.closeall Continues After Close Failure (Line 445)Location: tests/headless_filemenu_verbs.c:445-449 Issue: If one database fails to close, the function continues and returns true, hiding the failure. Recommendation: Track whether any failures occurred and return appropriate status (e.g., boolean all_succeeded variable). Severity: Low (design choice - continuing may be desirable to close as many as possible) Question: fileMenu.close Target Matching (Lines 424-428)Question: Does equalstrings() handle path normalization issues like /tmp/test.root7 vs /private/tmp/test.root7 (macOS symlink) or relative vs absolute paths? Recommendation: Consider using equalfilespecs() instead of string comparison after getting the target filespec. Severity: Low (may only affect edge cases with symbolic links or relative paths) Observation: 7 Skipped TestsSeveral integration tests are skipped due to fileMenu.open / db.* path interop issues (skip reason: db.setvalue path lookup may not match fileMenu.open filespec). Recommendation: This should be tracked as follow-up work to investigate path matching between the two systems and unskip tests once resolved. Severity: Medium (limits usefulness of fileMenu.open if db.* verbs cannot access the database) Security, Performance, TestingSecurity: No concerns (no injection vulnerabilities, no buffer overflows, proper resource cleanup) Performance: No concerns (O(n) operations are expected, no memory allocation issues) Testing: Excellent coverage with 22 new integration tests (15 pass, 7 skip with documented reasons). Unit tests pass (pre-existing failure unchanged). Integration tests: 0 new failures. Code QualityAdherence to Project Standards:
Recommendations SummaryMust Fix (Before Merge): None - all issues are minor Should Fix (Recommended):
Nice to Have (Follow-up): VerdictRecommendation: APPROVE with minor fixes This is HIGH-QUALITY WORK that:
The two resource management issues are edge cases (odbCloseFile failures are rare) but should be addressed for production robustness. Suggested merge path:
Excellent work overall! Review generated by Claude Code |
…ion bugs - Add fileMenu.save() for system root (no params) and guest databases (path param) - Add v7 menu save format (mesavemenustructure_v7) with 64-bit BE addresses - Add v7 menu pack format (mepackmenustructure_v7) for memory packing - Add dispatchers routing to v7 or legacy based on db_format_mode - Remove conditionallongswap from save/setup paths (kept in v6 load path) - Fix tmpstack contamination: nil currenthashtable in odb_guard_enter - Fix db.new() global state corruption with odb_context_guard in dbnewverb - Fix struct alignment with #pragma pack(2) for hodblist record - Fix save param detection using langgetparamcount instead of tree walk - Guard odbSaveFile call with odb_context_guard in filemenu_save_guestdb - Add odbGetRootVariable() public API - Add ensure_external_in_memory for normal (non-migration) save path - Unskip all 7 filemenu integration tests (22/22 pass) - Clean up test tmp dir at start of integration test run Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review: PR #391 - fileMenu verbs with v7 save format and db corruption fixesExecutive SummaryThis PR implements critical fileMenu verb functionality (open/close/closeall/save) for headless guest database management, adds v7 64-bit menu structure save support, and fixes several database corruption bugs. The implementation demonstrates excellent engineering practices with comprehensive documentation, robust error handling, and strong test coverage. I found one minor issue and several recommendations for enhancement, but the code is production-ready as-is. Recommendation: ✅ APPROVE with optional enhancements Critical Fixes - Well Executed ✅1. tmpstack Contamination Fix (db_format.c:164-174)Status: ✅ EXCELLENT /* Nil out currenthashtable to prevent tmpstack contamination.
* Without this, copyvaluerecord during migration pushes handles onto
* the caller's local scope tmpstack via pushtmpstackvalue. When those
* handles are later freed by the guest database, cleartmpstack tries
* to double-free them — heap corruption. Setting nil makes
* pushtmpstackvalue return early (langtmpstack.c line 103). */
currenthashtable = nil;Why this is correct:
No issues found. 2. Struct Alignment Fix (tests/headless_filemenu_verbs.c:33-44)Status: ✅ CRITICAL FIX /* MUST use #pragma pack(2) to match dbverbs.c layout, otherwise odb field
* offset differs and db.setvalue/getvalue dereferences a corrupted handle. */
#pragma pack(2)
typedef struct tyodblistrecord {
struct tyodblistrecord **hnext;
tyfilespec fs;
hdlfilenum fref;
boolean flreadonly;
odbref odb;
} tyodbrecord_local, *ptrodbrecord_local, **hdlodbrecord_local;
#pragma options align=resetWhy this is critical:
No issues found. 3. db.new() Global State Corruption Fix (dbverbs.c:728-742)Status: ✅ CORRECT {
odb_context_guard guard;
odb_guard_enter (&guard);
fl = odbnewfile (odbrec.fref);
closefile (odbrec.fref);
odb_guard_exit (&guard);
}Why this is correct:
No issues found. New Functionality Review4. fileMenu.open() Implementation (tests/headless_filemenu_verbs.c:247-362)Status: ✅ EXCELLENT Strengths:
All resource cleanup paths are correct. No leaks found. No issues found. 5. fileMenu.close() and closeall() Implementation (tests/headless_filemenu_verbs.c:375-497)Status: ✅ EXCELLENT Strengths:
Cleanup Order:
This order is correct - prevents use-after-free by unmounting before disposal. No issues found. 6. v7 Menu Structure (menupack.c:355-365)Status: ✅ WELL DESIGNED typedef struct tysavedmenuinfo_v7 {
uint16_t versionnumber; /* 2 bytes */
uint8_t _pad0[6]; /* 6 bytes padding to 8-byte boundary */
uint64_t adroutline; /* 8 bytes, big-endian on disk */
int64_t lnumcursor; /* 8 bytes, big-endian on disk */
uint32_t flags; /* 4 bytes, big-endian on disk */
uint32_t menuactiveitem; /* 4 bytes, big-endian on disk */
uint8_t _reserved[1024]; /* 1024 bytes reserved for future use */
} tysavedmenuinfo_v7;
_Static_assert(sizeof(tysavedmenuinfo_v7) == 1056, "v7 menu struct must be exactly 1056 bytes");Strengths:
No issues found. Test Coverage7. Integration Tests (tests/integration/test_cases/filemenu_verbs.yaml)Status: ✅ COMPREHENSIVE Coverage breakdown:
Test categories covered:
Test coverage is excellent. ✅ Documentation Quality8. GUEST_DATABASE_ARCHITECTURE.md (225 lines, new file)Status: ✅ EXCEPTIONAL Comprehensive coverage:
This is production-grade documentation. Should serve as reference for future contributors. ✅ Logging Standards Compliance9. Structured Logging UsageStatus: ✅ EXCELLENT All new code uses structured logging macros:
Fully compliant with docs/LOGGING_STANDARDS.md. ✅ Summary of Issues
Detailed Issues & Recommendations
|
|
@codex - please review this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f25d2cf099
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Fix legacy menu save stale address: update adroutline with new outline address on success instead of restoring pre-save value - Add nil check for hodblist before dereference in filemenu_open - Use odbGetRootVariable() API instead of direct struct access - Add nil guard in odbGetRootVariable() for defensive safety Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review - PR #391This is a HIGH RISK PR touching critical database infrastructure. I've performed a thorough review of the implementation. 🔴 CRITICAL ISSUES - Must Fix Before Merge1. Type Error in menupack.c:843Location: Issue: modern.menuactiveitem = host_to_disk_uint32((uint32_t) legacy->menuactivelayer);
^^^^^^^^^^^^^^^^^^^
Wrong field nameFix: Change This appears to be a typo that would either fail to compile or access the wrong struct field. 2. Inconsistent State in filemenu_close_guestdb()Location: Issue: If
// Line 391-394: Removes from system.compiler.files
hashdelete(bspath, false, false);
// Lines 397-402: Early return if odbCloseFile fails
if (!odbCloseFile((**hodb).odb)) {
// ... exits guard
return false; // <-- Database still in hodblist!
}
// Lines 407-411: Cleanup only happens if odbCloseFile succeeded
closefile((**hodb).fref);
listunlink((hdllinkedlist) hodblist, (hdllinkedlist) hodb);Recommended Fix: Treat if (!odbCloseFile((**hodb).odb)) {
log_warn(LOG_COMP_DB, "filemenu_close_guestdb: odbCloseFile failed, forcing cleanup");
// Continue cleanup anyway - partial cleanup is worse than forcing it
}
cancoonglobals = nil;
odb_guard_exit(&guard);
// Always do cleanup
closefile((**hodb).fref);
listunlink((hdllinkedlist) hodblist, (hdllinkedlist) hodb);
disposehandle((Handle) hodb);
return true; // Or return fl if you want to propagate the odbCloseFile error🟡 MEDIUM PRIORITY3. Unexplained cancoonglobals Nil AssignmentsLocations: Lines 282, 284, 294, 296, 374, 376 in Question: Why is Example (lines 280-286): odb_guard_enter(&guard);
if (!odbOpenFile(...)) {
odb_guard_exit(&guard);
// ... error handling
}
cancoonglobals = nil; // Why needed if guard already restored?
odb_guard_exit(&guard);Recommendation: Either add a comment explaining why this defensive nil assignment is necessary, or remove if redundant. 4. Test Coverage GapsMissing tests for:
🟢 LOW PRIORITY - Future Considerations5. Struct Duplication
6. Menu v7 Format Questions
✅ STRENGTHS
📋 RECOMMENDATION❌ DO NOT MERGE until the two critical issues are fixed:
After fixes:
The core corruption fixes are sound and this work addresses real bugs. With the critical issues resolved, this will be a strong contribution to database robustness. |
|
|
||
| /* Update in-memory address with new outline address */ | ||
| if (fl) | ||
| (**hm).adroutline = new_outline_adr; |
There was a problem hiding this comment.
Missing Save As check corrupts menu address after save
Medium Severity
During refactoring, the !fldatabasesaveas check was removed from both mesavemenustructure_legacy and mesavemenustructure_v7. The old code only updated (**hm).adroutline when NOT doing a Save As operation, but the new code unconditionally updates it. After a Save As, subsequent regular saves will now go to the Save As destination instead of the original file, breaking expected Save As semantics where the original document remains unchanged.
Additional Locations (1)
- Fix inconsistent cleanup in filemenu_close_guestdb: move odbCloseFile before filewindowtable removal so early return on failure leaves no inconsistent state (claude[bot] critical #2) - Move tyodblistrecord to odbinternal.h, removing duplicates from dbverbs.c, headless_filemenu_verbs.c, and headless_db_verbs.c (claude[bot] low #5, cursor[bot]) - Add clarifying comment on menuactivelayer->menuactiveitem field mapping in mepackmenustructure_v7 (claude[bot] #1 was false positive: different structs with different field names for same semantic value) - Fix Pascal string length bytes in error messages that prevented try/else from catching fileMenu.open errors - Integration test runner: delete stale .root7 and force fresh migration from v6 root before each test run Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR #391 Comprehensive Review: fileMenu Verbs with v7 Save Format and Corruption FixesExecutive SummaryThis PR implements critical headless fileMenu lifecycle functionality (open/close/closeall/save) and adds v7 menu save format support, while fixing several database corruption bugs. The implementation is generally solid with good test coverage (22/22 tests passing), but there are 1 critical issue and 4 important issues that should be addressed before merge. Risk Level: Medium-High - Touches core database open/save/close paths and global state management. Corruption fixes are critical but introduce subtle state management complexity. 1. Critical Issues (Must Fix)1.1 Struct Alignment Mismatch Needs ValidationLocation: Issue: The PR consolidates Problems:
Recommendation: Either: Option A (if this is NOT a disk format - most likely): Option B (if packing IS necessary for some reason):
This is critical because incorrect struct packing could cause subtle platform-dependent bugs in pointer arithmetic or handle offsets. 2. Important Issues (Should Fix)2.1 Inconsistent cancoonglobals = nil PatternLocation: Issue: The code sets This means:
Recommendation: Either:
2.2 Missing Debug Logging for odbGetRootVariable NULL ReturnLocation: Issue: The code doesn't log when Recommendation: Add debug logging when 2.3 langgetparamcount() Usage Without ValidationLocation: Issue: The code uses Problem: If Recommendation: Add parameter count validation and return error for invalid counts. 2.4 Test Coverage Gap: Edge CasesLocation: Issue: The integration tests cover sequential operations but don't test:
Recommendation: Add test cases for these edge cases to ensure undefined behavior is handled gracefully. 3. Minor Issues (Nice to Have)3.1 Inconsistent Logging LevelsSome operations use 3.2 Magic Numbers in Error MessagesError messages use hex length prefixes (e.g., 3.3 Missing Documentation for odbGetRootVariableAdd doc comment explaining when it returns nil, thread safety, and ownership of returned handle. 4. Positive Observations ✅4.1 Excellent Corruption Fix: tmpstack ContaminationThe fix for tmpstack contamination (setting 4.2 Proper Context Guard UsageThe use of 4.3 Clean v7 Menu Format ImplementationThe _Static_assert(sizeof(tysavedmenuinfo_v7) == 1056, "v7 menu struct must be exactly 1056 bytes");This is exactly how new disk format structs should be written. 4.4 Comprehensive Test Coverage22/22 integration tests passing is excellent. The test suite covers:
4.5 Proper Mode DispatchingThe dispatcher functions for v6/v7 format selection are clean and follow the established pattern. 4.6 Good DocumentationThe new Summary and RecommendationsMust Fix Before Merge (Critical):
Should Fix Before Merge (Important):
Nice to Have (Minor):
Overall AssessmentStrong approval pending critical fix. The corruption fixes (tmpstack contamination, db.new global leak) are critical and correct. The v7 menu save format implementation is clean. However, the Test coverage is excellent (22/22 pass). Code quality is high with good logging and error handling. The architecture follows established patterns. Recommendation: Address the critical struct packing issue, then this is ready to merge. Great work on the corruption fixes! 🎯 |
- Add _Static_assert validating tyodbrecord is 614 bytes under pack(2), catching any future layout drift at compile time (claude[bot] 1.1) - Add cancoonglobals to odb_context_guard save/restore, removing manual cancoonglobals = nil assignments from all callsites (claude[bot] 2.1) - Add debug log when odbGetRootVariable returns nil during filemenu_open to aid diagnosis of empty/corrupt guest databases (claude[bot] 2.2) - Add parameter count validation: fileMenu.open rejects != 1-2 params, fileMenu.save rejects > 1 param (claude[bot] 2.3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code Review - PR #391This is a substantial and well-executed PR that implements critical headless fileMenu verb functionality and fixes multiple database corruption bugs. The implementation demonstrates deep understanding of Frontier's architecture and takes appropriate precautions for safety. ✅ Strengths1. Excellent Documentation
2. Critical Corruption FixesThe PR addresses four distinct corruption bugs with proper root cause analysis: a) tmpstack contamination (db_format.c:169-175)/* Nil out currenthashtable to prevent tmpstack contamination */
currenthashtable = nil;Excellent fix. Setting b) db.new() global state corruption (dbverbs.c:2508-2522)odb_context_guard guard;
odb_guard_enter(&guard);
fl = odbnewfile(odbrec.fref);
closefile(odbrec.fref);
odb_guard_exit(&guard);Proper protection. Wrapping c) Struct alignment mismatch (odbinternal.h:27-40)Moving d) Guest DB save global leak (headless_filemenu_verbs.c:2806-2818)Wrapping 3. v7 Menu Save FormatThe new v7 format implementation is well-architected:
4. Robust Error Handling
5. Test Coverage
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ctparams = langgetparamcount(hparam1); | ||
|
|
||
| if (ctparams < 1 || ctparams > 2) { | ||
| langerrormessage(BIGSTRING("\x2f" "fileMenu.open requires 1 or 2 parameters (path, hidden)")); |
There was a problem hiding this comment.
Pascal string length byte incorrect for open error
Medium Severity
The Pascal string length byte \x2f (47 decimal) doesn't match the actual string length of 55 characters for the error message "fileMenu.open requires 1 or 2 parameters (path, hidden)". This causes the error message to be truncated by 8 characters when displayed via langerrormessage. The correct length byte should be \x37 (55 decimal).
| short ctparams = langgetparamcount(hparam1); | ||
|
|
||
| if (ctparams > 1) { | ||
| langerrormessage(BIGSTRING("\x2c" "fileMenu.save requires 0 or 1 parameters (path)")); |
There was a problem hiding this comment.
Pascal string length byte incorrect for save error
Medium Severity
The Pascal string length byte \x2c (44 decimal) doesn't match the actual string length of 47 characters for the error message "fileMenu.save requires 0 or 1 parameters (path)". This causes the error message to be truncated by 3 characters when displayed. The correct length byte should be \x2f (47 decimal).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… guard (#392) Three related fixes: 1. Restore !fldatabasesaveas guard in menupack.c that was lost during PR #391 refactoring. Both mesavemenustructure_legacy() and _v7() now skip the in-memory adroutline update during Save As, preserving the source database address pointers. 2. Implement fileMenu.saveAs(path) / fileMenu.saveCopy(path) using a save-then-copy approach: flush the source database to disk, then do an OS-level file copy. This avoids the dbstartsaveas/dbendsaveas machinery which modifies in-memory addresses during save. Works for both system root and guest databases. 3. Fix cancoonglobals handling: odb_guard_exit no longer auto-restores cancoonglobals, since most callers (filemenu_open, filemenu_close, filemenu_save) call functions that legitimately change it. Callers that need it restored (filemenu_saveas, filemenu_save_guestdb) now do so explicitly via guard.saved_cancoonglobals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… guard (#394) * feat: Implement fileMenu.saveAs/saveCopy and restore fldatabasesaveas guard (#392) Three related fixes: 1. Restore !fldatabasesaveas guard in menupack.c that was lost during PR #391 refactoring. Both mesavemenustructure_legacy() and _v7() now skip the in-memory adroutline update during Save As, preserving the source database address pointers. 2. Implement fileMenu.saveAs(path) / fileMenu.saveCopy(path) using a save-then-copy approach: flush the source database to disk, then do an OS-level file copy. This avoids the dbstartsaveas/dbendsaveas machinery which modifies in-memory addresses during save. Works for both system root and guest databases. 3. Fix cancoonglobals handling: odb_guard_exit no longer auto-restores cancoonglobals, since most callers (filemenu_open, filemenu_close, filemenu_save) call functions that legitimately change it. Callers that need it restored (filemenu_saveas, filemenu_save_guestdb) now do so explicitly via guard.saved_cancoonglobals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: Update OPML exports for new saveCopy/saveAs tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: Address PR review feedback — restore cancoonglobals guard, add ferror check, fix string lengths Review feedback from both bots: 1. Restore cancoonglobals auto-restore in odb_guard_exit. The odbengine.c setcancoonglobals operates on a static (file-local) variable, not the extern one that odb_guard saves/restores. Removing auto-restore was unnecessary and could break migrate_internal() (Codex feedback). 2. Add ferror(fin) check after file copy loop to detect read errors that cause fread to return 0 (both bots flagged this). 3. Remove partial destination file on copy failure via remove(). 4. Fix 4 incorrect Pascal string length prefixes (bot feedback). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>


Summary
Implements the full fileMenu verb lifecycle (open/close/closeall/save) for headless mode, adds v7 menu save format support, and fixes several database corruption bugs discovered during integration.
fileMenu Verbs
v7 Menu Save Format
Corruption Fixes
Other Changes
Test Results
Files Changed (9)
Generated with Claude Code
Note
High Risk
Touches low-level database/serialization and global context-guard logic; regressions could cause data corruption or crashes when opening/saving guest databases or packing menus/externals.
Overview
Headless mode now implements
fileMenu.open,fileMenu.close, andfileMenu.closeall, including tracking guest DBs in the sharedhodblist, mounting/unmounting them insystem.compiler.filesfor bracket-syntax access, and adding integration coverage for the full open→write→save→close lifecycle.To prevent corruption, the PR expands
odb_context_guard(includingcancoonglobals) and changesodb_guard_enter()to nilcurrenthashtableto avoid tmpstack double-frees; it also wrapsdb.newand guest-dbodbSaveFile()calls with the guard. Thetyodbrecorddefinition is centralized inodbinternal.hwith requiredpack(2)and a size assert to avoid struct-layout mismatches.V7 persistence work continues: menu packing/saving now has a dedicated v7 on-disk struct with BE64 addresses and a mode-based dispatcher, and
langexternalpackensures externals are loaded during normal saves when needed. Tests/scripts are updated to reflect headless menu verbs as safe no-ops, add newfilemenu_verbstests, and make the integration runner force a fresh v6→v7 migration before running.Written by Cursor Bugbot for commit b2f791b. This will update automatically on new commits. Configure here.