Send un-prefixed hex to the readmem/writemem/debugreg parser - #892
Merged
Merged
Conversation
PR GideonZ#884 made writemem/readmem parse the address to the grammar the API documents: hex digits only, no leading "0x". The soak probe's memory ops still sent "0x0000", "0x0400", "0xD000", "0xD7FF" and an "0x"-prefixed per-runner write address, which strtol used to accept. Against patched firmware those requests now answer 400, and memory_read/memory_write_verify raise on any non-2xx, so the probe would break on the very firmware this change ships with. Send the four fixed addresses and the per-runner write address as bare 4-digit hex so the probe exercises the endpoints the way a well-behaved client is now required to. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The debugreg PUT case writes the register's held value straight back and
asserts the read-back is unchanged, but formatted it as f"0x{before}".
strtol consumed that prefix; parse_hex does not, so against this branch's
firmware the request answers 400 and set_debugreg raises on the non-200,
failing the case.
Measured on an Ultimate 64 Elite still running the pre-PR firmware, where
the prefix is still accepted: the suite passes 85 checks with this case
green, and PUT machine:debugreg?value=0xAA answers 200 with the register
unchanged at AA. Both go away once the stricter parse ships.
The register reads back as two hexadecimal digits, which is already the
documented form, so the prefix can simply go.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
chrisgleissner
force-pushed
the
fix/hex-parse-callers-tm
branch
from
September 12, 2026 13:22
571f40b to
3b34b0e
Compare
Collaborator
|
Review after retargeting to master: the strict parser is already in master, so the rebased PR now contains only the caller updates. I found one test-isolation defect: the new debug-register check ended by forcing the register to 1F. Follow-up 3b34b0e writes back the captured value and verifies its read-back instead, so the test leaves diagnostic state unchanged. No other issue found in the caller paths. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's wrong
#884 made
machine:readmem,machine:writememandmachine:debugregparse theiraddressandvalueto the grammar the API documents — hex digits and nothing else.Two callers in this repository still send the
0x-prefixed form thatstrtolused toaccept, so against firmware built from
test-mergethey now get HTTP 400.tests/e2e/api/rest_api_coverage_test.py:554is the one that matters. ThePUT /v1/machine:debugregcase writes the register's held value back as a no-op andformats it
set_debugreg(f"0x{before}").tests/lib/api.py:390-399raises on anynon-200, so that check fails and the
rest-api-coveragesuite goes red.tests/soak/network/http_probe.pysends four0x-prefixed addresses at:308-311and the per-runner write address at
:290;memory_readandmemory_write_verifyraise on any non-2xx, so every memory probe operation raises.
These are the only two. Everything else routes an int through
tests/lib/api.py's_hex_address, which formats{:04X}. (tests/soak/network/dma_probe.pyalso writesthe debug register, but over the binary DMA socket rather than this parser, so it is
unaffected.)
The change
Send the documented four-digit form. Six lines, no firmware change.
Why fix the callers rather than accept
0xThe prefix was never required — the firmware parses base 16 explicitly — and the
documented grammar is "0000 to FFFF". Loosening the parser again would undo #884.
Test
One Ultimate 64 Elite, measured either side of a single flash.
Before the flash, on firmware predating #884 (
git_commit_hash 68b78f50) — this isthe backward-compatibility check, because the change alters what the suite sends for
every target, including benches whose firmware predates #884:
Both pass, so landing this does not break targets that have not been updated. Note the
asymmetry: pre-#884
strtoltolerates the prefix rather than requiring it, so theun-prefixed pass is the backward-compatibility result and the prefixed pass is merely
the old behaviour.
After the flash, same machine, firmware built from
test-merge(bce4535e):So: green before the flash both ways, red after it without this change, green again with
it. The break is real and comes from the firmware change rather than from anything here.
The
bad-addressandbad-debugregstages pass on the same firmware —bad-address: OK (18 checks),bad-debugreg: OK (6 checks)— and neither skips,U64being absent fromboth
lackingtuples, so #884 and #885 are confirmed working on this machine.🤖 Generated with Claude Code