jedcunningham opened a new pull request, #76479:
URL: https://github.com/apache/airflow/pull/76479

   The Dag bundle file list showed a "View error" button on every file with an 
import error. Whether the user could read that error was only decided when the 
dialog fetched it from `GET /importErrors`, so a user without access clicked 
through to a "You don't have permission" dialog.
   
   `GET /dagBundles/{name}/files` now returns `can_read_import_error` for each 
file, computed per caller with the same rules as `GET /importErrors`:
   
   - the caller needs the Import Errors view;
   - for a file that registered Dags, they need read access to at least one of 
them (a file they can read only partly still counts, as the error comes back 
with its stack trace redacted);
   - for a file that registered no Dag, they need `IMPORT_ERRORS_ALL` for the 
bundle's team.
   
   The UI shows "View error" only when the flag is true. Otherwise it shows a 
subtle red badge with the file-warning icon and the count, plus a tooltip, "You 
don't have permission to read this import error.", reusing the existing 
translation. The badge is subtle rather than solid to match `StatusChip` in the 
Dag header, which keeps the solid form for markers you can click. 
`import_error_count` stays unfiltered, since bundle access already covers 
knowing that a file is broken.
   
   The check lives in a new `services/public/import_errors.py` helper. The two 
import-error endpoints keep their own logic for now; moving them onto the 
helper is a possible follow-up.
   
   Admin, who can read every error:
   
   <img width="1280" height="720" alt="preview-bundle-files-admin" 
src="https://github.com/user-attachments/assets/4e1a158d-8a8b-4ee4-807d-2d324292c18c";
 />
   
   
   A user who can read only the `team_a_*` Dags: `team_b.py` and 
`never_parsed.py` show only the count, and `shared.py` still offers the 
redacted error:
   
   <img width="1280" height="720" alt="preview-bundle-files-team-a" 
src="https://github.com/user-attachments/assets/4674dfb3-674d-4a90-b11d-b480ee629b90";
 />
   


-- 
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