Skip to content

Alidate supported modes - #101

Open
cryptoryda wants to merge 4 commits into
tempoxyz:mainfrom
cryptoryda:alidate-supported-modes
Open

Alidate supported modes#101
cryptoryda wants to merge 4 commits into
tempoxyz:mainfrom
cryptoryda:alidate-supported-modes

Conversation

@cryptoryda

Copy link
Copy Markdown
Contributor

Validate Tempo charge request modes

Summary

  • validate supported modes during NormalizeChargeRequest
  • apply the same validation while parsing generic request maps
  • add regression coverage for invalid local and wire-format values

Why

Unsupported modes previously produced challenges that advertised no usable
credential flow. Rejecting them at request boundaries catches configuration and
wire-format errors before an unsatisfiable challenge is issued.

Testing

go test ./pkg/tempo
go test ./...
go vet ./...

@brendanjryan

Copy link
Copy Markdown
Contributor

@codex review

@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: c2139ed630

ℹ️ 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".

Comment thread pkg/tempo/request.go Outdated
Comment on lines +160 to +162
if err := validateSupportedModes(params.SupportedModes); err != nil {
return ChargeRequest{}, err
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the duplicate validator that fails the new test

For every invalid SupportedModes value, this earlier call returns tempo: unsupported mode ..., so execution never reaches validateChargeModes, while the newly added TestChargeRequestRejectsUnsupportedModes requires the exact error tempo: unsupported charge mode .... Consequently the package test suite fails consistently; use a single validator or align the error contract.

AGENTS.md reference: AGENTS.md:L130-L134

Useful? React with 👍 / 👎.

@brendanjryan

Copy link
Copy Markdown
Contributor

@cryptoryda -- plz fix conflict 🙇

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.

2 participants