Skip to content

fix(error)!: remap error codes into common reserved -400..-499 (v1.1.0)#552

Merged
kcenon merged 1 commit into
developfrom
fix/issue-551-error-code-remap
Jun 14, 2026
Merged

fix(error)!: remap error codes into common reserved -400..-499 (v1.1.0)#552
kcenon merged 1 commit into
developfrom
fix/issue-551-error-code-remap

Conversation

@kcenon

@kcenon kcenon commented Jun 14, 2026

Copy link
Copy Markdown
Owner

What

Remap container's error codes from positive into common's reserved -400..-499 band, so they classify as "ContainerSystem" instead of "Success"/"Invalid".

Why

error_codes.h defined positive constexpr int codes (value 100s, serialization 200s, validation 300s, resource 400s, thread_safety 500s) funneled into common's shared error_info.code; common classifies any code>=0 as "Success" (>0 as "Invalid" after #698). A second positive set, validation_codes:: in schema.h, reaches common via container_schema::validate_result() — the same hidden-second-surface defect found in monitoring #697.

How

  • Renumbered all 37 codes into -400..-499: error_codes:: value -400..-409, validation -410..-419, serialization -420..-429, resource -430..-439, thread_safety -440..-449; validation_codes:: (schema) -450..-459. All distinct across both namespaces.
  • Updated get_category(int) and is_*/is_category helpers to the new negative sub-bands (boundary logic re-derived for negatives; returned strings unchanged).
  • Aligned the obvious matches to common's codes::container_system:: values (value_type_mismatch=-400, serialization_failed=-420, deserialization_failed=-421, invalid_format=-422).
  • Updated tests + the example to named constants.

Verification

container's develop-PR CI runs no checks (all workflows are pull_request:[main]), so local full build + tests are the authoritative gate:

  • Build PASS (cmake --preset debug && cmake --build build-debug).
  • error_codes_tests 39/39 pass (incl. cross-system "ContainerSystem" classification + alignment-to-common checks + negative-band get_category boundary tests).
  • 5 other suites fail pre-existing/unrelated (variant_value_factory enum-ordinal, serialization round-trips, a SIGABRT in LargeDataHandling) — proven by stashing the change and rebuilding the pristine baseline (identical 5 failures). Net effect: error_codes_tests goes fail->pass, zero regressions.
  • Independent adversarial review confirmed: zero positive codes/literals into common error_info; 37 codes distinct + in-band; get_category banding correct (no off-by-one).

Out of scope (follow-up recommended)

Adversarial review noted pre-existing out-of-band negative literals (-1/-2) used as the error_info code in src/core/serializers/{binary,json,xml,msgpack}_serializer.cpp and src/modules/container.cppm (last touched in #538) — they classify as "Common" not "ContainerSystem". Not part of #551; worth a follow-up issue for full band hygiene.

Closes #551
Part of (ecosystem error-code registry contract, kcenon/common_system#699/#701)

container error codes were positive constexpr ints (100-502), plus a
second positive set validation_codes in schema.h, both funneled into
common's error_info.code and mis-classified as Success/Invalid. Renumber
all 37 codes (error_codes -400..-449, validation_codes -450..-459) into
common's reserved container band, update the get_category banding
classifier and is_* helpers to the new negative sub-bands, and align
matching codes (value_type_mismatch, serialization_failed, ...) to
common's container_system:: values.

BREAKING: emitted error-code values change. Name-based consumers need no
change; literal/persisted/wire consumers must update. Ships as v1.1.0
coordinated with the ecosystem (version not bumped here -- owner release).

Closes #551
@kcenon kcenon merged commit 999f251 into develop Jun 14, 2026
5 checks passed
@kcenon kcenon deleted the fix/issue-551-error-code-remap branch June 14, 2026 00:30
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.

1 participant