Skip to content

fix(const): find hyphenated HTTP methods by value in Method._missing_ (#2284) - #2351

Merged
JarryShaw merged 1 commit into
mainfrom
fix/2284-http-method-hyphen
Oct 27, 2026
Merged

JarryShaw merged 1 commit into
mainfrom
fix/2284-http-method-hyphen

Conversation

@JarryShaw

Copy link
Copy Markdown
Owner

What is the purpose of your pull request?

  • fix — bug fix

Description

Closes #2284.

  • Fix: Method._missing_ now also looks up _value2member_map_ with the upper-cased value before minting an unregistered member, so a hyphenated method like baseline-control resolves to its real member (with its registry idempotent/safe flags) in any case.
  • Fail-without-fix: 5 failed on origin/main. Passing on the rebased head.

@JarryShaw JarryShaw added this to the PyPCAPKit v1.5 milestone Oct 27, 2026
@JarryShaw JarryShaw added bug Issues reporting a defect (set by the bug report template; a default, not an assessment) const Regenerated IANA or vendor constant tables; members keep their numeric values fix Pull requests that fix a defect (fix: subject prefix) review: running A cross-review is in flight against the current head - no verdict yet labels Oct 27, 2026
@JarryShaw

Copy link
Copy Markdown
Owner Author

Review: NEEDS CHANGES at 501a9f17c (Sonnet) — docs only, code and test are correct.

@JarryShaw JarryShaw added review: needs-changes Cross-review at the current head says changes are required; see the verdict comment and removed review: running A cross-review is in flight against the current head - no verdict yet labels Oct 27, 2026
…#2284)

Method._missing_ upper-cased the value and checked member names only, so
Method('baseline-control') and Method('version-control') minted
unregistered members (idempotent=False) instead of returning
BASELINE_CONTROL and VERSION_CONTROL, whose names differ from their values.

Fall back to _value2member_map_ with the upper-cased value before minting.
Changed in the vendor template and mirrored identically into the generated
pcapkit.const.http.method.

Test: tests/const/test_const_method_missing_value_2284_unit.py covers both
methods in any case, non-method strings still minting, get() staying
case-sensitive, and template parity.
@JarryShaw
JarryShaw force-pushed the fix/2284-http-method-hyphen branch from 501a9f1 to 78543cb Compare October 27, 2026 02:23
@JarryShaw

Copy link
Copy Markdown
Owner Author

Amended 501a9f17c → 78543cb33: added a paragraph for #2284 to docs/source/pcapkit/const/http.rst's versionchanged:: 1.5.0 block, next to #908's sibling entry. Left the changelog as N/A — the #908 sibling fix didn't get one either. test_no_version_directives_in_generated_tables_1884_unit.py, test_docs_internal_refs_1940_unit.py and test_docstring_contract.py give 21 passed.

@JarryShaw JarryShaw added review: good-to-go Cross-review at the current head says ready; CI state is separate and removed review: needs-changes Cross-review at the current head says changes are required; see the verdict comment labels Oct 27, 2026
@JarryShaw JarryShaw moved this to In review in PyPCAPKit Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Coverage: 91.58% (unit tier, Python 3.15, 78543cb33, Unit Tests run success)

Package Statements Missed Branches Partial Cover
pcapkit (top level) 104 4 20 2 95.16%
pcapkit/const 19601 881 2620 867 92.12%
pcapkit/corekit 2596 74 818 37 96.51%
pcapkit/dumpkit 282 3 102 3 98.44%
pcapkit/foundation 3029 23 1050 25 98.82%
pcapkit/interface 138 4 52 3 96.32%
pcapkit/protocols 17442 218 4586 185 98.15%
pcapkit/toolkit 914 36 334 10 95.51%
pcapkit/utilities 502 7 144 5 98.14%
pcapkit/vendor 4432 1988 1018 167 51.87%

Per-file detail: the coverage-html artifact of this run.

@JarryShaw
JarryShaw merged commit 7886d9f into main Oct 27, 2026
61 checks passed
@JarryShaw
JarryShaw deleted the fix/2284-http-method-hyphen branch October 27, 2026 04:29
@github-project-automation github-project-automation Bot moved this from In review to Done in PyPCAPKit Oct 27, 2026
@JarryShaw JarryShaw removed the review: good-to-go Cross-review at the current head says ready; CI state is separate label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues reporting a defect (set by the bug report template; a default, not an assessment) const Regenerated IANA or vendor constant tables; members keep their numeric values fix Pull requests that fix a defect (fix: subject prefix)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix(const): Method('baseline-control') mints an unregistered member, not BASELINE_CONTROL

1 participant