Skip to content

test: reword PcapngUnescapedKeyTests' claims that #784 falsified - #790

Merged
JarryShaw merged 1 commit into
mainfrom
fix/785-pcapng-skip-reason
Sep 25, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/785-pcapng-skip-reason

Conversation

@JarryShaw

@JarryShaw JarryShaw commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Please follow the guide below

What is the purpose of your pull request?

Tick the commit type your subject line carries.

  • fix — corrects a defect
  • feat — adds a feature
  • perf — changes performance, not behaviour
  • refactor — changes neither behaviour nor performance
  • test — tests only
  • docs — documentation only
  • ci — workflows or build tooling
  • chore — anything else

Description of your pull request and other information

Measured on ef859f776: json.load now fails at line 1019, column 12 (not the docstring's claimed 915); the plist report of the same fixture now parses as well-formed XML, thanks to #784's escape_key fix in pcapkit/dumpkit/common.py:250.

Confirmed the pre-#784 plist failure really was line 1517 of 1958 (measured in a scratch worktree at 0419c1c97), matching #785's own measurement — so the docstring's 1376 had already drifted before #784 landed, not because of it.

Reworded the class and method docstrings in PcapngUnescapedKeyTests to name only the surviving json quoting defect (still open upstream as JarryShaw/DictDumper#121 -- the mapping-key issue; #125 is the separate plist string-value one), dropped the now-false plist claim, and flagged the json line number as fixture-dependent rather than a fixed fact — a stale instance of exactly that kind of number is what #785 was filed over. The @unittest.skip reason itself made no false claim and needed no change.

Test still skips, unchanged: 6 passed, 1 skipped, 25 subtests passed in tests/integration/test_pcapng_end_to_end.py.

Closes #785

@JarryShaw JarryShaw added test Pull requests that add or correct tests (test: subject prefix) docs Pull requests that change documentation only (docs: subject prefix) review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Sep 25, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Cross-review at 0033d5394 (fable, a different model from the author): NEEDS CHANGES — one wrong issue number, and one drifted line number in a PR whose whole purpose is removing drifted line numbers.

1. The upstream citation is the wrong issue, and the error is mine. Verified directly:

DictDumper#121 [OPEN] JSON and PLIST dumpers write mapping keys into the document unescaped
DictDumper#125 [OPEN] PLIST writer does not escape <, > or & in string values

The surviving json defect is the key one, so it is #121, not #125. #790 inherited this from my own Closes #772 paragraph on #784, which said the _encode_value-on-keys change "stays tracked at JarryShaw/DictDumper#125" — wrong when I wrote it. It is doubly confusing here, because the docstring sends a reader chasing the json defect to an issue about the plist half it has just said was fixed.

The four pre-existing #125 references on main are correct and stay — pcapkit/dumpkit/common.py:240 and the three in tests/dumpkit/ all describe the plist value/markup half, which is genuinely #125.

2. A stale line number survived. Line 169 of the same docstring cites pcapkit/protocols/schema/misc/pcapng.py:1450 for the bytes.fromhex(random) keying. It is at :1982 on main, and already was at 0419c1c97.

$ git show origin/main:pcapkit/protocols/schema/misc/pcapng.py | grep -n "bytes.fromhex(random)"
1982:            entries[label_enum].add(bytes.fromhex(random),

3. A smaller wording point, also measured. Line 189 says #784 fixed the plist half "by teaching escape_key ... to XML-escape mapping keys", which implies the helper predated #784. It did not — escape_key has zero occurrences at 0419c1c97; #784 introduced it.

Also worth folding in: #785 asked that a retained number be justified by a measurement at the commit that records it. The PR body names ef859f776; the docstring only says "what this run measured". Putting the sha in the docstring closes that properly.

The review confirmed everything else, including all three measurements, the untouched skip reason, and that no other copy of the false claims survives. Routing the fix.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Sep 25, 2026
@JarryShaw
JarryShaw force-pushed the fix/785-pcapng-skip-reason branch 2 times, most recently from 5878b52 to a390062 Compare September 25, 2026 15:07
@JarryShaw

Copy link
Copy Markdown
Owner Author

Revised to a3900621e, all four points applied — plus the same mis-citation in the commit message and the PR body, which I had missed.

The line-number sweep you asked for. I checked every citation in that class's docstrings by grepping for the cited construct rather than trusting the number. Only one was wrong:

pcapng.py:1450  -> bytes.fromhex(random) is at :1982      WRONG, fixed
dictdumper/json.py:224 -> keys = '{cmma}\n{tabs}"{item}": '.format(...)   correct
dumpkit/common.py:250  -> def escape_key(key: 'Any') -> 'Any':            correct

So 1450 was the only survivor, and it had already drifted at 0419c1c97 — independently of #784.

Also done: #125 → #121 in the docstring, the commit message and the PR body; "teaching escape_key" → "adding an escape_key helper", since it has zero occurrences at 0419c1c97; and the retained number is now anchored — "Measured on this fixture at ef859f776" — which is what #785's own condition asked for.

tests/integration/test_pcapng_end_to_end.py: 7 tests, OK (skipped=1). The skip reason string is untouched — no +/- line in the diff mentions it.

One process note worth recording rather than hiding: my first run of this module came back FAILED (errors=12). That was not a defect — a fresh worktree carries only the two tracked captures, and PcapngByteOrderTests needs the generated dhcp_big_endian.pcapng and dhcp_little_endian.pcapng. Copying the fixtures in gave the clean result above. Reporting it because a red count that turns out to be a missing fixture is exactly the kind of thing that gets quietly dropped.

Re-reviewing at the new head before I set a verdict.

@JarryShaw JarryShaw added review: pending No verdict for the current head - never reviewed, or the head moved since the last one and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Sep 25, 2026
#784 added an escape_key helper to pcapkit/dumpkit/common.py that XML-escapes
mapping keys, so the plist half of this class's docstring is no longer true: the
plist report of test.pcapng now parses as well-formed XML. Only the json
writer's quoting defect (dictdumper/json.py:224, unescaped quotes in a
bytes-repr key) still stands, still open upstream as
JarryShaw/DictDumper#121.

- Class docstring: drop the claim that both json and plist reports come
  out unparseable; note that plist parses since #784.
- Method docstring: replace the stale "line 915"/"line 1376" numbers
  with what this run actually measured on current main -- json fails at
  line 1019 column 12, and plist no longer fails at all -- and flag the
  json number as fixture-dependent rather than a fixed fact, since a
  drifted instance of exactly this number is what #785 was filed over.

Measured on ef859f7: json.load raises "Expecting ':' delimiter: line
1019 column 12" on the regenerated test.pcapng; xml.etree.ElementTree.parse
now succeeds on the same fixture's plist report. Verified 1517/1958 was the
correct pre-#784 plist failure line (0419c1c, matching #785's own
measurement), so 1376 had already drifted before #784 landed. The skip
reason itself named no false claim and needed no change. Build/tests: 6
passed, 1 skipped (unchanged) in tests/integration/test_pcapng_end_to_end.py.
@JarryShaw
JarryShaw force-pushed the fix/785-pcapng-skip-reason branch from a390062 to 91bde04 Compare September 25, 2026 15:17
@JarryShaw

Copy link
Copy Markdown
Owner Author

Delta re-check at a3900621e (fable, resumed so it re-checked its own findings): GOOD TO GO, all three fixed. It re-derived rather than accepted:

  • Scheduled weekly dependency update for week 43 #121 now in the docstring, commit message and PR body; git grep DictDumper#125 returns exactly the four pre-existing refs (dumpkit/common.py:240, tests/dumpkit/test_common_unit.py:230, test_plist_escaping_regression.py:13 and :114), untouched and correct there.
  • :1982 confirmed by printing line 1982 itself, and it re-ran the whole citation sweep over the file independently: lines 162, 169, 173, 190 are the only .py:N citations and all four now check out. No missed citation.
  • The anchored number verified against its own first-pass measurement on a proven ef859f776 tree: Expecting ':' delimiter: line 1019 column 12 (char 51357).

It caught one residual I had missed, which I have now fixed at 91bde048b (tree byte-identical, message only): the commit message's opening paragraph still read "#784 taught ... escape_key to XML-escape mapping keys" — the same pre-existence implication I had removed from the docstring, left standing in permanent history. escape_key has zero occurrences at 0419c1c97. Now reads "added an escape_key helper".

And it corrected my fixture diagnosis, in my favour. A truly bare worktree gives 13 errors, not the 12 I reported — the difference is the test.pcapng error, which my worktree did not hit because I had copied that one capture in for an earlier measurement. All 13 are the harness's own FileNotFoundError: sample capture '...' not found; 4×dhcp_big_endian, 3×dhcp_little_endian, 3×many_interfaces, 2×profile, 1×test.pcapng. So the diagnosis held and only my count was an artefact of a partly-populated tree. Worth stating, since "12 vs 13" is exactly the kind of number this PR exists to stop people inheriting.

Setting review: good-to-go. Unpublished and unmerged — yours to take. Closes #785.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: pending No verdict for the current head - never reviewed, or the head moved since the last one labels Sep 25, 2026
@JarryShaw
JarryShaw merged commit 04a5f4b into main Sep 25, 2026
31 checks passed
@JarryShaw
JarryShaw deleted the fix/785-pcapng-skip-reason branch September 25, 2026 16:32
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Sep 25, 2026
JarryShaw added a commit that referenced this pull request Sep 25, 2026
…k included

`main` moved from 73f09ae to 4530424 while this PR sat open, and the 1.5.0
section cited none of the 25 commits in between. Ten new bullets cover thirteen
of them, appended in merge order, with the file's own `**a breaking change**`
lead sentence on the three that are breaking:

- #754 -- AppType split into per-transport registries; the 1,004 portless and
  704 transportless rows stop being members. Breaking.
- #764 -- an out-of-range port in `AppType.get` is refused, not minted, so
  `TCP.make(srcport=99999)` raises; per-transport `_missing_` spans. Breaking.
- #778 -- `@final` enforced at runtime on `Info`/`Schema`: bare `@final` raises
  `InfoError`/`SchemaError` at first construction, deriving from a finalised
  class raises, and `SchemaError` is a `ValueError` where a caller may have
  been catching `TypeError`. Breaking.
- #772 (with #790's docstring reword), #766, #759, #787, #794 (with #791's
  citation repoint), #792/#798 and #802 -- the remaining seven.

Also re-ran the citation sweep against `origin/main` rather than the checkout.
One stale line number fixed: the `httpv2.py` `header.length != 9` guard the
`#692` entry calls out moved from `:562` to `:650` under #789 and #802. The
preamble's "reaching #726" becomes #805, the new maximum reference. Verified
unmoved on 4530424: `protocol.py:1411`, `schema/internet/ipv4.py:336`,
`traceflow.py` 146/149/162/424, the four `:type:` fields in `engine.rst`,
`reassembly.rst` and `traceflow.rst`, and `EXPECTED_FAILURES` at 43 entries.

Carries the previous round's #651/#646 corrections unchanged. Two literals were
reflowed so no ``literal`` wraps a line, which the generator's residual guard
refuses. `changelog_md.py --check` exit 0; `test_changelog_md.py` 47 passed,
37 subtests.
JarryShaw added a commit that referenced this pull request Sep 26, 2026
`main` moved from 73f09ae to 3cbdf89 while this PR sat open. This commit
(relative to its parent, 4233555) now names all 20 bullets it carries, not
just the 8 this session added on top of the 10 already there -- a first
draft of this message named only its own 8 and left the other 10 silent,
which a cross-review caught. Four are breaking:

- #754 -- AppType split into per-transport registries; the 1,004 portless
  and 704 transportless rows stop being members.
- #764 -- an out-of-range port in `AppType.get` is refused, not minted.
- #778 -- `@final` enforced at runtime on `Info`/`Schema`.
- #575 -- four `.get()`-backed enum fields fall through to
  `_unregistered_member` instead of minting; 14 of 23 sample captures
  change output.
- #772 (with #790's docstring reword), #766, #759, #787, #794 (with #791's
  citation repoint), #792/#798, #802, #782 (a further #745-hazard instance),
  #704, #723, #739, #743/#746 (cross-dependent, one bullet each), #805
  (closes #802's own filed-as-out-of-scope), #796, #800 -- the other 16,
  non-breaking.

Also restores a measurement an earlier round in this same diff dropped
while updating an adjacent one: the #692 entry's "mypy is unmoved at 112
errors" silently lost its "and pylint ... 364 messages" half when
`EXPECTED_FAILURES` was corrected 44 to 43 elsewhere in the same sentence.
Restored to the last value earlier rounds signed off on rather than
re-measured, since this branch's own `pcapkit/` tree predates several
since-merged PRs and a fresh run would not be measuring the same thing the
original round measured. Unmoved, and not silently dropped this time:
`93 of the 95 sites` corrected to `94 of the 95` and `EXPECTED_FAILURES`
44 to 43 in the several other places that already carried the fix.

On which PRs get a bullet: there is no clean "user-facing only" rule --
#766 and #791 are pure CI/test/lint-comment entries that are in, while
#773 and #763 are the same kind of thing and are out. The real pattern
across this file's 46 commits is closer to "each round's author judged it
worth a reader's time," which is inconsistent by construction. This round
leaves that inconsistency as found rather than trying to retrofit a rule,
but did add #782 on reconsideration -- its own PR body names it as sharing
#766's hazard, and pre-existing precedent already treats that hazard's
instances as bullet-worthy.

`changelog_md.py` regenerated `CHANGELOG.md`; `--check` exit 0.
`test_changelog_md.py` 47 passed.
JarryShaw added a commit that referenced this pull request Sep 26, 2026
`main` moved from 73f09ae to 3cbdf89 while this PR sat open. This commit
(relative to its parent, 4233555) now names all 20 bullets it carries, not
just the 8 this session added on top of the 10 already there -- a first
draft of this message named only its own 8 and left the other 10 silent,
which a cross-review caught. Six are breaking, matching the crediting PRs'
own `breaking` label in each case:

- #754 -- AppType split into per-transport registries; the 1,004 portless
  and 704 transportless rows stop being members.
- #764 -- an out-of-range port in `AppType.get` is refused, not minted.
- #778 -- `@final` enforced at runtime on `Info`/`Schema`.
- #575 -- four `.get()`-backed enum fields fall through to
  `_unregistered_member` instead of minting; 14 of 23 sample captures
  change output.
- #759 -- `AppType._dispatch` on a multi-transport `proto` now raises
  `ProtocolError` instead of silently resolving to whichever transport
  owns the lowest set bit.
- #805 -- `FieldBase.length` on a negative resolved length now raises
  `ProtocolError` instead of letting a bare `struct.error` escape.
  A second cross-review caught both: their crediting PRs (#783, #811) both
  carry GitHub's own `breaking` label, and neither bullet said so.

- #772 (with #790's docstring reword), #766, #787, #794 (with #791's
  citation repoint), #792/#798, #802, #779 (via #782, a further
  #745-hazard instance), #704, #723, #739, #743/#746 (cross-dependent, one
  bullet each), #796, #800 -- the other 14, non-breaking.

Also restores a measurement an earlier round in this same diff dropped
while updating an adjacent one: the #692 entry's "mypy is unmoved at 112
errors" silently lost its "and pylint ... 364 messages" half when
`EXPECTED_FAILURES` was corrected 44 to 43 elsewhere in the same sentence.
Restored to the last value earlier rounds signed off on rather than
re-measured, since this branch's own `pcapkit/` tree predates several
since-merged PRs and a fresh run would not be measuring the same thing the
original round measured. Unmoved, and not silently dropped this time:
`93 of the 95 sites` corrected to `94 of the 95` and `EXPECTED_FAILURES`
44 to 43 in the several other places that already carried the fix.

On which PRs get a bullet: there is no clean "user-facing only" rule --
#766 and #791 are pure CI/test/lint-comment entries that are in, while
#773 and #763 are the same kind of thing and are out. The real pattern
across this file's 46 commits is closer to "each round's author judged it
worth a reader's time," which is inconsistent by construction. This round
leaves that inconsistency as found rather than trying to retrofit a rule,
but did add #779 (via #782) on reconsideration -- its own PR body names it
as sharing #766's hazard, and pre-existing precedent already treats that
hazard's instances as bullet-worthy.

`changelog_md.py` regenerated `CHANGELOG.md`; `--check` exit 0.
`test_changelog_md.py` 47 passed.
JarryShaw added a commit that referenced this pull request Sep 26, 2026
`main` moved from 73f09ae to 3cbdf89 while this PR sat open. This commit
(relative to its parent, 4233555) now names all 20 bullets it carries, not
just the 8 this session added on top of the 10 already there -- a first
draft of this message named only its own 8 and left the other 10 silent,
which a cross-review caught. Six are breaking, matching the crediting PRs'
own `breaking` label in each case:

- #754 -- AppType split into per-transport registries; the 1,004 portless
  and 704 transportless rows stop being members.
- #764 -- an out-of-range port in `AppType.get` is refused, not minted.
- #778 -- `@final` enforced at runtime on `Info`/`Schema`.
- #575 -- four `.get()`-backed enum fields fall through to
  `_unregistered_member` instead of minting; 14 of 23 sample captures
  change output.
- #759 -- `AppType._dispatch` on a multi-transport `proto` now raises
  `ProtocolError` instead of silently resolving to whichever transport
  owns the lowest set bit.
- #805 -- `FieldBase.length` on a negative resolved length now raises
  `ProtocolError` instead of letting a bare `struct.error` escape.
  A second cross-review caught both: their crediting PRs (#783, #811) both
  carry GitHub's own `breaking` label, and neither bullet said so.

- #772 (with #790's docstring reword), #766, #787, #794 (with #791's
  citation repoint), #792/#798, #802, #779 (via #782, a further
  #745-hazard instance), #704, #723, #739, #743/#746 (cross-dependent, one
  bullet each), #796, #800 -- the other 14, non-breaking.

Also restores a measurement an earlier round in this same diff dropped
while updating an adjacent one: the #692 entry's "mypy is unmoved at 112
errors" silently lost its "and pylint ... 364 messages" half when
`EXPECTED_FAILURES` was corrected 44 to 43 elsewhere in the same sentence.
Restored to the last value earlier rounds signed off on rather than
re-measured, since this branch's own `pcapkit/` tree predates several
since-merged PRs and a fresh run would not be measuring the same thing the
original round measured. Unmoved, and not silently dropped this time:
`93 of the 95 sites` corrected to `94 of the 95` and `EXPECTED_FAILURES`
44 to 43 in the several other places that already carried the fix.

On which PRs get a bullet: there is no clean "user-facing only" rule --
#766 and #791 are pure CI/test/lint-comment entries that are in, while
#773 and #763 are the same kind of thing and are out. The real pattern
across this file's 46 commits is closer to "each round's author judged it
worth a reader's time," which is inconsistent by construction. This round
leaves that inconsistency as found rather than trying to retrofit a rule,
but did add #779 (via #782) on reconsideration -- its own PR body names it
as sharing #766's hazard, and pre-existing precedent already treats that
hazard's instances as bullet-worthy.

`changelog_md.py` regenerated `CHANGELOG.md`; `--check` exit 0.
`test_changelog_md.py` 47 passed.
JarryShaw added a commit that referenced this pull request Sep 26, 2026
`main` moved from 73f09ae to 3cbdf89 while this PR sat open. This commit
(relative to its parent, 4233555) now names all 20 bullets it carries, not
just the 8 this session added on top of the 10 already there -- a first
draft of this message named only its own 8 and left the other 10 silent,
which a cross-review caught. Six are breaking, matching the crediting PRs'
own `breaking` label in each case:

- #754 -- AppType split into per-transport registries; the 1,004 portless
  and 704 transportless rows stop being members.
- #764 -- an out-of-range port in `AppType.get` is refused, not minted.
- #778 -- `@final` enforced at runtime on `Info`/`Schema`.
- #575 -- four `.get()`-backed enum fields fall through to
  `_unregistered_member` instead of minting; 14 of 23 sample captures
  change output.
- #759 -- `AppType._dispatch` on a multi-transport `proto` now raises
  `ProtocolError` instead of silently resolving to whichever transport
  owns the lowest set bit.
- #805 -- `FieldBase.length` on a negative resolved length now raises
  `ProtocolError` instead of letting a bare `struct.error` escape.
  A second cross-review caught both: their crediting PRs (#783, #811) both
  carry GitHub's own `breaking` label, and neither bullet said so.

- #772 (with #790's docstring reword), #766, #787, #794 (with #791's
  citation repoint), #792/#798, #802, #779 (via #782, a further
  #745-hazard instance), #704, #723, #739, #743/#746 (cross-dependent, one
  bullet each), #796, #800 -- the other 14, non-breaking.

Also restores a measurement an earlier round in this same diff dropped
while updating an adjacent one: the #692 entry's "mypy is unmoved at 112
errors" silently lost its "and pylint ... 364 messages" half when
`EXPECTED_FAILURES` was corrected 44 to 43 elsewhere in the same sentence.
Restored to the last value earlier rounds signed off on rather than
re-measured, since this branch's own `pcapkit/` tree predates several
since-merged PRs and a fresh run would not be measuring the same thing the
original round measured. Unmoved, and not silently dropped this time:
`93 of the 95 sites` corrected to `94 of the 95` and `EXPECTED_FAILURES`
44 to 43 in the several other places that already carried the fix.

On which PRs get a bullet: there is no clean "user-facing only" rule --
#766 and #791 are pure CI/test/lint-comment entries that are in, while
#773 and #763 are the same kind of thing and are out. The real pattern
across this file's 46 commits is closer to "each round's author judged it
worth a reader's time," which is inconsistent by construction. This round
leaves that inconsistency as found rather than trying to retrofit a rule,
but did add #779 (via #782) on reconsideration -- its own PR body names it
as sharing #766's hazard, and pre-existing precedent already treats that
hazard's instances as bullet-worthy.

`changelog_md.py` regenerated `CHANGELOG.md`; `--check` exit 0.
`test_changelog_md.py` 47 passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Pull requests that change documentation only (docs: subject prefix) test Pull requests that add or correct tests (test: subject prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: PcapngUnescapedKeyTests' skip reason cites line 1376 for a failure at 1517, and #784 falsifies its plist half

1 participant