astronomer-cosmos icon indicating copy to clipboard operation
astronomer-cosmos copied to clipboard

refactor: remove duplicated _construct_dest_file_path

Open jx2lee opened this issue 1 month ago • 2 comments

Description

Refactor destination path construction for remote object storage uploads in the Astronomer Cosmos library.

  • a new helper function construct_dest_file_path() in cosmos/io.py, responsible for normalizing and building destination paths for artifact upload.
  • Remove duplicated _construct_dest_file_path logic from the local dbt operator class; instead reuse the shared helper to keep both upload and local operator path logic
  • Add a unit test (tests/test_io.py) covering _construct_dest_file_path()

Related Issue(s)

closes #1746

Breaking Change?

No. This refactor preserves existing destination path semantics while changing internal implementation. Consumers invoking upload methods or operators will see no behavior change.

Checklist

  • [ ] I have made corresponding changes to the documentation (if required)
  • [x] I have added tests that prove my fix is effective or that my feature works

jx2lee avatar Nov 03 '25 15:11 jx2lee

Thanks a lot for doing this refactor, @jx2lee. Changes like this really help the Cosmos code base be easier to maintain.

I provided minor feedback inline, and I'm happy for us to merge this change once the tests pass.

Please, rebase based on the main branch

@tatiana Thanks for waiting ! I was on a trip(🇯🇵), so update took a bit longer. Rebase is all done, too!

jx2lee avatar Nov 08 '25 09:11 jx2lee

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
Latest commit c78dbf16eab206130b9bafae908f8c0da3a07f17
Latest deploy log https://app.netlify.com/projects/sunny-pastelito-5ecb04/deploys/6911ef828566270008b1277d

netlify[bot] avatar Nov 10 '25 12:11 netlify[bot]