Skip to content

[DEVOPS-4158] feat: add context support to client requests#31

Merged
Richard Boisvert (rbstp) merged 1 commit intomasterfrom
devops/context
Jan 9, 2026
Merged

[DEVOPS-4158] feat: add context support to client requests#31
Richard Boisvert (rbstp) merged 1 commit intomasterfrom
devops/context

Conversation

@rbstp
Copy link
Contributor

@rbstp Richard Boisvert (rbstp) commented Jan 9, 2026

C'est surtout pour ne plus devoir faire un wrapping de timeout dans external-secrets/external-secrets#5712

Summary

Add context.Context support to all client HTTP requests, enabling request cancellation, timeouts, and context value propagation.

Changes

  • Add RequestWithContext as the core context-aware request handler
  • Add *WithContext variants for all public service methods:
    • Vaults: Get, New, Update, Delete, ValidatePassword
    • EntryCredentialService: Get, GetById, New, Update, Delete, DeleteById
    • EntryCertificateService: Get, GetFileContent, GetPassword, NewURL, NewFile, Update, Delete
    • EntryHostService: Get, GetHostDetails
    • EntryWebsiteService: Get, GetWebsiteDetails
    • Client: GetPublicServerInfo, GetPrivateServerInfo, GetServerTimezones
  • Propagate context through internal methods (login, isLogged, rawRequest, attachment operations)
  • Preserve backward compatibility: original methods delegate to context.Background()

Tests

  • Context cancellation
  • Context timeout
  • Context value propagation
  • Successful requests without cancellation

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

🤖 You did not bump the version, a release won't be created ⚠️

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds comprehensive context support to all client HTTP requests, enabling cancellation, timeout control, and context value propagation throughout the DVLS Go SDK. The changes maintain backward compatibility by keeping existing methods and adding new *WithContext variants.

Key Changes:

  • Introduced RequestWithContext and rawRequestWithContext methods using http.NewRequestWithContext for proper context handling
  • Added *WithContext variants for all public API methods across vaults, server info, and entry operations
  • Implemented comprehensive test suite validating context cancellation, timeout, and propagation behavior

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dvls.go Added RequestWithContext and rawRequestWithContext methods; existing Request method now delegates to context variant with context.Background()
authentication.go Added context support to internal login and isLogged methods for proper context propagation
vaults.go Added *WithContext variants for all vault operations (Get, New, Update, Delete, ValidatePassword)
server.go Added *WithContext variants for server info and timezone retrieval methods
entry_credential.go Added *WithContext variants for all credential entry operations with proper internal context threading
entry_certificate.go Added *WithContext variants for certificate entry operations including file uploads
entry_website.go Added *WithContext variants for website entry operations
entry_host.go Added *WithContext variants for host entry operations
entry_attachments.go Updated internal attachment methods to accept and propagate context
context_test.go New comprehensive test suite covering cancellation, timeout, and context propagation scenarios
VERSION Bumped version from 0.14.0 to 0.15.0 (appropriate minor version increment)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rbstp Richard Boisvert (rbstp) marked this pull request as ready for review January 9, 2026 16:41
@rbstp Richard Boisvert (rbstp) merged commit 5c981cd into master Jan 9, 2026
7 of 8 checks passed
@rbstp Richard Boisvert (rbstp) deleted the devops/context branch January 9, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants