Conversation
|
Pushed a follow-up that fixes the red CI issues from the first commit. What changed:
Checks run locally:
Also ran the required adversarial review on the final diff; final verdict was approve. |
|
🤖 AI text below 🤖 Thanks for the fix! I pushed 8c2f9bc, which simplifies the aggregation logic while keeping behavior identical:
Net -71 lines; all the new integration-style tests pass unchanged. |
|
Claude Opus 4.8 took a look at the new 🤖 AI text below 🤖 Both new rejection paths in Review comment:
|
|
🤖 AI text below 🤖 Thanks! Both fixed in 8ab2fda:
Regression tests for all three inputs were added on both the |
|
GPT 5.6 Sol: 🤖 AI text below 🤖 The validation improvements generally work, but the new placeholder substitution corrupts diagnostics for metadata values containing the literal Review comment:
|
|
I can actually pull out that change from this PR, would be easier to review. |
|
Dropping a Fable adversarial review here, but I'm going to see about the commit above being a separate PR first. 🤖 Adversarial review 🤖Adversarial review of
|
fb798fc to
79f2f31
Compare
|
I pulled out the extra rejections to #1329, keeping this focused on just aggregations. That one is still needed to fix some of the leaking, though, so I think that should be considered first. |
* fix(metadata): reject malformed Description-Content-Type values Surface email-parser exceptions and header defects for Description-Content-Type as InvalidMetadata instead of leaking IndexError (e.g. "text/plain; x*") or silently accepting defective values. Extracted from #1268. Co-authored-by: r266-tech <r266-tech@users.noreply.github.com> Assisted-by: ClaudeCode:claude-fable-5 * fix(metadata): accurate message for defective Description-Content-Type The parse-error and header-defect paths reused the "must be one of" message, which is wrong when the content type itself is valid but a parameter is malformed. Say the value is not a valid content type instead, including the defect text when there is one. Assisted-by: ClaudeCode:claude-fable-5 * chore: clean up formatting a little Signed-off-by: Henry Schreiner <henryfs@princeton.edu> --------- Signed-off-by: Henry Schreiner <henryfs@princeton.edu> Co-authored-by: r266-tech <r266-tech@users.noreply.github.com>
from_raw(validate=True) always raises ExceptionGroup (never a bare InvalidMetadata), so drop the dead except branch and the two tests that monkeypatched from_raw to exercise it. The required-field dedup check reduces to membership in unparsed plus absence from raw, since from_raw only reports fields from raw or the required set. Also hoist the repeated message string in _process_description_content_type. Assisted-by: ClaudeCode:claude-fable-5
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
…s PR The malformed Description-Content-Type validation is being split out into its own PR, leaving only the from_email error aggregation here. Assisted-by: ClaudeCode:claude-fable-5
9acdd39 to
61aebc3
Compare
The explicit raise with 'from None' is unneeded: finalize raises after the except block has exited, so no exception context is chained. Assisted-by: ClaudeCode:claude-fable-5
|
Pushed a small follow-up for the current Python 3.9 red jobs. The failures were coverage-only: Checks run locally:
|
|
Pushed one more coverage-only follow-up for the Python 3.9 CI failures. The failed 3.9 jobs were still reporting partial branch coverage in Checks now passing locally:
|
Branch coverage is 100% without the pragmas, and the monkeypatched from_raw scenario cannot occur in practice today. Assisted-by: ClaudeCode:claude-fable-5
The pragmas cover arcs to the trailing from_raw return that only Python 3.9's tracer records; newer Pythons see 100% without them. Assisted-by: ClaudeCode:claude-fable-5
Summary
Metadata.from_raw()validation errors inMetadata.from_email(validate=True)Description-Content-Typevalues that the email parser reports through assignment errors or header defectsTests
PYTHONPATH=src python3 -m pytest tests/test_metadata.py -qpython3 -m compileall -q src/packaging/metadata.py tests/test_metadata.pygit diff --check -- src/packaging/metadata.py tests/test_metadata.pyPart of #1239.