oasis-tcs / sarif-spec

OASIS SARIF TC: Repository for development of the draft standard, where requests for modification should be made via Github Issues
https://github.com/oasis-tcs/sarif-spec
Other
166 stars 47 forks source link

"Progressive" or "dynamic" SARIF #661

Open davidmalcolm opened 1 week ago

davidmalcolm commented 1 week ago

Currently the spec states:

SARIF defines an object model, the top level of which is the sarifLog object (§3.13), which contains the results of one or more analysis runs. The runs do not need to be produced by the same analysis tool.

A SARIF log file SHALL contain a serialization of the SARIF object model into the JSON format.

NOTE 1: In the future, other serializations might be defined.

The top-level value in the log file, representing the sarifLog object, SHALL conform to the JSON object grammar; that is, it SHALL consist of a comma-separated sequence of name/value pairs, enclosed in curly brackets, as specified by JSON [RFC8259].

i.e. that we have a log, which contains 0 or more run objects, which contains 0 or more results objects.

Is there an implicit assumption in the spec of a kind of "atomic" or "after-the-fact" model in which the log is generated/accessible after all runs have finished?

If so, it might be useful to support a more dynamic/progressive model, in which a consumer might see all of part of the SARIF before all of the results are in.

For example, in #572 and https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3358r0.html#msvc Sy describes how MSVC can send diagnostics in the form of SARIF result objects back to an IDE, and how it's useful to the IDE to be able to start displaying results before the run has completed (in this case, a C++ compiler attempting to compile a C++ source file).

Similarly, for SARIF 3 we're looking to support dynamic analysis, where it seems useful to have a listener be able to listen for results, and dynamically update a UI based on them.

I'm filing this issue to split out this discussion from #572.

Some issues are:

Or am I missing something here?

davidmalcolm commented 1 week ago

Note to self: DOM has a concept of mutation observers, and mutation records expressing changes to a tree. Not sure if that's overkill for this, but presumably would be very flexible.