fix(spur-spank): rename SPANK exports to Slurm-compatible symbols#429
Merged
Conversation
Rename spur_spank_* exports to spank_*/slurm_* and align signatures and item IDs to spank.h so existing Slurm SPANK plugins resolve their symbols. Export dynamic symbols from spurd so plugins can dlsym them. Co-authored-by: Cursor <cursoragent@cursor.com>
biluriuday
requested review from
sajmera-pensando,
sgopinath1,
shiv-tyagi and
yansun1996
as code owners
July 13, 2026 07:19
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #429 +/- ##
==========================================
+ Coverage 70.85% 71.99% +1.14%
==========================================
Files 140 141 +1
Lines 41849 43196 +1347
==========================================
+ Hits 29650 31095 +1445
+ Misses 12199 12101 -98 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Renames the SPANK host exports to Slurm-compatible spank_*/slurm_* symbols and adjusts ABI-facing signatures/IDs so existing Slurm SPANK plugins can resolve and call into Spur’s host process (spurd).
Changes:
- Add a
spurdbuild script to export dynamic symbols for runtimedlopen/dlsymresolution. - Align
spur-spankexported symbol names, return codes, item IDs, and add basic env/job-control env helpers plus Slurm-style logging symbol stubs. - Extend SPANK-focused tests to validate item ID discriminants and
spank_setenv/spank_getenvbehavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| crates/spurd/build.rs | Adds linker argument emission to export dynamic symbols from the spurd binary. |
| crates/spur-tests/src/t58_spank.rs | Adds test coverage for Slurm item ID discriminants and env round-trip behavior. |
| crates/spur-spank/src/lib.rs | Renames exports to spank_*/slurm_*, aligns enums/return codes, adds env helpers + symbol retention anchor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Thread a caller-owned SpankHandle through invoke_hook so plugin env edits survive and are merged into the launched job's environment, seed the handle from the job env/context, and pass plugstack arguments to hooks as ac/argv. Move exported-symbol retention to the linker (--undefined + --export-dynamic, guarded on the target OS) and drop the runtime anchor. Return ESPANK_NOT_AVAIL for known-but-unsupported spank_get_item ids. Co-authored-by: Cursor <cursoragent@cursor.com>
shiv-tyagi
reviewed
Jul 14, 2026
shiv-tyagi
left a comment
Member
There was a problem hiding this comment.
A few suggestions, all minor, nothing blocking. Symbol/enum ordering against spank.h looks correct and the tests are thorough. PTAL.
Scope dynamic symbol export with a generated --dynamic-list instead of --export-dynamic so only the SPANK API is exposed. Seed uid/gid into the TaskExit/JobEpilog handle for parity with the launch path. Drop the item-id test in spur-tests that duplicates the spur-spank unit test. Co-authored-by: Cursor <cursoragent@cursor.com>
shiv-tyagi
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix SPANK ABI and wire up plugin env/args (#294)
Existing Slurm SPANK plugins failed against Spur's host: the API symbols used a
spur_spank_*prefix, and even after loading, plugins couldn't affect the job. This makes the SPANK host drop-in compatible with Slurm'sspank.h.What changed
ABI / symbol compatibility
spank.h:spank_get_item,spank_setenv(added theoverwritearg), plus newspank_getenv,spank_unsetenv,spank_job_control_{set,get,unset}env,spank_strerror, and theslurm_error/info/verbose/debug/debug2/debug3+slurm_spank_logloggers.SpankItemdiscriminants to match Slurm'senum spank_item(previously mis-ordered, soS_JOB_IDreturned the gid).ESPANK_*return codes;spank_get_itemnow returnsESPANK_NOT_AVAILfor known-but-unsupported items vsESPANK_BAD_ARGfor unknown ids.spurdexport these symbols in its dynamic symbol table sodlopen'd plugins resolve them, via linker flags (--undefined+--export-dynamic, guarded on the target OS) inspurd/build.rs.Functional wiring
invoke_hooknow threads a caller-ownedSpankHandle, so plugin env edits persist and are visible across hooks/plugins.Init/TaskInitafter the env is assembled, and folds plugin env changes back into the launched job (both container and command paths).ac/argv(previously always0/NULL).Testing
spur-spank+t58_spank): item-ID ordering,setenvoverwrite semantics,getenvround-trip/errors, env-in seeding,NOT_AVAILvsBAD_ARG.cargo clippy --workspace --exclude spur-ffi --all-targetsclean.slurm_spank_task_init) usingspank_setenv/spank_get_itemand a plugstack arg. Confirmed it loads (SPANK plugins loaded count=1) and a job sees the injected env (SPUR_SPANK_TEST=hello_from_spank,SPUR_SPANK_ARG=arg_from_plugstack).Known limitations / follow-ups
printf-style format specifiers aren't expanded — the format string is logged verbatim.spank_get_itemsupports scalar items only (noS_JOB_ARGV/S_JOB_ENVor pid-to-id lookups).spurdprocess, not the forked/privilege-dropped task.job_control_envisn't yet wired into prolog/epilog.spank_option_register, etc.) are not yet provided.