Skip to content

Carry the bucket scope through the workgroup/execution query redirects - #5234

Open
QuiltSimon wants to merge 8 commits into
masterfrom
fix/athena-redirect-search
Open

Carry the bucket scope through the workgroup/execution query redirects#5234
QuiltSimon wants to merge 8 commits into
masterfrom
fix/athena-redirect-search

Conversation

@QuiltSimon

@QuiltSimon QuiltSimon commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Found reviewing the 26.8.0 candidate. containers/App/queryRedirects.jsx holds three sibling redirects from the legacy bucket-scoped query routes to the workspace-global console. AthenaRootRedirect is careful — it promotes the bucket segment to the console's ?bucket= scope param and spreads the rest of the search through, with a comment saying why. AthenaWorkgroupRedirect and AthenaExecutionRedirect did neither.

So a bookmark or shared link to /b/my-bucket/queries/athena/primary landed on /queries/athena/primary with no bucket selected, and any other param — a ?table= Tabulator deep link, which the sibling's comment explicitly exists to keep alive — was dropped.

The fix

The workgroup and execution url builders take their path segments positionally (queriesAthenaWorkgroup(workgroup)), so there is no argument to thread params through. Both now build a {pathname, search} redirect descriptor via a small local helper, matching what the root redirect achieves through its builder.

Tests

Two existing specs asserted the old behavior as intentional ("redirects an athena workgroup, dropping the bucket"); those assertions are updated, since that is exactly the behavior being corrected. Two new specs cover param preservation on both routes.

Verified as real regression tests rather than tautologies: reverting queryRedirects.jsx to master and re-running fails exactly the 4 new/changed cases while the 3 pre-existing ones still pass.

  • TZ=UTC npx vitest run app/containers/App/queryRedirects.spec.tsx — 7 passed
  • npx tsc --noEmit -p . — clean

Notes

Ships with its catalog/CHANGELOG.md entry.

🤖 Generated with Claude Code

Greptile Summary

This PR updates legacy bucket-scoped Athena workgroup and execution redirects to retain bucket and query-string state when entering the workspace-global console.

  • Adds a shared redirect descriptor helper that serializes the bucket scope with existing parameters.
  • Expands redirect tests for bucket and table preservation.
  • Documents the redirect correction in the changelog.

Confidence Score: 4/5

The conflicting-bucket precedence should be fixed before merging because crafted or stale legacy links can open the Athena console in the wrong bucket context.

The new merge order lets incoming search state replace the bucket captured from the legacy route, and the resulting value directly controls the global Athena console’s table and query scope.

Files Needing Attention: catalog/app/containers/App/queryRedirects.jsx

Important Files Changed

Filename Overview
catalog/app/containers/App/queryRedirects.jsx Adds search-state propagation to workgroup and execution redirects, but permits an incoming bucket query parameter to override the path-derived scope.
catalog/app/containers/App/queryRedirects.spec.tsx Covers bucket and ordinary parameter preservation but omits the conflicting-bucket precedence case.
catalog/CHANGELOG.md Accurately describes the intended legacy redirect correction.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Legacy /b/:bucket/queries/athena/:workgroup[/execution]?params"] --> B["BucketQueriesRedirect"]
  B --> C["withBucketScope"]
  C --> D["Global /queries/athena/:workgroup[/execution]?bucket=:bucket&params"]
  D --> E["Athena console"]
  E --> F["Bucket-scoped Tabulator tables and query defaults"]
Loading

Reviews (1): Last reviewed commit: "Point the changelog entry at the actual ..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

Context used:

smkohnstamm and others added 2 commits August 27, 2026 10:14
AthenaRootRedirect promotes the legacy bucket segment to the console's
`?bucket=` scope and spreads the rest of the search through. Its two
siblings in the same file did neither, so a legacy workgroup or execution
link landed on the global console with no bucket selected and any
`?table=` Tabulator deep link dropped.

The workgroup/execution url builders take their path segments
positionally, so the params ride as `search` on the redirect descriptor.

Two specs asserted the old behavior ("dropping the bucket") as intended;
they now assert the scope is carried, plus two new cases covering param
preservation.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 34.94%. Comparing base (fe9bda5) to head (f221ee7).

❗ There is a different number of reports uploaded between BASE (fe9bda5) and HEAD (f221ee7). Click for more details.

HEAD has 25 uploads less than BASE
Flag BASE (fe9bda5) HEAD (f221ee7)
lambda 14 0
py-shared 1 0
api-python 10 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5234       +/-   ##
===========================================
- Coverage   55.20%   34.94%   -20.27%     
===========================================
  Files         872      741      -131     
  Lines       36766    23808    -12958     
  Branches     6429     6431        +2     
===========================================
- Hits        20298     8319    -11979     
+ Misses      14724    13745      -979     
  Partials     1744     1744               
Flag Coverage Δ
api-python ?
catalog 34.94% <100.00%> (+0.01%) ⬆️
lambda ?
py-shared ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

// bucket scope and any other params ride along as `search` on the redirect
// descriptor rather than through the url builder.
function withBucketScope(pathname, bucket, search) {
return { pathname, search: mkSearch({ bucket, ...parseSearch(search, true) }) }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Query overrides bucket scope

When a legacy workgroup or execution URL contains a conflicting ?bucket=, spreading the parsed search after the path-derived bucket makes the query value win, causing Tabulator tables and generated query defaults to use a different bucket than the legacy route names.

Suggested change
return { pathname, search: mkSearch({ bucket, ...parseSearch(search, true) }) }
return { pathname, search: mkSearch({ ...parseSearch(search, true), bucket }) }

Knowledge Base Used: Catalog client features

smkohnstamm and others added 6 commits August 27, 2026 10:27
The header said these components were extracted unchanged and redirect
'exactly as before'. This branch changes two of their targets, so both
clauses were false and would send someone debugging a bucket-scope
regression looking elsewhere. Keep the constraint, cut the history.

Co-Authored-By: Claude <noreply@anthropic.com>
Review of the first pass found three defects in it.

The path bucket lost to a stale `?bucket=` in the query string, because
the parsed search was spread after it — so a hand-edited or stale param
silently rescoped the console away from the bucket the link named.

Forwarding `?table=` onto an execution route fired TabulatorTables'
autofill, overwriting the editor contents that came from the execution's
own SQL with a SELECT unrelated to the results on screen. The execution
builder does not accept `table` at all now.

And the workgroup/execution redirects hand-built their search while the
bare-console one went through a builder that keeps only `{bucket, table}`,
so the three disagreed about which params survive. The two positional
builders now take the same opts object, sharing one AthenaConsoleOpts
type, and the hand-rolled helper is gone.

Co-Authored-By: Claude <noreply@anthropic.com>
Omit<AthenaConsoleOpts, 'table'> means a caller passing table gets a
compile error instead of a silent drop, so the invariant the comment
describes is enforced. Also drop a stale sentence describing a params
argument neither builder has.

Co-Authored-By: Claude <noreply@anthropic.com>
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