Catalog: honor a bucket's Athena preferences in the workspace console (5217 stack 9/9) - #5267
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## stack/5217-8-queries-legacy-redirect-scope #5267 +/- ##
==============================================================================
+ Coverage 36.02% 36.69% +0.66%
==============================================================================
Files 741 742 +1
Lines 23841 23858 +17
Branches 6438 6443 +5
==============================================================================
+ Hits 8589 8754 +165
+ Misses 13520 13383 -137
+ Partials 1732 1721 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2e9a958 to
ad6f7ae
Compare
ad6f7ae to
53e5a57
Compare
53e5a57 to
7f0d0b4
Compare
7f0d0b4 to
bc519b7
Compare
bc519b7 to
37026c1
Compare
37026c1 to
906dcdc
Compare
906dcdc to
fcae903
Compare
fcae903 to
84b2e60
Compare
84b2e60 to
f730b76
Compare
The comments retold what the change did and what the old code got wrong; the tests already pin that. Keep only what the code cannot show: why the canonical spelling has to be used, why the preference crosses as a string, and that storage-before-default is inherited product behaviour. Restore the stubbed mocks in a finally: afterEach only clears call data, so a failing assertion leaked the stub into every later test in the file. The changelog entry now claims only what this layer ships on its own -- the bucket default it also mentioned is not wired until #5267, which announces it.
f730b76 to
005518c
Compare
4ebd299 to
ed3a03b
Compare
Local review passReviewed this layer on its own diff ( Accepted: the single-mount guarantee only held in one direction
Fixed by gating only the first render, which is the one that matters — the workgroup resolved then is pinned into the URL by Declined: "Add bucket" in the source-bucket pickerRaised as: on the Athena console The two cannot diverge. Checked, unchanged
Also swept this layer's comments and its CHANGELOG entry down to the constraints they carry, dropping the why-of-change narration. Verification on the final commit, from |
…onsole `ui.athena.defaultWorkgroup` is a per-bucket preference and the Athena console is workspace-global, so the preference applies exactly when a bucket is in scope through `?bucket=` — which every legacy `/b/:bucket/queries/...` URL now redirects with. The console mounts the bucket's preferences in that case and passes `ui.athena` to the model; without a bucket there is no preference document to consult and it behaves as before. In-console links (the breadcrumb back to Query Executions, and each execution row in History) keep the query string, so following one does not drop the scope. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ot be on addresses review finding f30 The unconditional `<Model.Provider>` this branch replaces kept the Athena console outside any `BucketPreferences.Provider`, and that absence is what made the create-package Files panel inert there. Scoping the console re-establishes the provider, and nothing re-established the inertness — so on `/queries/athena/<wg>?bucket=<b>`, Create package → "Add files from bucket" mounted `BucketSelect`, which read a `:bucket` route segment that route does not have and asserted it. The nearest error boundary is the app root, so the throw **replaced the whole catalog screen** rather than failing the panel. The route param was only ever a fallback for `BucketPreferences`' own handle. It is treated as one now, with the picker's current selection as a last resort that cannot be absent. Where a `:bucket` segment exists the behaviour is unchanged. `BucketSelect` is exported so the mount can be driven from a route without the segment; the test fails with the original assertion in place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review finding f41
The console's `?bucket=` scope was parsed byte-for-byte identically in two
places -- the console wrapper and the tabulator table list -- and a repo-wide
search for `get('bucket')` found exactly those two. The earlier dismissal of
this said "extract a `useBucketScope()` when a third appears"; the wrapper is
about to branch on the scope in a second place, which is the third.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review findings f31, f2 `Model.Provider` owns the query being typed, the selected catalog and the selected database. Scoping the console put it behind an `if (!bucket)` early return, which made the scoped and unscoped consoles two structurally different trees -- and React reconciles by position, so the console's mount identity started depending on whether `?bucket=` was present. Clicking the "Athena" tab (which linked to a bare pathname) flipped the branch, remounted the provider and discarded everything in it. Both halves are fixed: - The tab strip keeps the query string on both tabs, so switching consoles and coming back no longer lands the reader in a different console from the one they left. That was the live navigation site the scope-carrying fix stopped short of. - `BucketPreferences.Provider` takes `bucket: string | null` and, with no bucket, serves the state a consumer sees outside any provider -- no document, no handle, no update, and no fetch -- instead of the subtree being unmounted. The console mounts it either way, so there is one `Model.Provider` element at one position for both cases. A scoped console still waits for its document before mounting the model: the workgroup is seeded once and a default arriving later would not displace it. So acquiring a scope is a mount, as it has to be; losing one is a re-render. The mount test counts mounts rather than renders, and fails against the early return. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review finding f17 Both documents that describe this behaviour said nothing about the scope the behaviour now depends on: the preferences reference presented `ui.athena.defaultWorkgroup` as if it applied to the Athena page unconditionally, and the console's own state spec gave three URLs with no `?bucket=` anywhere. The preferences reference now says when a bucket is in scope and when it is not, and notes that a remembered workgroup outranks the default. The state spec gets a section on the scope as a precondition rather than as state, and the optional param on each URL. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
addresses review findings f44, f27, f33 The claim narrows to what the code does: a workgroup the reader has picked before is still remembered and still outranks the bucket default, so "honors that bucket's defaultWorkgroup again" is true for readers who have not picked one. Whether that precedence should be reversed is the open question raised on the workgroup-resolution PR below this one, and reversing it is not hardening. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ed3a03b to
5cbf066
Compare
Description
ui.athena.defaultWorkgroupis a per-bucket preference, and the Athena consoleis workspace-global — so since the re-home the console had no bucket whose
preferences to read, and the setting silently stopped working. This is the
consumer half of the pair: PR 8 makes every legacy
/b/:bucket/queries/athena...URL carry the bucket as
?bucket=, and this PR makes the console read it, mountthat bucket's preferences, and hand
ui.athenato the model.The scope has to survive navigation, or it is worse than nothing. A reader
who lands scoped and then clicks anything in-console would drop the scope and
land in a different console than the one they left. Three link sites now carry
the query string forward: the breadcrumb back to Query Executions, each execution
row in History, and the Queries tab strip.
Two defects the scoped mount introduced, fixed here rather than shipped:
<Model.Provider>this replaceskept the console outside any
BucketPreferences.Provider, and that absence iswhat made the create-package Files panel inert there. Scoping re-establishes
the provider; nothing re-established the inertness. So on
/queries/athena/<wg>?bucket=<b>, Create package → "Add files from bucket"mounted
BucketSelect, which read a:bucketroute segment that route doesnot have and asserted it — and the nearest error boundary is the app root, so
the throw replaced the whole catalog screen rather than failing the panel.
?bucket=made the console's mount identity depend on the param, so losing the scope
remounted
Model.Providerand discardedqueryBody, the selected catalog andthe selected database with it.
Re-scoping a workspace-level console with
?bucket=is a direction call, andno artifact in this repository makes it. Both readings are live and neither is
refutable from the checkout: this PR's (a per-bucket preference needs a bucket in
scope), and the alternative the original description never weighs (a
workspace-level default, leaving the console bucket-free).
queryRedirects.jsxstates the re-home's premise in a comment, not a decision record; the console's
own state spec modelled no
?bucket=state before this PR; there are no linkedissues. A maintainer should rule before this merges. Everything below it in
the stack stands on its own either way — which is why it is last.
Review findings addressed
— the crash, above. The route param was only ever a fallback for
BucketPreferences' own handle; it is treated as one now, with the picker'scurrent selection as a last resort that cannot be absent.
BucketSelectisexported so the mount can be driven from a route without the segment, and the
test fails with the original assertion in place.
— the remount, above.
BucketPreferences.Providertakesbucket: string | nulland with no bucket serves the state a consumer seesoutside any provider — no document, no handle, no update, no fetch — instead of
the subtree being unmounted. The console mounts it either way, so there is one
Model.Providerelement at one position for both cases. A scoped console stillwaits for its document before mounting the model (the workgroup is seeded once,
and a default arriving later would not displace it), so acquiring a scope is
a mount, as it has to be; losing one is a re-render. The test counts mounts
rather than renders.
scope-carrying fix stopped short of: the tab strip linked to bare pathnames.
link sites are pinned now, in both directions.
the behaviour. The preferences reference now says when a bucket is in scope and
when it is not; the console's state spec gets a section on the scope as a
precondition rather than as state, and the optional param on each URL.
?bucket=parse was duplicated byte-for-byte in the consolewrapper and the tabulator table list, and a repo-wide search for
get('bucket')found exactly those two. The earlier dismissal said "extract auseBucketScope()when a third appears"; this PR needed the scope in a secondplace in the wrapper, which is the third.
Recorded, not acted on:
_: () => <Placeholder/>arm is not aterminal-error trap. The pre-existing wrapper matched
_ → Placeholderidentically.
is the
?bucket=×?table=tabulator deep-link interaction. Both paramsride the same query string and both are now load-bearing; that interaction is
worth a reviewer's attention here specifically.
Dependencies
Hardening review of master
(
6167dd82) against the26.7.4 pin (
eda3016f) —linked rather than named, so the cross-version seam can actually be read.
Beyond the original diff
Three files here are not in #5217 and arrive with the fold-ins:
Queries.tsx/Queries.spec.tsx(f2),utils/BucketPreferences/Provider.tsxplus a spec (f31),
PackageDialog/Inputs/Files/S3FilePicker.tsxplus a spec(f30), and
Athena/scope.ts(f41).Verification
12 files, 141 tests. The whole catalog suite (183 files, 1720 tests) is green,
tsc --noEmitis clean, andoxlint appreports nothing.Position in the stack
PR 9 of 9, based on
stack/5217-8-queries-legacy-redirect-scope.Part of the split of #5217 asked for in
f27.
Last, for two reasons: it is the consumer of PR 8's producer, and it is the only
unit blocked on the direction ruling above. It also carries the crash, so it is
the one unit that should not be waved through.
TODO
🤖 Generated with Claude Code
Greptile Summary
The PR restores bucket-scoped Athena preferences in the workspace query console while preserving console state when scope changes.
bucketquery parameter through a shared scope hook and mounts bucket preferences around the Athena model.Confidence Score: 5/5
The PR appears safe to merge, with no concrete changed-code failure remaining after reviewing scoped loading, navigation, and provider transitions.
The scoped provider avoids unscoped fetches, navigation retains the required bucket parameter, and the file picker now has a valid fallback when no bucket route segment exists.
Important Files Changed
Sequence Diagram
Reviews (1): Last reviewed commit: "docs(changelog): entry for the bucket-sc..." | Re-trigger Greptile