Repository navigation
Fix libscrapli FFI logger level mismatch and resolve PR review comments - #17
Merged
Merged
Conversation
araustin01
added this pull request to stack #18
September 18, 2026 20:22
araustin01
marked this pull request as ready for review
September 18, 2026 20:22
There was a problem hiding this comment.
🟡 Changes recommended
Input() incorrectly collapses multiple empty inputs instead of preserving their newline-separated representation.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Fixes FFI compatibility and addresses reliability/API regressions from PR #16.
Changes:
- Corrects logger-level and NETCONF option encoding.
- Hardens callbacks and result indexing.
- Restores compatibility and fixes definition/file handling.
File summaries
| File | Description |
|---|---|
util/file.go |
Returns scanner errors correctly. |
options/cli.go |
Restores deprecated option alias. |
netconf/get_config.go |
Forwards filter/default option values. |
internal/recorder.go |
Prevents callback deadlocks and nil dereferences. |
internal/options.go |
Adds correct FFI logger-level mapping. |
internal/netconf.go |
Safely dispatches capability callbacks. |
internal/logging.go |
Safely dispatches logging callbacks. |
cli/result.go |
Adds input accessors and index validation. |
cli/cli.go |
Loads replacement definitions correctly. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alistairking
approved these changes
Sep 23, 2026
Co-authored-by: araustin01 <72994707+araustin01@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: araustin01 <72994707+araustin01@users.noreply.github.com>
araustin01
force-pushed
the
copilot/fix-github-actions-job
branch
2 times, most recently
from
September 24, 2026 15:01
3e97a05 to
da876e4
Compare
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.
The
test / unitCI job was failing after bumpinglibscraplitov0.0.1-rc.25.2, and PR #16 had 10 unresolved review comments flagging deadlock risks, panics, silently-ignored options, and broken backward compatibility.Root cause: FFI logger level wire mismatch
libscrapli v0.0.1-rc.25.2changed how the FFI options'logger_levelbyte is decoded (parseLoggerLevelinsrc/ffi-options.zig), remapping it towarn=0, trace=1, debug=2, info=3, critical=4, fatal=5. scrapligo was reusingscrapligologging.IntFromLevel— which encodes the internal severity ordering (trace=0...fatal=5) used for message filtering — to build this wire byte, soWarn(3) was sent and decoded asinfo:ffiLoggerLevelFromLevel(internal/options.go) now owns this translation independently, leavingIntFromLevel/LevelFromIntuntouched for their existing internal-filtering role.Review comment fixes
cli/result.go: addedInput()/InputAtIndex()accessors (previouslyInputsbecame private with no way to read it back); rejected negative indexes inResultAtIndex/ResultRawAtIndexinstead of panicking.internal/logging.go,internal/netconf.go,internal/recorder.go: dispatcher callbacks now release the read lock before invoking user code, avoiding a deadlock if the callback re-enters and needs the write lock; nilmessagepointers are now guarded instead of dereferenced.options/cli.go: restoredWithDefintionContentas a deprecated wrapper around the renamedWithDefinitionContentto preserve compatibility for existing callers.cli/cli.go:ReplaceDefinitionnow sets the new definition path before callingloadDefinition, so the new definition is actually loaded instead of the stale one.netconf/get_config.go:getFilterType/getDefaultsTypenow perform the same pointer conversion used elsewhere, soWithFilterType/WithDefaultsTypereach libscrapli instead of being silently dropped.util/file.go:LoadFileLinesnow returnsscannerErron scan failure instead of the unrelated (nil)err.