Repository navigation
feat(exl3): retain restart-idempotent projection and route ledgers - #3592
Conversation
Serialize configs without the empty state-dict cleanup path and replace completed shard files atomically. Keep live config fields authoritative and preserve source-only extensions. Retain the previous shard on write failures.
Extract the existing working fork feature for first maintainer feedback. Preserve carried code and tests; limit validation to lightweight structural checks. See the linked mechanism reference for actual API/call and failure paths.
Extract the existing working fork feature for first maintainer feedback. Preserve carried code and tests; limit validation to lightweight structural checks. See the linked mechanism reference for actual API/call and failure paths.
- _bind_record hashed an existing record_sha256 field, so re-appending a bound record wrote a line that failed its own digest check on the next index rebuild. Strip the field before hashing so replay is idempotent. - Evidence validators now raise ValueError (not AttributeError) for non-mapping input, matching the documented failure contract. - Sort imports for the ruff gate. - Skip the three census tests that call EXL3Processor zero-route methods; the processor wiring lands in a later stack layer and those tests fail on this branch. - Add regression tests for the journal replay and non-mapping input.
Qubitium
left a comment
There was a problem hiding this comment.
Review (layer 12 only)
Reviewed the incremental layer-12 commit (ae172a5a6, 4 files, +1998) rather than the cumulative 27-file view. The ledger API is coherent and the tests are thorough. I pushed a fix commit (d2cc4e15e) with the following.
Fixed
-
Journal replay could write an unverifiable line.
_bind_recordhashed an existingrecord_sha256, so re-appending a record read back from the journal produced a line that failed its own digest check on the next index rebuild:ValueError: EXL3 error journal record 2 failed its digestIt now strips the field before hashing, so replay is idempotent. Regression test added.
-
Validators raised
AttributeErrorfor non-mapping input.validate_route_evidence,validate_zero_route_recovery, andvalidate_zero_route_recovery_authorizationnow raiseValueErrorper the documented failure contract. Test added. -
Ruff
I001(import order) in both new files. -
Three tests fail on the PR head.
tests/test_exl3_error_ledger.pycallsEXL3Processor.plan_subset_zero_route_recovery,finish_subset_zero_route_recovery, andvalidate_subset_capture_readiness; none exist in this branch ormain. Since the PR says processor wiring lands in a later layer, they are now skipped with a reason — please move them to the wiring layer rather than leaving them here.
Verification
tests/test_exl3_error_ledger.py: 22 passed, 3 skipped. ruff check clean on both files.
Remaining questions (not changed)
validate_zero_route_recovery_authorizationonly bindsauthorization_sha256forimmutable-family-join(it must equal the family-join digest). Forcontent-bound-execution-upgradeit accepts any 64-hex value, so that kind is not actually content-bound. Is the digest meant to bind the authorization payload or an external upgrade artifact? If the former, the validator should recompute it.write_exl3_error_ledgerpublishes the ledger and then the manifest as two separate atomic writes, with no directory fsync. A crash between them leaves a manifest pointing at a replaced ledger. Consider fsyncing the directory and defining the recovery contract._JOURNAL_INDEXis process-local; the file-identity cache can go stale if another process appends between the write and the post-writestat, which can duplicate a record. Is cross-process concurrent append in scope?- The PR is
dirtyagainstmain; conflicts are expected for the cumulative stack, but the head no longer merges cleanly.
Nits
_finite_json_valuestringifies dict keys, so{1: ...}and{"1": ...}silently collide._family_recordassumes every projection hasquantizer_metrics["reconstruction"];write_exl3_error_ledgerraisesKeyErrorrather than a clear validation error when it is absent.
The branch predates the merge of layer 11 and other main work. Take main's tree for the shared files and keep only the layer-12 ledger, docs, tests and README reference.
) (#4991) Seven EXL3 tests carried an unconditional module-level ``pytest.mark.skip`` with "lands in a later stack layer" reasons from #3592/#3594/#3599. That wiring landed long ago, so shipped code paths had tests that pass but nobody ever ran. - test_exl3_capture_frontier.py / test_exl3_error_ledger.py: drop the ``_processor_wiring_pending`` skip and its decorators; all four tests run and pass. - test_quantize_config_offload_tempdir.py: drop two ``pytest.mark.skip`` decorators; widen the two tiny ``nn.Linear(16, ...)`` layers to 128 because EXL3 requires in_features to be a multiple of 128. - kernels/test_kernel_compile_levels_quant.py: gate the Paro cases on ``awq_runtime_available()``/``awq_runtime_error()`` instead of ``CUDA_HOME`` plus an ``nvcc``-on-PATH probe, which misreported the runtime as available. - Add tests/test_exl3_skip_reasons_4981.py, an AST guard that fails if any EXL3 test reintroduces an unconditional ``pytest.mark.skip``. A real precondition belongs in ``skipif`` with a precise reason. The Machete JIT gate in test_machete_jit.py is deliberately left alone: swapping the ``nvcc``-on-PATH probe for ``cuda_source_build_available()`` turns a skip into a failure on hosts whose toolkit and headers disagree, which is worse than the status quo. Fixes #4981
Summary
Expose projection/family error records, natural-route evidence, provenance compaction, atomic ledger publication, and restart-idempotent journals. Processor and writer wiring follows in later layers.
This is layer 12/36, extracted from an already-used fork for initial maintainer feedback. It depends on #3591. Review only this feature; the cross-fork Files changed view is cumulative because the PR targets upstream
main.Incremental change: 4 files, +1998/−0 lines, including carried tests and the mechanism reference. No merge is automatic. Review value and API shape first; substantial rework can follow that feedback.
Flow and existing-code boundary
flowchart TD S0["build_projection_record"] S1["append_exl3_error_journal"] S2["write_exl3_error_ledger"] E["OSError, ValueError"] S0 -->|"raises on rejected input/state"| E S1 -->|"raises on rejected input/state"| E style E fill:#fee,stroke:#b22gptqmodel/utils/exl3_error_ledger.py:642:build_projection_recordgptqmodel/utils/exl3_error_ledger.py:929:append_exl3_error_journalgptqmodel/utils/exl3_error_ledger.py:995:write_exl3_error_ledgerCommitted reference: docs/exl3-error-ledgers.md, linked from README. Class entry points/calls and rejected-state paths describe code present in this branch, rather than planned integrations.
Validation
Carried test files:
tests/test_exl3_error_ledger.pyThis packaging pass checked Python parsing, whitespace, dependency order and balanced Mermaid blocks. The author reports successful prior use of these features. Per the requested resource limit and feedback-first scope, existing model quantization, GPU/ROCm tests, heavyweight CPU workloads and full model benchmarks were not rerun; no new performance or model-accuracy claim is made. Tests accompanying earlier stack layers retain their previously reported results.