Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Fix autocomplete (job kind and queue name) failing with a `relation "river_job" does not exist` error when River tables are in a non-default schema. [PR #517](https://github.com/riverqueue/riverui/pull/517).
- Workflow detail: add on-canvas zoom controls for click/touch navigation and improve controls styling for dark mode. [PR #524](https://github.com/riverqueue/riverui/pull/524).
- Workflow detail: improve default workflow diagram framing for legibility while still allowing manual zoom-out to view the full graph. [PR #524](https://github.com/riverqueue/riverui/pull/524).
- Workflow detail: truncate long workflow names in the header to prevent overflow and add a copy button for the full name. [PR #524](https://github.com/riverqueue/riverui/pull/524).
Expand Down
2 changes: 2 additions & 0 deletions handler_api_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func (a *autocompleteListEndpoint[TTx]) Execute(ctx context.Context, req *autoco
Exclude: req.Exclude,
Match: match,
Max: 100,
Schema: a.Client.Schema(),
})
if err != nil {
return nil, fmt.Errorf("error listing job kinds: %w", err)
Expand All @@ -133,6 +134,7 @@ func (a *autocompleteListEndpoint[TTx]) Execute(ctx context.Context, req *autoco
Exclude: req.Exclude,
Match: match,
Max: 100,
Schema: a.Client.Schema(),
})
if err != nil {
return nil, fmt.Errorf("error listing queue names: %w", err)
Expand Down
45 changes: 45 additions & 0 deletions handler_api_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,51 @@ func runAutocompleteTests(t *testing.T, facet autocompleteFacet, setupFunc func(
require.Len(t, resp.Data, 1)
require.Equal(t, "alpha_task", *resp.Data[0])
})

t.Run("WithNonDefaultSchema", func(t *testing.T) {
t.Parallel()

var (
logger = riversharedtest.Logger(t)
driver = riverpgxv5.New(riversharedtest.DBPool(ctx, t))
)

// DisableSchemaSharing is required because we need the schema name to configure the River client.
tx, schema := riverdbtest.TestTxPgxDriver(ctx, t, driver, &riverdbtest.TestTxOpts{DisableSchemaSharing: true})
exec := driver.UnwrapExecutor(tx)

client, err := river.NewClient(driver, &river.Config{
Logger: logger,
Schema: schema,
})
require.NoError(t, err)

endpoint := newAutocompleteListEndpoint(apibundle.APIBundle[pgx.Tx]{
Archetype: riversharedtest.BaseServiceArchetype(t),
Client: client,
DB: exec,
Driver: driver,
Extensions: func(_ context.Context) (map[string]bool, error) { return map[string]bool{}, nil },
Logger: logger,
})

setupFunc(t, &setupEndpointTestBundle{client: client, exec: exec, logger: logger, tx: tx})

// Reset search_path to simulate production conditions where the connection
// doesn't include the River schema; unqualified table names would then fail.
_, err = tx.Exec(ctx, "SET search_path TO 'public'")
require.NoError(t, err)

resp, err := apitest.InvokeHandler(ctx, endpoint.Execute, testMountOpts(t), &autocompleteListRequest{
Facet: facet,
})
require.NoError(t, err)
require.Len(t, resp.Data, 4)
require.Equal(t, "alpha_"+facet.baseString(), *resp.Data[0])
require.Equal(t, "alpha_task", *resp.Data[1])
require.Equal(t, "beta_"+facet.baseString(), *resp.Data[2])
require.Equal(t, "gamma_"+facet.baseString(), *resp.Data[3])
})
}

func (f autocompleteFacet) baseString() string {
Expand Down