Repository navigation
fix(dumpkit): drop redundant escape/date workarounds dictdumper 0.8.5 fixed - #2445
Conversation
|
NEEDS CHANGES (cross-review, Opus vs. authoring model). Two required fixes, both small:
Non-blocking nit: Escaping fix, UTC conversion, and the untouched |
79ffcaa to
1cca7c8
Compare
|
Both required fixes applied (new head |
|
Review: GOOD TO GO at Both round-1 fixes independently re-derived as correct: the Non-blocking: |
|
Coverage: 94.44% (unit tier, Python 3.15,
Per-file detail: the |
|
New regression found by CI, not by either review round — the |
… fixed dictdumper 0.8.5 shipped PR #123 (key+value escaping for plist/json, fixing #772/DictDumper#125 and the json key-quoting defect DictDumper#121) and PR #124 (whole-second <date> formatting, fixing #1448). pyproject.toml's `dictdumper~=0.8.0` resolves to 0.8.5, so pcapkit.dumpkit.common's own workarounds ran on top of the upstream fix and double-escaped/mis-dated every plist/json report. - Remove `escape_strings`/`escape_json_keys`/`escape_keys`/`escape_key()` and the escaping tail of `object_hook` -- the writer now escapes a string or mapping key itself, for both plist/xml and json. - Shrink `_append_date` to just the UTC conversion dictdumper still does not do on its own; delegate the (now-fixed) whole-second formatting to `super()._append_date()`. - Keep `keep_none` (#1257) and `tree_numbers` (#1266) untouched -- those defects are still open upstream. - Bump `dictdumper~=0.8.0` to `>=0.8.5` in pyproject.toml and Pipfile. - Add `_append_object`/`_surrogate_pairs` for json output: dictdumper's json `_append_object` escapes a mapping key through its module-level `encode_string()` directly, bypassing the overridable `_append_string` that already fixes #1261 for values, so a key holding an astral character still round-tripped wrong. Split such a key into its UTF-16 surrogate pair before handing it to the upstream writer. - Cite the upstream json key-escaping fix as DictDumper#121, the real upstream issue, not DictDumper#1152, which is this repo's own issue number. - Use the `:issue:` Sphinx role, not a bare `#1448`, in `_append_date`'s docstring, per this repo's role-vs-plain-comment convention. - Update tests/dumpkit/test_common_unit.py's escaping-behaviour unit tests for the new (non-escaping) object_hook contract, refresh stale prose in two integration test docstrings that described the removed workarounds as still-open upstream bugs, and add a regression test for a json mapping key carrying an astral character. Verified against the installed dictdumper 0.8.5's actual source (dictdumper/json.py's encode_string(), dictdumper/plist.py's encode_xml() and _format_date()) before removing anything, and confirmed the new test_common_unit.py assertions fail against the pre-fix code. Full tests/dumpkit/ suite and everything importing pcapkit.dumpkit green (77 passed / 1793 subtests); tests/project/test_docs_issue_pr_roles_1103_unit.py green; mypy/pylint/isort clean on changed files. Closes #2442
1cca7c8 to
7e61bfb
Compare
|
Fixed and verified directly (new head |
Summary
dictdumper0.8.5 (released 2026-10-29) shipped PR Scheduled weekly dependency update for week 45 #123 (plist/json key and value escaping, fixing dictdumper PLIST writer does not escape angle brackets, so a pseudo-member makes the dump unparseable #772/DictDumper#125 and DictDumper#1152) and PR Scheduled weekly dependency update for week 01 #124 (whole-second<date>formatting, fixing fix(dumpkit): plist output is unreadable by plistlib because timestamps carry fractional seconds #1448).pyproject.tomlpinneddictdumper~=0.8.0, which resolves to 0.8.5, sopcapkit.dumpkit.common's own workarounds ran on top of the upstream fix and double-escaped/mis-dated everyplist/json/xmlreport on every fresh CI install.escape_strings/escape_json_keys/escape_keys/escape_key()and the escaping tail ofobject_hook-- the writer now escapes a string or mapping key itself, for both plist/xml and json. Shrinks_append_dateto just the UTC conversion dictdumper still does not do on its own, delegating the (now-fixed) whole-second formatting tosuper()._append_date().keep_none(fix(dumpkit): plist output drops every None value and None list item (dictdumper plist.py:198,228) #1257) andtree_numbers(docs(dumpkit): tree output is lossy -- decide whether to document it or fix the writer #1266) untouched -- those defects are still open upstream, confirmed by reading the installed 0.8.5 source before touching anything.dictdumper~=0.8.0todictdumper>=0.8.5inpyproject.tomlandPipfile.tests/dumpkit/test_common_unit.py's escaping-behaviour unit tests for the new (non-escaping)object_hookcontract, and refreshes stale prose in two integration test docstrings that described the removed workarounds as still-open upstream bugs.Closes #2442
Test plan
dictdumper==0.8.5in a fresh venv inside this worktree; confirmedpcapkit.__file__anddictdumper.__file__both resolve inside the worktree before testing.dictdumper/json.py(encode_string()) anddictdumper/plist.py(encode_xml(),_format_date()) to confirm which defects 0.8.5 actually fixed before deleting any workaround -- and found one it did not fix (aware-datetime-to-UTC conversion), which stays as a smaller_append_dateoverride.coverage run -m pytest tests/dumpkit-- 76 passed, 1793 subtests passed (98% coverage onpcapkit/dumpkit/common.py, the three uncovered lines are pre-existing and unrelated).common.pyfix and confirmed the rewrittentest_common_unit.pyassertions fail against the pre-fix code (proving they test the right thing), then restored it.pcapkit.dumpkitdirectly (~24 files, includingtests/integration/) -- all green except 4 pre-existing, unrelated failures intests/project/test_docs_internal_refs_1940_unit.py, confirmed to fail identically on the pre-fix tree.mypy,pylint(project's own flag set),isortclean onpcapkit/dumpkit/common.py; no new warnings on the changed test files.