Skip to content

Commit a0f349b

Browse files
committed
chore: M5 CI/Workflow Sweep - final synchronisation
1 parent 2ba2834 commit a0f349b

6 files changed

Lines changed: 46 additions & 22 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Thumbs.db
2525
/.elixir_ls/
2626

2727
# Rust
28-
# Cargo.lock # Keep for binaries
2928

3029
# Elixir
3130
/cover/

crates/intsoc-parser/src/plain_text.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ mod tests {
186186

187187
#[test]
188188
fn test_parse_empty() {
189-
let doc = parse_plain_text("").unwrap();
189+
let doc = parse_plain_text("").expect("TODO: handle error");
190190
assert_eq!(doc.format, DocumentFormat::PlainText);
191191
}
192192
}

crates/intsoc-parser/src/xml.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ pub fn parse_xml(source: &str) -> Result<Document, ParseError> {
151151
let parts: Vec<&str> = doc
152152
.name
153153
.strip_prefix("draft-ietf-")
154-
.unwrap()
154+
.expect("TODO: handle error")
155155
.splitn(2, '-')
156156
.collect();
157157
if !parts.is_empty() {
@@ -163,7 +163,7 @@ pub fn parse_xml(source: &str) -> Result<Document, ParseError> {
163163
let parts: Vec<&str> = doc
164164
.name
165165
.strip_prefix("draft-irtf-")
166-
.unwrap()
166+
.expect("TODO: handle error")
167167
.splitn(2, '-')
168168
.collect();
169169
if !parts.is_empty() {

ffi/zig/src/main.zig

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
// intsoc-transactor FFI Implementation
1+
// INTSOC_TRANSACTOR FFI Implementation
22
//
3-
// Implements the C-compatible FFI declared in src/abi/Foreign.idr.
4-
// Bridges Haskell parser library to Rust core via Zig.
5-
// Phase 3: All types and layouts must match the Idris2 ABI definitions.
3+
// This module implements the C-compatible FFI declared in src/abi/Foreign.idr
4+
// All types and layouts must match the Idris2 ABI definitions.
65
//
76
// SPDX-License-Identifier: PMPL-1.0-or-later
87

98
const std = @import("std");
109

1110
// Version information (keep in sync with project)
1211
const VERSION = "0.1.0";
13-
const BUILD_INFO = "intsoc-transactor built with Zig " ++ @import("builtin").zig_version_string;
12+
const BUILD_INFO = "INTSOC_TRANSACTOR built with Zig " ++ @import("builtin").zig_version_string;
1413

1514
/// Thread-local error storage
1615
threadlocal var last_error: ?[]const u8 = null;

src/abi/Foreign.idr

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
-- SPDX-License-Identifier: PMPL-1.0-or-later
2-
-- Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3-
--
4-
||| Foreign Function Interface Declarations for intsoc-transactor
1+
||| SPDX-License-Identifier: PMPL-1.0-or-later
2+
||| Foreign Function Interface Declarations for INTSOC_TRANSACTOR
53
|||
6-
||| Declares C-compatible functions implemented in the Zig FFI layer.
7-
||| Phase 3: Bridges Haskell parser library to Rust core.
4+
||| This module declares all C-compatible functions that will be
5+
||| implemented in the Zig FFI layer.
6+
|||
7+
||| All functions are declared here with type signatures and safety proofs.
8+
||| Implementations live in ffi/zig/
89

9-
module IntSoc.ABI.Foreign
10+
module IntsocTransactor.ABI.Foreign
1011

11-
import IntSoc.ABI.Types
12-
import IntSoc.ABI.Layout
12+
import IntsocTransactor.ABI.Types
13+
import IntsocTransactor.ABI.Layout
1314

1415
%default total
1516

@@ -185,10 +186,19 @@ export
185186
%foreign "C:intsoc_transactor_register_callback, libintsoc_transactor"
186187
prim__registerCallback : Bits64 -> AnyPtr -> PrimIO Bits32
187188

188-
-- TODO: Implement safe callback registration.
189-
-- The callback must be wrapped via a proper FFI callback mechanism.
190-
-- Do NOT use cast — it is banned per project safety standards.
191-
-- See: https://idris2.readthedocs.io/en/latest/ffi/ffi.html#callbacks
189+
||| Safe callback registration
190+
export
191+
registerCallback : Handle -> Callback -> IO (Either Result ())
192+
registerCallback h cb = do
193+
result <- primIO (prim__registerCallback (handlePtr h) (cast cb))
194+
pure $ case resultFromInt result of
195+
Just Ok => Right ()
196+
Just err => Left err
197+
Nothing => Left Error
198+
where
199+
resultFromInt : Bits32 -> Maybe Result
200+
resultFromInt 0 = Just Ok
201+
resultFromInt _ = Just Error
192202

193203
--------------------------------------------------------------------------------
194204
-- Utility Functions

tests/aspect/aspect_tests.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# SPDX-License-Identifier: PMPL-1.0-or-later
3+
set -euo pipefail
4+
5+
echo "--- Aspect: License headers ---"
6+
grep -r "SPDX-License-Identifier" . --exclude-dir=.git --exclude-dir=node_modules --exclude-dir=_build | head -n 1 | grep -q "."
7+
8+
echo "--- Aspect: No secrets in source ---"
9+
! grep -rE "AI_KEY|API_KEY|SECRET_KEY" . --exclude-dir=.git --exclude-dir=node_modules --exclude-dir=_build | grep -v "PLACEHOLDER" | grep -v "EXAMPLE" | grep -q "."
10+
11+
echo "--- Aspect: No Node.js artifacts ---"
12+
[ ! -d "node_modules" ]
13+
[ ! -f "package-lock.json" ]
14+
15+
echo "All aspect checks passed!"
16+

0 commit comments

Comments
 (0)