Skip to content

Introduce LaxJsonDict type and use it in tests where JsonDict is relied upon being lax. - #20105

Open
reivilibre wants to merge 3 commits into
developfrom
rei/sjd/1_test_lax
Open

Introduce LaxJsonDict type and use it in tests where JsonDict is relied upon being lax.#20105
reivilibre wants to merge 3 commits into
developfrom
rei/sjd/1_test_lax

Conversation

@reivilibre

@reivilibre reivilibre commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Part of: #20103

This pull request is intended for commit-by-commit review.

This PR does not change any semantics, it just makes the reliance of JsonDict's laxity (?) explicit in relevant places of the test suite, in preparation for making JsonDict strict in the future.

It's a few-line tiny change in the first commit, plus a lot of repetitively simple boring/easily-verifiable mechanical changes in the second commit.

  1. Introduce LaxJsonDict

  2. Use LaxJsonDict in some tests

    NOTE: This is a search and replace of JsonDictLaxJsonDict in the tests module only, using an LLM-scripted 'trial and error' process to allegedly only make the necessary replacements.

    I can't guarantee that every replacement is necessary, however via the manual testing steps below, it is easy to verify that this is sufficient.
    In simpler times, I wouldn't have been against replacing all JsonDict occurrences in tests with LaxJsonDict as we don't frankly need to be strict in tests (and the goal here is not to make writing tests any more painful).

    As a result, it's my opinion that even if the LLM-scripted trial and error process did make unnecessary replacements, it's not a big deal here.


Manual Testing

To show that this set of replacements is sufficient to make the tests able to cope with a strict-ification of JsonDict,
simulate converting all remaining instances of JsonDict to StrictJsonDict within the tests module and run mypy:

rg -l JsonDict tests | xargs sd '\bJsonDict' 'StrictJsonDict' # Find and replace JsonDict -> StrictJsonDict
mypy tests
# Expect no errors

reivilibre and others added 3 commits August 13, 2026 16:11
Signed-off-by: Olivier 'reivilibre <oliverw@matrix.org>
@reivilibre
reivilibre marked this pull request as ready for review August 14, 2026 11:42
@reivilibre
reivilibre requested a review from a team as a code owner August 14, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants