Skip to content

Name the examples directories apart; fix the HoleDescriptor typo - #350

Merged
JarryShaw merged 3 commits into
mainfrom
chore/naming-cleanups
Sep 14, 2026
Merged

JarryShaw merged 3 commits into
mainfrom
chore/naming-cleanups

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

Two naming cleanups, no behaviour change beyond the removed misspelling.

examples/sample/ vs examples/samples/

They differed by one letter and held different things — captures in one, the scripts that build them in the other — so every path mentioning either read as a typo. Now:

  • examples/captures/ — the .pcap / .pcapng fixtures (still gitignored bar the six committed ones)
  • examples/generators/ — make_samples.py, pcap.py, pcapng.py, legacy.py

Every reader updated: the 21 examples/legacy_smoke/ scripts, tests/_support.sample_path(), the samples/test-all/coverage/isort Makefile targets, both CI jobs, README.rst and docs/source/pep.rst.

HoleDiscriptor → HoleDescriptor

The TCP hole descriptor data model was misspelt, and it had spread to the package alias (TCP_HoleDiscriptor), the docs page and the tests.

This is a breaking change and deliberately so — no compatibility alias is left behind, so anything importing pcapkit.foundation.reassembly.data.tcp.HoleDiscriptor or pcapkit.foundation.reassembly.data.TCP_HoleDiscriptor needs updating. Nothing inside the repository still uses the old spelling.

Test result

pytest -q → 334 passed, 70 subtests passed, unchanged from main.

examples/sample/ and examples/samples/ differed by one letter and held
completely different things, so the pair read as a typo in every path that
mentioned either. The captures now live in examples/captures/ and the scripts
that build them in examples/generators/.

Updated every reader: the legacy_smoke scripts, tests/_support.sample_path(),
the Makefile targets, the CI workflow, README and the Help Wanted page.

Full suite: 334 passed, 70 subtests passed.
The TCP hole descriptor data model was named HoleDiscriptor, and the
misspelling had spread to the package alias, the docs and the tests.

Renamed the class to HoleDescriptor and the package alias to
TCP_HoleDescriptor, with no compatibility alias left behind: the old spelling
is gone from the public API, so anything importing HoleDiscriptor or
TCP_HoleDiscriptor must be updated.
@JarryShaw
JarryShaw requested a lite review from Copilot September 14, 2026 03:24
@JarryShaw
JarryShaw marked this pull request as ready for review September 14, 2026 03:27

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The repo still contains examples/sample/ but .gitignore/MANIFEST.in no longer account for it, which can lead to stale fixtures being accidentally staged or packaged.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR performs naming cleanups across the repo: it splits example fixture data vs fixture generator scripts into clearly named directories, and fixes the long-standing HoleDiscriptor typo by renaming the TCP reassembly model to HoleDescriptor (including the package-level alias), updating tests, docs, and CI accordingly.

Changes:

  • Rename example paths to use examples/captures/ (fixtures) and examples/generators/ (fixture builders), updating tests/docs/CI/Makefile and legacy smoke scripts.
  • Rename TCP reassembly hole model HoleDiscriptor → HoleDescriptor (and TCP_HoleDiscriptor → TCP_HoleDescriptor) and update usages in code/tests/docs.
  • Add/update committed sample artifact files under examples/captures/ consistent with the new directory naming.
File summaries
File Description
tests/foundation/reassembly/test_tcp.py Updates imports/usages to HoleDescriptor.
tests/foundation/reassembly/data/test_models.py Updates TCP model alias/import expectations to TCP_HoleDescriptor / HoleDescriptor.
tests/_support.py Points sample fixture resolution and regen command at examples/captures/ + examples/generators/.
README.rst Updates documentation references to new fixture/generator directories.
pcapkit/foundation/reassembly/tcp.py Updates TCP reassembly implementation to use HoleDescriptor.
pcapkit/foundation/reassembly/data/tcp.py Renames the TCP hole data model and updates exported names/types.
pcapkit/foundation/reassembly/data/init.py Renames package alias to TCP_HoleDescriptor.
MANIFEST.in Switches pruning from examples/sample to examples/captures.
Makefile Updates samples + isort targets to the new generator directory and paths.
examples/legacy_smoke/test_trace.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_time.py Updates legacy smoke script fixture paths to ../captures/....
examples/legacy_smoke/test_tcp.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_stream.py Updates legacy smoke script output/buffer paths to ../captures/....
examples/legacy_smoke/test_stream_askpass.py Updates legacy smoke script output/buffer paths to ../captures/....
examples/legacy_smoke/test_reassembly.py Updates legacy smoke script input/output paths to ../captures/....
examples/legacy_smoke/test_profile.py Updates legacy smoke script fixture paths to ../captures/....
examples/legacy_smoke/test_perf.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_pcapng.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_ipv6.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_ipv6_reasm.py Updates legacy smoke script input/output paths to ../captures/....
examples/legacy_smoke/test_ip_reasm.py Updates legacy smoke script input/output paths to ../captures/....
examples/legacy_smoke/test_http.py Updates legacy smoke script fixture paths to ../captures/....
examples/legacy_smoke/test_file.py Updates legacy smoke script fixture paths to ../captures/....
examples/legacy_smoke/test_extractor.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_engine.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_basic.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_api.py Updates legacy smoke script fixture/output paths to ../captures/....
examples/legacy_smoke/test_analyse.py Updates legacy smoke script fixture paths to ../captures/....
examples/generators/pcapng.py Updates generator docs/constants and embedded provenance strings to new paths.
examples/generators/pcap.py Updates generator docs/constants/comments to write into examples/captures/.
examples/generators/make_samples.py Updates top-level regeneration script to target examples/captures/.
examples/generators/legacy.py Updates legacy fixture generator to write into examples/captures/.
examples/captures/pcapng.txt Adds/updates committed sample output under the new captures directory.
examples/captures/out.txt Adds/updates committed sample output under the new captures directory.
examples/captures/out.plist Adds/updates committed sample output under the new captures directory.
examples/captures/out.json Adds/updates committed sample output under the new captures directory.
examples/captures/in.pcap Adds/updates committed sample capture under the new captures directory.
examples/captures/dhcp.pcapng Adds/updates committed sample capture under the new captures directory.
docs/source/pep.rst Updates fixture regeneration documentation to new generator path.
docs/source/pcapkit/foundation/reassembly/tcp.rst Updates Sphinx autoclass reference to HoleDescriptor.
.gitignore Updates ignore/unignore rules to the new captures directory.
.github/workflows/unit-tests.yml Updates CI fixture regeneration step and comments to new generator path/fixture directory.
Review details
  • Files reviewed: 35/49 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread MANIFEST.in
@JarryShaw

Copy link
Copy Markdown
Owner Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

Co-authored-by: JarryShaw <15666417+JarryShaw@users.noreply.github.com>

Copilot AI commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply ...

Added prune examples/sample to MANIFEST.in alongside the existing prune examples/captures line — the legacy directory will no longer be pulled into sdists.

@JarryShaw
JarryShaw merged commit b8eee4f into main Sep 14, 2026
49 checks passed
@JarryShaw
JarryShaw deleted the chore/naming-cleanups branch September 14, 2026 04:10
@JarryShaw JarryShaw added fix Pull requests that fix a defect (fix: subject prefix) breaking Breaks public-facing behaviour or API (apply alongside the type label) labels Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks public-facing behaviour or API (apply alongside the type label) fix Pull requests that fix a defect (fix: subject prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants