Skip to content

test(runtime): [develop] measure all suites and cover protocol boundaries - #650

Open
somethingwithproof wants to merge 21 commits into
refactor/c17-series-12-spdxfrom
refactor/c17-series-13-coverage
Open

somethingwithproof wants to merge 21 commits into
refactor/c17-series-12-spdxfrom
refactor/c17-series-13-coverage

Conversation

@somethingwithproof

@somethingwithproof somethingwithproof commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Measure every enabled native unit suite alongside the production-linked regression/fault programs, deriving producer objects from enabled programs. Enforce nonempty measured profiles and source/build/binary hashes. Add configuration-boundary, availability, startup-output, IPv6 wrong-peer/sequence and SNMP response contracts. Compare IPv6 address octets explicitly; declaration-only test globals are distinguished from executable producers.

Step 13/14 of the complete C17/native-correctness series. Base: the preceding series branch; merge/review in order so this PR shows only its own step.

Earlier validation, before this review follow-up, in isolated copied snapshots on Linux arm64:

  • Clean GCC build and make check: 18 passed, 1 existing prerequisite skips, 0 failures.
  • ASan/UBSan: 17 passed, 2 existing privilege/allocator-interposition prerequisite skips, 0 failures; no sanitizer findings.
  • Production source/profile integrity verification against disposable MariaDB and loopback SNMP fixtures passed.
  • Release archive extracted into a separate source tree and built/tested out of tree; fuzz checks passed.

Earlier local profiles retain source hashes for the copied validation tree; GitHub checks validate the published commit. No production database/device, host installation or live privilege change is part of validation. Existing prerequisite skips were retained; no test or finding was suppressed to obtain a pass.

Review follow-up (2026-10-09): Assert decoded SNMP status separately from transport status. Add production-linked fault regressions for reindex SELECT failures, polling-time/error-write failures, and a second partition finishing while the first partition's bookkeeping write is still pending, covering both successful and failed pending writes.

Restacked tip validation: isolated Linux arm64 build and make check passed (18 passed, 1 setuid prerequisite skip, no failures).
The restacked tip passes all five clang-tidy gate regression tests and real clang-tidy analysis (26 reviewed baseline findings, no new findings). Actionlint and matching DCO trailers pass. The setuid test also passes when run in the separate disposable root container.
GitHub checks validate the updated published commits; earlier profile/archive/sanitizer evidence above belongs to the previous revisions.

Current merge dependencies

Current base: refactor/c17-series-12-spdx. Immediate dependency: #649. Next open PR: #651.

Merge order: #641 → #644 → #654 → #646 → #648 → #649 → #650 → #651 → #655 → #658 → #659.

This repository uses squash-only merges and deletes merged branches. Record the old parent SHA, squash one PR at a time, then restack and retarget dependents before merging the next PR. Re-run merge validation and checks on the resulting heads; an ordinary clean merge does not replace squash/restack validation.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
# Conflicts:
#	tests/unit/test_snmpv3_session.c

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Coverage evidence omits a participating helper executable and the newly required CMocka dependency version.

2 open findings
What changed in this PR

Expands native runtime coverage and protocol-boundary regressions while correcting IPv6 peer comparison.

Changes:

  • Measures enabled CMocka suites in coverage runs.
  • Adds SNMP, ICMPv6, configuration, startup, and polling fault contracts.
  • Compares IPv6 peer address octets explicitly.
File Description
tests/​unit/​test_snmpv3_session.c Adds SNMP response contracts.
tests/​unit/​test_ping_icmp.c Expands IPv6 boundary tests.
tests/​unit/​test_linked.c Uses collision-safe temporary configuration files.
tests/​tools/​run_coverage.sh Measures and records unit suites.
tests/​regression/​test_spine_regressions.c Expands availability and configuration testing.
tests/​regression/​test_spine_faults.c Adds polling failure and completion-order regressions.
tests/​contracts/​test_spine_settings_contracts.c Tests configuration bounds and defaults.
tests/​contracts/​test_spine_contracts.c Tests startup and statistics output.
src/​ping/​icmp_shared.c Compares IPv6 address bytes explicitly.
Makefile.in Adds generated coverage manifest targets.
Makefile.am Defines unit coverage manifests.
.github/​workflows/​regressions.yml Installs CMocka for CI.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/tools/run_coverage.sh
Comment thread .github/workflows/regressions.yml
TheWitness pushed a commit that referenced this pull request Oct 11, 2026
…lity (#656)

Polling workers currently return permits before the parent can prove
their threads have exited, and database pool slots have no lease
identity. Add joined worker ownership and thread-owned,
generation-checked database leases before shared-state cleanup. Preserve
early ping-only output behavior and keep the tested external-script
limits and destination-aware upserts from #655.

Add explicit local/remote database TLS modes, protocol/cipher
constraints, opt-in checked JSON logging, and the paired-build benchmark
harness with its recorded original measurements. Legacy connection
behavior and text logging remain defaults. Unsupported TLS policies fail
closed. The updated man page documents the implemented contracts and
connector limitations.

Recovered work is isolated from the original uncommitted checkouts. The
CMake fork behavior suite is preserved separately on
`somethingwithproof/spine` branch
`fix/recovered-cmake-behavior-contracts`; all 27 native behavior tests
passed. Its fork-specific interfaces are not imported into Cacti's
Autotools source layout.

Validation for head `3db06ab315041187680b896c3658db0fbe8c60e3`:

- All 34 GitHub checks passed: GCC/Clang with MariaDB/MySQL clients,
Fedora 44, Rocky Linux 9, macOS, release distcheck, configure contracts,
static analysis, integration regressions, sanitizers, nightly ASan/TSan,
Memcheck, Helgrind, and concurrency soak.
- GitHub and independently measured Linux coverage: **396/396 changed
executable production lines (100%)**. Worker ownership: **71/71 lines
and 56/56 branches**; database leases: **65/65 lines and 72/72
branches**. Local production-source hashes exactly match this revision.
- Native suite: **20 passed, 2 Linux-only prerequisite skips**. Linux
suite: **24 passed, 1 expected prerequisite skip**, followed by real
database/SNMP/SNMPv3 fault contracts.
- Disposable TLS fixtures passed trusted-certificate, wrong-identity,
untrusted-CA, protocol/cipher mismatch, and plaintext rejection
contracts for local and remote connections.
- JSON encoder: 3 tests passed; benchmark evidence self-tests: 7 passed;
original recorded benchmark verified. Mandatory commit checks and
man-page lint passed.
- New paired Linux ARM benchmark compares exact #655 head `a8bd78d7`
with this head using identical GCC/dependencies/`-O2 -g0`, 20 measured
pairs plus 2 warmup pairs, 64 devices, 16 items/device, 4 workers,
alternating order. All 44 cycles verified all 1,024 expected outputs.
Median elapsed time: baseline 0.752536 s, candidate 0.749570 s; median
CPU time: baseline 0.023159 s, candidate 0.023171 s. Median paired
elapsed delta is -0.002300 s. This noisy loopback fixture establishes no
general performance improvement. TLS is disabled for both benchmark
builds.

**Final-head one-hour memory soak passed:** 5,612 cycles, each exiting
successfully and writing all 200 results; 5,609 cycles fitted after 3
warmups. RSS slope -7.6 KB/hour; projected growth over the run -8 KB,
within the 1,024 KB limit. [Final soak
run](https://github.com/Cacti/spine/actions/runs/38128178635). This PR
is ready for review. The older committed benchmark record remains
explicitly scoped to its original revisions. Original uncommitted
checkouts were preserved, and the recovery archive includes
restored-and-verified Git objects for all 1,238 orphan commit heads
captured during the audit.

Depends on #655 and its earlier stack. No live polling endpoints,
installations, database settings, or production privilege configuration
were changed.

## Current merge dependencies

Current base: `fix/post-c17-execution-hardening`. Immediate dependency:
[#655](#655). Next open PR:
[#658](#658).

Merge order: #641 → #644 → #654 → #646 → #648 → #649 → #650 → #651 →
#655 → #656 → #658 → #659.

This repository uses squash-only merges and deletes merged branches.
Record the old parent SHA, squash one PR at a time, then restack and
retarget dependents before merging the next PR. Re-run merge validation
and checks on the resulting heads; an ordinary clean merge does not
replace squash/restack validation.

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…mentation

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof somethingwithproof changed the title test(runtime): measure all suites and cover protocol boundaries test(runtime): [develop] measure all suites and cover protocol boundaries Oct 12, 2026
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the refactor/c17-series-13-coverage branch from 2de9e02 to dc99805 Compare October 12, 2026 20:34
@somethingwithproof
somethingwithproof force-pushed the refactor/c17-series-12-spdx branch from c315cd1 to 7ba678d Compare October 12, 2026 20:34
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
TheWitness pushed a commit that referenced this pull request Oct 12, 2026
…ence (#641)

Classify numeric, undefined, multipart and Cacti octet results through
one parser, normalize undefined agent values before persistence and
flush every SNMP batch consistently. Validate whole non-negative
uptimes, retain unknown reindex baselines and free script results
through their owning pointer. The mocked poll_host suite checks
session-profile boundaries, spike handling, output_regex input and
completion writes.

Originally step 4/14 of the C17/native-correctness series; its preceding
steps have merged. The current base is develop.

Earlier validation, before this review follow-up, in isolated copied
snapshots on Linux arm64:

- Clean GCC build and make check: 15 passed, 1 existing prerequisite
skips, 0 failures.
- ASan/UBSan: 14 passed, 2 existing privilege/allocator-interposition
prerequisite skips, 0 failures; no sanitizer findings.
- Production source/profile integrity verification against disposable
MariaDB and loopback SNMP fixtures passed.
- Release archive extracted into a separate source tree and built/tested
out of tree; fuzz checks passed.

Earlier local profiles retain source hashes for the copied validation
tree; GitHub checks validate the published commit. No production
database/device, host installation or live privilege change is part of
validation. Existing prerequisite skips were retained; no test or
finding was suppressed to obtain a pass.



Review follow-up (2026-10-09): Restacked on the corrected preceding
branches. The SNMP status fix is introduced in #638, the
reindex/completion fixes in #640, and focused regression coverage in
#650.

Restacked tip validation: isolated Linux arm64 build and make check
passed (18 passed, 1 setuid prerequisite skip, no failures).
GitHub checks validate the updated published commits; earlier
profile/archive/sanitizer evidence above belongs to the previous
revisions.

## Current merge dependencies

Current base: `develop`. Immediate dependency: `develop` (earlier steps
already merged). Next open PR:
[#644](#644).

Merge order: #641 → #644 → #654 → #646 → #648 → #649 → #650 → #651 →
#655 → #658 → #659.

This repository uses squash-only merges and deletes merged branches.
Record the old parent SHA, squash one PR at a time, then restack and
retarget dependents before merging the next PR. Re-run merge validation
and checks on the resulting heads; an ordinary clean merge does not
replace squash/restack validation.

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
TheWitness pushed a commit that referenced this pull request Oct 15, 2026
…644)

Polling workers need larger stacks on platforms such as musl. This step
initializes worker attributes with the measured minimum, preserves
larger platform defaults, and reports attribute failures. Compile-time
bounds reject result-buffer sizes that overflow multiplication,
addition, or rounding. The default minimum remains 384 KiB.

The diff contains step 7 only: nine files for worker stack sizing and
its existing fault/worker contracts. Native helper changes remain in
#654.

Immediate dependency: #660 (`refactor/c17-series-05-06-runtime-build`).
#641 is already merged. Merge order: #660 → #644 → #654 → #646 → #648 →
#649 → #650 → #651 → #655 → #658 → #659.

The branch includes the current #660 parent. This dependency repair
preserves the reviewed source tree. After each squash merge, restack and
retarget the next dependent PR before merging it; the repository deletes
merged branches.

Validation: macOS build and `make check` passed, with 13 passes and two
Linux-only prerequisite skips. Previous stack-bound compiler probes and
worker fault contracts remain in the branch. GitHub checks must pass on
the updated head before merge.

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement QA Issue found in QA, no ChangeLog required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants