tanishqgandhi1908 opened a new pull request, #8386:
URL: https://github.com/apache/texera/pull/8386

   ### What changes were proposed in this PR?
   
   Every page has an Owner dropdown, and it should list the people who own the 
things on that page. On the unified search page and on the hub, it didn't.
   
   | Page | What the page shows | What the dropdown listed | |
   |---|---|---|---|
   | Your Work → Workflows / Datasets / Models | what you own or were granted | 
owners of those | ✅ |
   | Search — Workflow tab | your + public workflows | owners of your workflows 
| ⚠️ missing public owners |
   | Search — Dataset tab | your + public datasets | owners of your 
**workflows** | ❌ wrong kind |
   | Search — Model tab | your + public models | owners of your **workflows** | 
❌ wrong kind |
   | Search — All tab | your + public, all kinds | owners of your **workflows** 
| ❌ wrong kind |
   | Hub → Workflows / Datasets / Models | **public** resources | owners of 
**your private** resources | ❌ wrong people |
   
   Two causes:
   
   1. **The search page never told the filter which tab was active.** 
`search.component.html` rendered `<texera-filters>` with no `[entityType]`, so 
the bar kept its `EntityType.Workflow` default on every tab.
   2. **Nothing could ask "who owns the published ones?"** All three `*-owners` 
endpoints filter on the caller's own access rows, which is right for Your Work 
and wrong for the hub.
   
   Reproduced before the fix, with `texera` owning 2 workflows / 3 datasets / 3 
models, `bob` owning 1 workflow and 1 private dataset, and `alice` owning 1 
public model:
   
   | | Before | After |
   |---|---|---|
   | Search → Model tab, dropdown | `texera`, `[email protected]` — bob owns no 
model | `texera`, `[email protected]` — the public model's owner |
   | …ticking the wrong name | tab goes **empty** | no wrong name is offered |
   | Hub → Datasets as bob, dropdown | `[email protected]`, `texera` — bob has 
nothing public | `texera` — exactly the owner on screen |
   | …ticking `bob` | hub goes **empty** | bob is no longer offered |
   
   **Backend — one endpoint, not three.** `HubResource.getCount` already runs 
`where(isPublicColumn.eq(true))` over a per-kind registry covering all three 
kinds, so `GET /hub/owners?entityType=` is its sibling. `BaseEntityTable` gains 
a `joinWithOwner`, implemented once in `VersionedResourceTables` for dataset 
and model, and once for workflow. Deliberately not
   `joinWithAccessAndOwner(None)`, which left-joins the access table and fans 
out a row per grant. The three existing `*-owners` endpoints are untouched.
   
   **Frontend.** `FiltersComponent` gains an `ownerScope` input, and 
`entityType` accepts `null` for a page listing every kind. 
`ResourceRegistryService.ownersFor(type, scope)` resolves the rest:
   
   `FiltersComponent` now implements `OnChanges`, so switching tabs refetches; 
the reload runs through a `switchMap`, or a fast run of tab clicks would let a 
stale response land last and repopulate the facet with the previous kind's 
owners.
   
   **Deliberately unchanged:** signed-out visitors still get no Owner dropdown. 
The list is email addresses, and serving those to anonymous callers on a public 
hub is email harvesting — so the new endpoint is `@RolesAllowed` like its 
siblings.
   
   **Behaviour worth calling out in review:** switching tabs with an owner chip 
selected that the new kind has no owner for drops the chip and shows the 
existing "Invalid owner name" toast. Silently keeping it is what produced the 
mystery-empty page this PR is fixing.
   
   <img width="1440" height="900" alt="issue6-1-search-models-owner-before" 
src="https://github.com/user-attachments/assets/a2c2d195-4297-4285-910c-6cb0d077b3e7";
 />
   <img width="1440" height="900" alt="issue6-1-search-models-owner-after" 
src="https://github.com/user-attachments/assets/87ac9eb1-4990-4e71-84b4-b7abfaca0b71";
 />
   <img width="1440" height="900" alt="issue6-2-hub-datasets-owner-before" 
src="https://github.com/user-attachments/assets/bf3b69fa-4e80-4a88-86ea-3b9e19a6dd16";
 />
   <img width="1440" height="900" alt="issue6-2-hub-datasets-owner-after" 
src="https://github.com/user-attachments/assets/10ed7a5e-d1c2-402b-8a6c-55e5bcd67b7a";
 />
   
   ### Any related issues, documentation, discussions?
   
   Closes #8385.
   
   ### How was this PR tested?
   
   **Backend** — 6 new cases in `HubResourceSpec` (82 passed):
   
   - owners of published workflows and no one else
   - an owner named once however many public entities they have
   - **a grant is ignored** — the bug itself: a user holding a grant but 
publishing nothing is not offered
   - each kind kept to its own table, with a different owner per kind so a 
mix-up cannot pass
   - owners of private entities left out
   - nobody named for a public workflow with no owner row
   
   **Frontend** — 277 passed across the eight affected specs. New cases cover: 
per-scope routing
   (asserting the *other* endpoint is not called), the union across kinds, a 
person owning several kinds
   named once, a kind whose request fails contributing nothing rather than 
blanking the facet, reload on
   kind change, exactly one load on first render, and both the dropped and the 
surviving owner chip.
   
   ```
   sbt 'testOnly *HubResourceSpec *EntityTablesSpec'
   cd frontend && npx ng test --include 
src/app/dashboard/component/user/filters/filters.component.spec.ts \
     --include 
src/app/dashboard/service/user/resource-registry/resource-registry.service.spec.ts
 \
     --include src/app/dashboard/component/user/search/search.component.spec.ts 
\
     --include 
src/app/hub/component/hub-search-result/hub-search-result.component.spec.ts
   ```
   End-to-end against a local stack: the table above is the actual 
before/after, and
   `GET /hub/owners` returns `["texera"]` for datasets where the old 
access-scoped endpoint returned
   `["[email protected]","texera"]`.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to