Skip to content

feat(shm): versioned object headers and payload migrations - #7

Merged
dkruempe merged 4 commits into
masterfrom
feat/shm-payload-abi
Oct 23, 2026
Merged

dkruempe merged 4 commits into
masterfrom
feat/shm-payload-abi

Conversation

@dkruempe

Copy link
Copy Markdown
Owner

Summary

Implements stages 2-4 of docs/shm-migration-strategy.md:

  • stable 64-byte ShmObjectHeader per named object with separate headerVersion and payloadVersion
  • payload stored in a separate allocation behind a relative offset
  • ShmPersistence::{Volatile, Derived, Persistent} at registration time
  • type/keyed v(n) -> v(n+1) payload migration registry
  • segment auto-recreate when all objects are volatile/derived and readable
  • persistent objects still abort with path and blocking object names

Integrated in shm::SharedMemoryRepository<T>, construct* helpers, JSON mirror repositories, EventBus (volatile), MessageQueueShmCore (volatile), property mirror (derived), ShmView, cleanup and bootstrap validation.

Breaking change

Segment layout is now version 3. Segments written by older builds have no readable per-object header and still need the existing migrator or LINTEL_SHM_RECREATE=1 path.

Tests

  • new tests/features/ShmObjectMigrationTest.cpp covers migration chains, persistent abort, volatile/derived recreation, automatic segment discard
  • ctest -L unit: 1318/1318 passed (PostgreSQL skipped)
  • ./scripts/check-format.sh master: passed
  • ./scripts/check-namespace.sh: passed

Plan and design: docs/shm-payload-abi-plan.md, docs/shm-migration-strategy.md.

Every named object now carries a stable ShmObjectHeader with separate
header and payload versions. The payload lives in a separate allocation
behind a relative offset, so changes to the library's bookkeeping no
longer move it.

Add ShmPersistence::{Volatile, Derived, Persistent} and per-type
v(n)->v(n+1) payload migrations. Segments whose objects are all
volatile or derived can be recreated without operator input; persistent
objects still require a migration or a registered migrator.

BREAKING CHANGE: the segment layout is version 3. Segments written by
older builds have no readable per-object header and still need the
existing migrator or LINTEL_SHM_RECREATE path.
@dkruempe
dkruempe changed the base branch from fix/codeql-alerts to master October 22, 2026 17:53
An object written as Volatile or Derived may be authoritative for a
build that now registers it as Persistent. Require both the stored and
the requested persistence class to allow discarding before recreating
a payload.
@dkruempe
dkruempe changed the base branch from master to fix/codeql-alerts October 22, 2026 18:07
@codecov-commenter

codecov-commenter commented Oct 22, 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 79.92048% with 101 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/features/base/services/ShmObject.cpp 79.2% 47 Missing ⚠️
src/include/lintel/core/shm/ShmSegmentAccessor.h 52.6% 45 Missing ⚠️
src/features/base/services/SharedMemoryService.cpp 83.7% 6 Missing ⚠️
...de/lintel/features/base/services/ShmConstructors.h 95.5% 2 Missing ⚠️
...tures/base/services/SharedMemoryCleanupService.cpp 92.8% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

The clang-tidy job analyses changed files with an explicit --checks list,
which re-enables bugprone-easily-swappable-parameters and reports the new
shared-memory API. Fix the code instead of loosening the gate:

- bundle the version pair, the two byte counts and the type id into
  ShmPayloadVersionRange, ShmPayloadMigrationInput and
  ShmPayloadMigrationRegistration, and the payload size/alignment into
  ShmPayloadLayout (ShmObject::Layout stays as an alias),
- give SharedMemoryType a std::uint8_t base type,
- log the swallowed deallocate errors instead of leaving empty catch
  blocks, and guard ~SegmentSemaphoreGuard against post() throwing,
- name the temporary named_semaphore whose constructor creates the lock.

clang-tidy: 0 findings in 17 analysed files; unit tests 1318/1318.
The Doxygen workflow runs with WARN_AS_ERROR and fails on master at the first
undocumented parameter. Complete the parameter lists of EventBusEntry,
LoggerConfiguration and MessageQueueService, and name the parameters of
Allocator::findOrConstructArray so its @PARAM entries resolve (the default
implementation ignores them, hence [[maybe_unused]]).

doxygen Doxyfile: exit 0, zero warnings.
@dkruempe
dkruempe changed the base branch from fix/codeql-alerts to master October 23, 2026 12:25
@dkruempe
dkruempe merged commit 7b76f3f into master Oct 23, 2026
17 checks passed
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.

2 participants