📝 docs: add ADR for staged-only Git hooks formatting
- Add ADR-0012 documenting the decision to format only staged Go files - Update ADR README.md with new entry - Document rationale, alternatives, and verification results - Include future considerations for monitoring and CI/CD integration Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -48,14 +48,14 @@ func (sc *StepContext) iRequestTheHealthEndpoint() error {
|
||||
func (sc *StepContext) theResponseShouldBe(arg1, arg2 string) error {
|
||||
// The regex captures the full JSON from the feature file, including quotes
|
||||
// We need to extract just the key and value without the surrounding quotes and backslashes
|
||||
|
||||
|
||||
// Remove the surrounding quotes and backslashes
|
||||
cleanArg1 := strings.Trim(arg1, `"\`)
|
||||
cleanArg2 := strings.Trim(arg2, `"\`)
|
||||
|
||||
|
||||
// Build the expected JSON string
|
||||
expected := fmt.Sprintf(`{"%s":"%s"}`, cleanArg1, cleanArg2)
|
||||
|
||||
|
||||
return sc.client.ExpectResponseBody(expected)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func (sc *StepContext) theServerIsRunningWithV2Enabled() error {
|
||||
if err := sc.client.Request("GET", "/api/ready", nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// Check if v2 endpoint is available (should return 405 Method Not Allowed for GET, which means endpoint exists)
|
||||
// If v2 is disabled, this will return 404
|
||||
resp, err := sc.client.CustomRequest("GET", "/api/v2/greet", nil)
|
||||
@@ -78,13 +78,13 @@ func (sc *StepContext) theServerIsRunningWithV2Enabled() error {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
||||
// If we get 405, v2 is enabled (endpoint exists but doesn't allow GET)
|
||||
// If we get 404, v2 is disabled
|
||||
if resp.StatusCode == 404 {
|
||||
return fmt.Errorf("v2 endpoint not available - v2 feature flag not enabled")
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ func NewClient(server *Server) *Client {
|
||||
|
||||
func (c *Client) Request(method, path string, body interface{}) error {
|
||||
url := c.server.GetBaseURL() + path
|
||||
|
||||
|
||||
var reqBody io.Reader
|
||||
if body != nil {
|
||||
// Handle different body types
|
||||
@@ -42,12 +42,12 @@ func (c *Client) Request(method, path string, body interface{}) error {
|
||||
return fmt.Errorf("unsupported body type: %T", body)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
req, err := http.NewRequest(method, url, reqBody)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Set content type for JSON bodies
|
||||
if body != nil && reqBody != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
@@ -70,7 +70,7 @@ func (c *Client) Request(method, path string, body interface{}) error {
|
||||
|
||||
func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Response, error) {
|
||||
url := c.server.GetBaseURL() + path
|
||||
|
||||
|
||||
var reqBody io.Reader
|
||||
if body != nil {
|
||||
// Handle different body types
|
||||
@@ -89,12 +89,12 @@ func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Res
|
||||
return nil, fmt.Errorf("unsupported body type: %T", body)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
req, err := http.NewRequest(method, url, reqBody)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Set content type for JSON bodies
|
||||
if body != nil && reqBody != nil {
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
@@ -104,7 +104,7 @@ func (c *Client) CustomRequest(method, path string, body interface{}) (*http.Res
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("request failed: %w", err)
|
||||
}
|
||||
|
||||
|
||||
// Don't close the body here - let the caller handle it
|
||||
c.lastResp = resp
|
||||
c.lastBody, err = io.ReadAll(resp.Body)
|
||||
@@ -123,7 +123,7 @@ func (c *Client) ExpectResponseBody(expected string) error {
|
||||
actual := string(c.lastBody)
|
||||
// Trim trailing newline if present (common in JSON responses)
|
||||
actual = strings.TrimSuffix(actual, "\n")
|
||||
|
||||
|
||||
if actual != expected {
|
||||
return fmt.Errorf("expected response body %q, got %q", expected, actual)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
httpServer *http.Server
|
||||
httpServer *http.Server
|
||||
port int
|
||||
baseURL string
|
||||
}
|
||||
@@ -94,8 +94,8 @@ func createTestConfig(port int) *config.Config {
|
||||
Timeout: 5 * time.Second,
|
||||
},
|
||||
Logging: config.LoggingConfig{
|
||||
JSON: false,
|
||||
Level: "trace",
|
||||
JSON: false,
|
||||
Level: "trace",
|
||||
},
|
||||
Telemetry: config.TelemetryConfig{
|
||||
Enabled: false,
|
||||
|
||||
Reference in New Issue
Block a user