feat!: S21.04 BlockDevice owns its block size; drop MaxBlockSize from BlockStoreConfig#528
Conversation
Device-wide block capacity, distinct from Size(blockIndex) occupancy. NullBlockDevice returns 0. Pure addition; no caller uses it yet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…GetBlockSize Create gains a blockSize parameter, stored and returned via GetBlockSize. Callers updated: BDD targets route their runtime size into the device; BlockStore tests pass a placeholder (config.MaxBlockSize still drives the store until the next slice wires it to the device). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… from BlockStoreConfig BlockStore_Create now reads SolidSyslogBlockDevice_GetBlockSize() instead of config.MaxBlockSize, which is removed from SolidSyslogBlockStoreConfig (API break). The min-block-size clamp is unchanged. Size-varying tests re-point the fixture device via an idempotent EnsureDeviceBlockSize helper (same-size calls reuse the device so corruption-recovery's persistent file handle survives). BDD targets route their runtime size into the device instead of the store config. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ses-default FileBlockDevice_Create resolves a blockSize of 0 to SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZE (default 8192, floored at one worst-case record). FatFs adapter gains a compile-time FF_MAX_SS floor on the default. Renames the zero-size store test to reflect that 0 now selects the device default rather than clamping to the minimum. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Design Y: when the device's block size cannot hold one worst-case record, BlockStore_Create reports SOLIDSYSLOG_CAT_BAD_CONFIG / BLOCKSTORE_ERROR_BLOCK_TOO_SMALL and falls back to NullStore instead of silently growing the device's reported size. The old max(deviceSize, minRecord) clamp is gone — the device is the single source of truth. Drain-ordering tests that leaned on the silent clamp now size blocks explicitly to one near-max record. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…suppressions - CLAUDE.md: GetBlockSize on the BlockDevice rows; FileBlockDevice_Create gains blockSize - DEVLOG: S21.04 entry (Design Y, the load-bearing-clamp discovery) - MISRA 15.7: terminal else on the BlockStore_Create report chain - MISRA 20.9: defined() guard on the FatFs FF_MAX_SS floor - misra_suppressions.txt: renumber 3 shifted findings (FileBlockDevice/FatFs 11.3, BlockStoreStatic 11.8) - clang-format reflow Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR moves block-size ownership from ChangesBlock Device Owns Block Size
🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1433 passed) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
…Design Z) CI revealed the max(deviceSize, oneRecord) clamp was load-bearing: a documented, cross-target calibration the drain tests and the store_capacity/capacity_threshold/ block_lifecycle BDD suites depend on. Rejecting (Design Y, ERROR -> NullStore) broke them and tripped the BDD target's _Exit(3)-on-ERROR handler. Keep the clamp, but emit a WARNING (BAD_CONFIG / BLOCK_TOO_SMALL) so it is no longer silent. Reverts the drain-test recalibration back to the proven 200/64 + 200/(MAX-100) values; converts the reject tests to clamp-works + reports-warning. cppcheck-misra green (11.8 suppressed at the two new GetBlockSize sites, same const-config-member pattern already deviated in this file). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1433 passed) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
Purpose
Closes #527. The last open thread under E21 (Port-Time Configurability): make the
SolidSyslogBlockDevicethe single source of truth for its own block size, instead ofthe integrator supplying a separate
MaxBlockSizeonSolidSyslogBlockStoreConfigthatcould silently disagree with the device.
This is an API break (a public config field is removed and a vtable op is added), so
it is deliberately landed during the 0.x beta window — after 1.0.0 the API is additive-only.
Change Description
Block size moves from config to the device, queried once at
BlockStore_Create:SolidSyslogBlockDevicegains a device-wideGetBlockSize()vtable op (distinct fromSize(blockIndex), which is a block's current occupancy). NullBlockDevice returns 0.SolidSyslogFileBlockDevice_Create(file, prefix, blockSize)takes the size atconstruction and reports it via
GetBlockSize.blockSize == 0selects the newSOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZEtunable (default 8192, floored at one worst-caserecord). The BDD targets route their runtime
--max-block-sizeknob into the device.MaxBlockSizeis removed fromSolidSyslogBlockStoreConfig; the store reads thedevice's size.
max(deviceBlockSize, oneRecord)floor so a worst-case record always fits, but nowemits a
WARNING(SOLIDSYSLOG_CAT_BAD_CONFIG/BLOCKSTORE_ERROR_BLOCK_TOO_SMALL)when it grows the block — delivered, degraded, no longer silent. (An earlier revision
rejected outright with an
ERROR; CI showed the clamp is a documented, load-bearingcross-target calibration that the drain tests and the store-capacity BDD suites depend
on —
syslog_steps.pycomments on it explicitly — so the clamp is retained and madeloud rather than removed.)
defined()-guarded compile-timeFF_MAX_SSfloor on the default.Test Evidence
Strict TDD across the feature:
GetBlockSizeon the contract (NullBlockDevice→0)MaxBlockSizedropped from config (clamp retained). Size-varyingtests re-point the fixture device via an idempotent
EnsureDeviceBlockSizehelper —same-size calls reuse the device so corruption-recovery's persistent file handle survives
SOLIDSYSLOG_FILE_DEFAULT_BLOCK_SIZEtunable + device0→defaultWARNINGis reported1396 host unit tests green; full local cppcheck-misra green. The existing drain-ordering
and store-capacity calibrations are unchanged — the clamp preserves the exact effective
block sizes from
main, so no message-fit arithmetic was re-derived.Not verified locally (gcc lane can't build them — covered by CI): the FatFs
FF_MAX_SSfloor and the Windows / FreeRTOS BDD-target callers (their
_Createedits are symmetric tothe green Linux target).
Areas Affected
SolidSyslogBlockDevice{,Definition}.h,SolidSyslogBlockStore{,Errors}.h,SolidSyslogTunablesDefaults.h,BlockStoreStatic.c,NullBlockDevice.c,BlockDevice.c.SolidSyslogFileBlockDevice{,Private}.h,*.c,*Static.c.Platform/FatFs/Source/SolidSyslogFatFsFile.c(FF_MAX_SS floor)._Createcallers.SolidSyslogBlockStoremust dropconfig.MaxBlockSizeand pass the size toSolidSyslogFileBlockDevice_Createinstead.A block smaller than one max-size message still works (grown to fit) but now emits a
WARNING.🤖 Generated with Claude Code