Fix wording, docs and style inconsistencies per audit of 0139564

This commit is contained in:
Ian Gulliver
2026-10-23 18:36:11 -07:00
parent 5a21396775
commit 681cc2b090
42 changed files with 469 additions and 453 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"errors"
"fmt"
"os"
"path/filepath"
"time"
@@ -50,7 +51,7 @@ func (s *Store) GetBlob(ctx context.Context, id string) (api.Blob, string, error
err := s.db.QueryRowContext(ctx, `SELECT id, content_type, created_by, created_at FROM blobs WHERE id = ?`, id).
Scan(&b.Id, &b.ContentType, &b.CreatedBy, &createdAt)
if errors.Is(err, sql.ErrNoRows) {
return b, "", errors.Join(ErrNotFound, errors.New("no blob "+id))
return b, "", fmt.Errorf("%w: no blob %s", ErrNotFound, id)
}
if err != nil {
return b, "", err
+2 -2
View File
@@ -63,7 +63,7 @@ func (s *Store) SaveLeadNote(ctx context.Context, owner, id, projectID, text, ac
err := tx.QueryRowContext(ctx, `UPDATE lead_notes SET text = ?, project_id = ?, updated_at = ? WHERE id = ? AND owner = ? RETURNING created_at`,
text, projectID, formatTime(at), id, owner).Scan(&createdAt)
if errors.Is(err, sql.ErrNoRows) {
return fmt.Errorf("note %s: %w", id, ErrNotFound)
return fmt.Errorf("%w: no note %s", ErrNotFound, id)
}
if err != nil {
return err
@@ -83,7 +83,7 @@ func (s *Store) DeleteLeadNote(ctx context.Context, owner, id, actor string) (st
err := s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
err := tx.QueryRowContext(ctx, `DELETE FROM lead_notes WHERE id = ? AND owner = ? RETURNING text`, id, owner).Scan(&text)
if errors.Is(err, sql.ErrNoRows) {
return fmt.Errorf("note %s: %w", id, ErrNotFound)
return fmt.Errorf("%w: no note %s", ErrNotFound, id)
}
if err != nil {
return err
+3 -3
View File
@@ -33,7 +33,7 @@ func (s *Store) SavedCommand(ctx context.Context, owner, id string) (api.SavedCo
c := api.SavedCommand{Id: id}
err := s.db.QueryRowContext(ctx, `SELECT name, command FROM saved_commands WHERE id = ? AND owner = ?`, id, owner).Scan(&c.Name, &c.Command)
if errors.Is(err, sql.ErrNoRows) {
return c, fmt.Errorf("saved command %s: %w", id, ErrNotFound)
return c, fmt.Errorf("%w: no saved command %s", ErrNotFound, id)
}
return c, err
}
@@ -57,7 +57,7 @@ func (s *Store) SaveSavedCommand(ctx context.Context, owner, id, name, command,
return err
}
if n == 0 {
return fmt.Errorf("saved command %s: %w", id, ErrNotFound)
return fmt.Errorf("%w: no saved command %s", ErrNotFound, id)
}
}
return emit(api.Event{Kind: "command.saved", Owner: &owner, Actor: actor, Payload: ToPayload(c)})
@@ -76,7 +76,7 @@ func (s *Store) DeleteSavedCommand(ctx context.Context, owner, id, actor string)
return err
}
if n == 0 {
return fmt.Errorf("saved command %s: %w", id, ErrNotFound)
return fmt.Errorf("%w: no saved command %s", ErrNotFound, id)
}
return emit(api.Event{Kind: "command.deleted", Owner: &owner, Actor: actor, Payload: map[string]any{"id": id}})
})
+2 -2
View File
@@ -71,7 +71,7 @@ func (s *Store) GetSchedule(ctx context.Context, id string) (api.Schedule, error
return api.Schedule{}, err
}
if len(list) == 0 {
return api.Schedule{}, fmt.Errorf("schedule %s: %w", id, ErrNotFound)
return api.Schedule{}, fmt.Errorf("%w: no schedule %s", ErrNotFound, id)
}
return list[0], nil
}
@@ -121,7 +121,7 @@ func (s *Store) DeleteSchedule(ctx context.Context, id, actor string) error {
projectID := ""
err := tx.QueryRowContext(ctx, `SELECT project_id FROM schedules WHERE id = ?`, id).Scan(&projectID)
if errors.Is(err, sql.ErrNoRows) {
return fmt.Errorf("schedule %s: %w", id, ErrNotFound)
return fmt.Errorf("%w: no schedule %s", ErrNotFound, id)
}
if err != nil {
return err
+1 -1
View File
@@ -37,7 +37,7 @@ func (s *Store) MarkSummaryRead(ctx context.Context, login, taskID string, seq i
return s.write(ctx, func(tx *sql.Tx, emit emitFunc) error {
err := tx.QueryRowContext(ctx, `SELECT id FROM tasks WHERE id = ?`, taskID).Scan(&taskID)
if errors.Is(err, sql.ErrNoRows) {
return fmt.Errorf("task %s: %w", taskID, ErrNotFound)
return fmt.Errorf("%w: no task %s", ErrNotFound, taskID)
}
if err != nil {
return err