Skip to content

Navigation Menu

Sign in
Sign up

cooldown: add package pattern overrides - #243

Open
ksivamuthu-cei wants to merge 1 commit into
git-pkgs:main from
ksivamuthu-cei:feat/cooldown-package-patterns
Open

cooldown: add package pattern overrides #243
ksivamuthu-cei wants to merge 1 commit into
git-pkgs:main from
ksivamuthu-cei:feat/cooldown-package-patterns

Conversation

@ksivamuthu-cei

@ksivamuthu-cei ksivamuthu-cei commented Aug 10, 2026

Copy link
Copy Markdown

Summary

Add proxy-level cooldown package-pattern overrides as a policy wrapper, without changing the cooldown library.

  • add internal/cooldownpolicy, implementing the handler cooldown policy interface;
  • apply duration overrides for canonical PURL globs, with exact package overrides taking precedence;
  • normalize @ to %40 in configured patterns, matching canonical PURL lookup behavior;
  • validate glob patterns and durations when starting the server; and
  • document cooldown.package_patterns.

This is an initial policy layer for #127 and keeps namespace matching independent from the cooldown library, so it can later support other package-filtering policies.

Validation

  • go test ./...
  • go vet ./...
  • go build ./cmd/proxy

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@andrew andrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both pkg:npm/@example/* and pkg:npm/%40example/* normalize to the same glob, but both entries remain in the sorted pattern list. If their durations differ, nondeterministic map iteration controls which entry matches first, so the same configuration can allow or block a package across restarts. Please deduplicate normalized globs with deterministic precedence, or reject conflicting entries, and add a collision test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@andrew andrew andrew requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /