Repository navigation
Conversation
decode_lanes can fill an optional LaneReport saying why it stopped and how far the lanes got; without one it behaves as before. bcpack_inspect.h turns that into a class for a request (destination size not a whole number of blocks, request shorter or longer than the stream, a cut stream, trailing input, and so on) with the bytes read and the symbols per lane. decode_bcpack and the request path are unchanged. The check runs the repository's synthetic BC1 and BC7 streams; its collapse control reports every failure as one class and must fail.
…R0Y00#1198) A 256 MiB BC7 declaration let a tiny source allocate about 1 GiB of lane symbols. The cap is now the shared 16 MiB chunk-window bound; larger declarations return bad_arguments before any allocation. Adds oversized declared-output cases; short/long/truncated controls unchanged.
…cpack uses A failing BC3, BC4 or BC5 request was reported as unsupported_format. The reason now comes from the lane state, as for BC1 and BC7.
…-frontier-bcpack-inspect
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean cold-path inspector that names the class of BCPack failure.
LaneFailureenum andLaneReportstruct thread throughdecode_lanes_referencewithnote()andstall_failure()helpers.- New
bcpack_inspect.his independent of the hot path: runs the lane decode with a report, maps failures toInspectClass, supports BC1–BC7. - 16 MiB output cap prevents oversized scratch allocation before any decode.
bcpack_inspect_check.cppcovers exact/truncated/padded/damaged streams for BC1/BC7 plus BC2/BC3/BC4/BC5/BC6 edge cases, with a--mutate collapsenegative control.
The inspector is a pure read of lane state — no request-path changes.
KelboLive
left a comment
There was a problem hiding this comment.
LGTM — clean cold-path inspector that names the class of BCPack failure.
LaneFailureenum andLaneReportstruct thread throughdecode_lanes_referencewithnote()andstall_failure()helpers.- New
bcpack_inspect.his independent of the hot path: runs the lane decode with a report, maps failures toInspectClass, supports BC1–BC7. - 16 MiB output cap prevents oversized scratch allocation before any decode.
bcpack_inspect_check.cppcovers exact/truncated/padded/damaged streams for BC1/BC7 plus BC2/BC3/BC4/BC5/BC6 edge cases, with a--mutate collapsenegative control.
The inspector is a pure read of lane state — no request-path changes.
Leyukaka
left a comment
There was a problem hiding this comment.
Reviewed head f8d2d51e by reading its diff against main 212d4b5f. Nothing was built or run. git merge-tree --write-tree origin/main f8d2d51e exits 0.
Checked by reading
INSPECT_LAYOUTS(bcpack_inspect.h:59-67) matchesdecode_bcpackonmainfor all seven formats: thealphabetstable (bcpack_decoder.h:1391-1399), the lane counts (:1404), the block sizes (:1400) and the per-lane targetoutput_size / 8(:1403).- Every
return falseindecode_lanes_referencenow records a failure first (bcpack_decoder.h:280, 285, 379, 399, 405, 419, 423at head). phase1returns false in two places only::165(eab > 8) and:230(flushed fragment not at the home state, reached only after a header witheab <= 8). Theln.eab > 8test at head:378therefore separatesheader_invalidfromfragment_not_homeexactly.- The block-stage note in the header holds. BC1 to BC5 refuse only on capacity or symbol count. BC6H refuses a mode outside 1 to 14 (
bcpack_blocks_extra.inl:108, mode = symbol + 1). BC7 refuses an unmapped control code (bcpack_decoder.h:1104at head). - The new cases test what their names say. Symbol 13 is mode 14, which is valid, and symbol 14 is mode 15, which is not.
symbols[30] = 31, symbols[31] = 3gives code(3 << 5) | 31 = 0x07f, whose table entry hasvalid = 0(bcpack_tables.h:975). decode_bcpackis unchanged, anddecode_laneswithout a report takes the same path as before. No refusal is removed.
Needs a run before merge
- On pull requests the workflow runs
cmake --build --preset prandctest --preset pr(windows.yml:490-493). InCMakePresets.jsontheprbuild targets (:28-38) do not includebcpack_inspect_check, and theprtest filter (:51) matches nobcpack_inspectname. The PR description says the C++ tests were not run. So nothing shows thattest_bc2_bc6_bc7andtest_inspect_layoutscompile or pass at this head. Please post adevrun ofctest -R "^bcpack_inspect"atf8d2d51e(2 tests, the collapse control isWILL_FAIL).
Relation to #1940
- The description presents this PR as an alternate revision of #1940. It carries #1940's commits up to
7de1131bplus one commit, and it edits the same four files. - #1940 has since moved to
23ab9d48, which also adds the BC2 and BC6H layouts. Two differences remain between the heads:- This PR gives the BC6H mode failure its own class,
bc6_mode_invalid. #1940 reports it ascontrol_code_unmapped. - #1940's
test_all_formats_agreeruns a 17-block fixture stream for each of formats 1 to 7, checksokandrequest_shorter_than_stream, and compares each answer withdecode_bcpack. Here BC2 and BC6H get a 1-block exact case, and the two block-stage failures are 1-block cases.
- This PR gives the BC6H mode failure its own class,
- Only one of the two should merge.
Minor
inspect_bcpackmapslanes_ok == falsewithfailure == nonetook(bcpack_inspect.h:136-138). No exit leavesnonetoday. Mapping that case to a failure class would keep a future exit withoutnote()from reportingok.- The C++ test is registered inside the
if(EXISTS "${INTAKE_PYTHON}")block but needs no Python.bcpack_encoder_checkis registered outside it. - At
bcpack_decoder.h:328,!met &&is redundant afterif (met) return.
No defect found by reading f8d2d51e. Open before merge: the dev run of the two bcpack_inspect tests, and the choice between this PR and #1940.
Alternate review revision for #1940. This branch contains the existing BCPack inspector work plus verified review fixes and consistency checks. The original PR remains open because its author-owned branch was not writable from this account; these submissions overlap, so please keep only one and close/mark the other as superseded when choosing.
Validation:
git diff --checkand the Python consistency check across inspector, decoder, and fixture lane tables passed. C++ tests were not run because the required MSVCcltoolchain is unavailable in this environment.