Skip to content

Expose portable Python requirement validation - #88

Draft
omry wants to merge 1 commit into
pr86from
pr87
Draft

Expose portable Python requirement validation#88
omry wants to merge 1 commit into
pr86from
pr87

Conversation

@omry

@omry omry commented Aug 17, 2026

Copy link
Copy Markdown
Owner

Add canonical direct-root requirement validation and normalized distribution-name extraction to the Python provider. Direct URLs, environment markers, embedded whitespace, malformed extras, non-canonical extras, and non-canonical specifier sets are rejected so an immutable catalog root cannot depend on external location or runtime state, and cannot be spelled two ways.

Add canonical interpreter-version validation for the major.minor and major.minor.patch forms used by portable binding compatibility lists, rejecting non-numeric, non-canonical, and out-of-range components.

Scope authority

Task: PTD-01 — Expose Portable Python Requirement Validation, defined in docs/PORTABLE_TOOL_DEFINITION_IMPLEMENTATION_PLAN.md (PR #86 in this stack), under the normative Portable Tool Definition Design.

Acceptance criteria:

  • exact and ranged roots normalize deterministically;
  • URLs, markers, extras, malformed roots, and ambiguous versions fail;
  • go.mod remains stable under go mod tidy;
  • go test ./internal/providers/python passes.

Local review findings, applied

  • extras must be sorted and unique. demo[b,a] and demo[a,a] were accepted, so one dependency could be spelled several ways and produce different record digests, against the design's canonical identity rule that every other record collection already follows;
  • ValidatePackageRootRequirementV1 was removed. It was exported but called by nothing here, at the stack tip, or in either retired source;
  • limit and identity tests were added alongside the existing positive and negative coverage.

Exclusions: record types, catalog behavior, Python resolver changes, and module dependency promotion, which belongs to PTD-04. The two remaining exports have no in-tree caller until PTD-04 consumes them. Source: parked extraction source b39985d247e5 from retired PR #83.

@omry
omry changed the base branch from main to pr86 August 17, 2026 15:55
@omry
omry marked this pull request as ready for review August 17, 2026 15:56
@omry

omry commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

@codex review 192789f

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 192789f925

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return "", fmt.Errorf("invalid Python package root requirement %q", requirement)
}
remainder := strings.TrimPrefix(value, name)
if strings.HasPrefix(remainder, "[") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject extras from portable package roots

When a catalog root such as demo[http]>=1.2 reaches this branch, the extras are parsed and the validator returns success. This contradicts the PTD-01 acceptance contract in docs/PORTABLE_TOOL_DEFINITION_IMPLEMENTATION_PLAN.md, which explicitly requires roots containing extras to fail, so future catalog validation can admit unsupported definitions. Reject any bracketed extras instead of validating and accepting them.

Useful? React with 👍 / 👎.

@omry
omry marked this pull request as draft August 17, 2026 16:11
@omry

omry commented Aug 17, 2026

Copy link
Copy Markdown
Owner Author

Returning to draft: remote review for this slice is deferred. The stack PTD-01 through PTD-11 is being built with local review and full local checks only, then reviewed bottom-up once review capacity is available.

Add canonical direct-root requirement validation and normalized distribution-name extraction to the Python provider. Direct URLs, environment markers, embedded whitespace, malformed extras, and non-canonical specifier sets are rejected so an immutable catalog root cannot depend on external location or runtime state.

Add canonical interpreter-version validation for the major.minor and major.minor.patch forms used by portable binding compatibility lists, rejecting non-numeric, non-canonical, and out-of-range components.

These helpers are exposed for the portable tool catalog slices that follow and change no existing provider behavior. Delivers PTD-01 of docs/PORTABLE_TOOL_DEFINITION_IMPLEMENTATION_PLAN.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant