Phase 2: audit report (P2-10)
- spec 10 §6.1: schema of the format-0 audit report (canonical JSON) - aji report FILE: entry capabilities, per-function effect graph with declared/used/unused effects (fixed point over calls, unsafe stopped at trusted callees), intrinsics, allocations, runtime and proven checks, unsafe operations; capability kinds; unsafe summary - golden unit test; runs over the whole conformance corpus without a crash
This commit is contained in:
1 parent
36e91be84c
commit
b00bac5937
7 files changed
+312
-3
No files matched your search
@@ -27,6 +27,7 @@ const usage =
|
||||
\\ deterministic world: --stdin TEXT, --vfs PATH=TEXT,
|
||||
\\ --seed N; --profile hosted uses the real OS and
|
||||
\\ writes the record only to --result-file PATH
|
||||
\\ report <file.air> verify, then print the audit report (spec 10 §6.1)
|
||||
\\ codes list diagnostic codes as JSON Lines
|
||||
\\ features print supported AIR format, language version and features
|
||||
\\ explain <code> show one diagnostic code
|
||||
@@ -63,6 +64,23 @@ fn run(io: std.Io, arena: std.mem.Allocator, args: []const [:0]const u8, out: *s
|
||||
try out.print("aji {s} (air format {d})\n", .{ aji.version, aji.air.format_version });
|
||||
return .accepted;
|
||||
}
|
||||
if (std.mem.eql(u8, cmd, "report")) {
|
||||
if (args.len != 3) return usageError("report takes exactly one file");
|
||||
const path = args[2];
|
||||
const source = std.Io.Dir.cwd().readFileAlloc(io, path, arena, .limited(64 << 20)) catch |err| {
|
||||
std.debug.print("aji: cannot read {s}: {t}\n", .{ path, err });
|
||||
return .usage;
|
||||
};
|
||||
const result = try aji.check.checkAir(arena, path, source);
|
||||
for (result.diagnostics) |d| {
|
||||
try d.writeJson(out);
|
||||
try out.writeByte('\n');
|
||||
}
|
||||
const module = result.module orelse return .rejected;
|
||||
try aji.report.write(arena, module, out);
|
||||
try out.writeByte('\n');
|
||||
return .accepted;
|
||||
}
|
||||
if (std.mem.eql(u8, cmd, "features")) {
|
||||
var s: std.json.Stringify = .{ .writer = out };
|
||||
try s.write(.{
|
||||
|
||||
Reference in new issue
Block a user