Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move kt sys arch set to inside UniFFI.kt #111

Merged
merged 6 commits into from
Aug 9, 2024

Conversation

KendallWeihe
Copy link
Contributor

@KendallWeihe KendallWeihe commented Aug 9, 2024

Original cause of change was a failing release pipeline https://github.com/TBD54566975/tbdex-rs/actions/runs/10322927501/job/28580932157#step:9:375


Originally, I thought the issue was that the SystemArchitecture.set() code was detecting a mac environment even though the runner is ubuntu. I came to find out that the issue was actually that we have code paths which exist wherein SystemArchitecture.set() is not called prior to the initial loading of the UniFFI.kt's loadIndirect() function (here). Previously we had to carefully construct all code such that SystemArchitecture.set() was always the first function to be called, for example you can see so in the getOfferings() function here. But, this is not a very resilient way forward. Instead, what we should really do is augment the UniFFI.kt code such that it always sets the system arch prior-to it's native lib loading. For this, it may appear like a lot of code changes but here's what is changed:

  • Change the ci.yml's kotlin-build-test-deploy-snapshot job to run on ubuntu-latest. This way, the release.yml and ci.yml are always in-sync. (You can see I was able to recreate the original issue in the ci.yml here).
  • Set TBDEX_SDK_LOG_LEVEL: debug env var in both workflows such that we always see the what the system target detected is
  • Added a sed command inside the just bind recipe to augment the UniFFI code-gen'd file such that the system is always detected prior-to any UniFFI interactions
  • Removed the old SystemArchitecture.set() solution in place of the new detectSystemArchitecture()
  • Removed all prior calls to SystemArchitecture.set() and instead you can see the change to UniFFI.kt which makes use of the new detectSystemArchitecture()

bound/kt/pom.xml Outdated Show resolved Hide resolved
@KendallWeihe KendallWeihe changed the title Set TBDEX_SDK_LOG_LEVEL to debug for pipeline jobs Move kt sys arch set to inside UniFFI.kt Aug 9, 2024
Copy link
Contributor

@ALRubinger ALRubinger left a comment

Choose a reason for hiding this comment

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

Approved w/ Qs and comments in review. Don't see anything w/ naked eye blocking our giving this a shot.

@@ -106,7 +107,7 @@ jobs:
- build_x86_64_apple_darwin
- build_x86_64_unknown_linux_gnu
- build_x86_64_unknown_linux_musl
runs-on: macos-latest
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see an issue with this, but why this switch to Ubuntu building here? Seems fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is so our ci.yml's deploy (snapshot) is consistency with the release.yml's deploy (the final release)

AKA we would've caught this sooner had we run this on ubuntu

Copy link
Contributor

Choose a reason for hiding this comment

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

Great observation

Copy link
Contributor

Choose a reason for hiding this comment

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

I really wish mvn deploy could deploy to 2 servers in one go without rebuilding, but this is the best I could figure

@@ -39,6 +39,7 @@ bind-kotlin: setup
generate --library bound/kt/src/main/resources/libtbdex_uniffi_aarch64_apple_darwin.dylib \
--language kotlin \
--out-dir target/bindgen-kotlin
sed -i '' 's/findLibraryName(componentName)/detectSystemTarget()/' target/bindgen-kotlin/tbdex/sdk/rust/tbdex.kt
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need to reflect this in the local build commands as well or nah?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, just here

I have an action item to consider improvement around the just bind here

@ALRubinger
Copy link
Contributor

Recommend putting some more meat behind the Acceptance Test to help you catch this stuff; perhaps doing a simple tbDEX operation to flow through more of the stack @KendallWeihe ?

@KendallWeihe
Copy link
Contributor Author

Recommend putting some more meat behind the Acceptance Test

agreed! #108 (comment)

@KendallWeihe KendallWeihe merged commit 80f4dba into main Aug 9, 2024
10 checks passed
@KendallWeihe KendallWeihe deleted the kendall/pipeline-debug-logs branch August 9, 2024 21:09
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.

3 participants