Commit Graph
1462 Commits
Author SHA1 Message Date
Eliran Zachandmorluto d28ee2b639 feat(model): inspect PyTorch checkpoints and pickle opcodes statically (#16257)
* feat(model): inspect PyTorch checkpoints and pickle opcodes statically

inspect_model_artifact now reads PyTorch ZIP checkpoints, legacy torch.save
files and protocol 2-5 pickle streams without unpickling. A bounded static
walker (protocols 0-5) reports each stream's protocol and opcode counts and
every GLOBAL, STACK_GLOBAL, INST, OBJ, REDUCE, NEWOBJ, BUILD and EXT reference
with its offset, marking callables outside PyTorch's tensor-rebuild allow-list
as observations of what loading would import or call.

ZIP checkpoints report their archive prefix, version, byteorder and
serialization records and each referenced data/<key> storage; legacy files
locate every storage in the file. State-dict tensors get dtype, shape, byte
span and parameter counts, and names when one unshared key path reaches them.
Malformed opcodes, truncation and memo misuse are target failures with their
offset; max_pickle_opcodes and max_pickle_memo_entries bound the walk.

Refs #3652

* fix(model): address pickle walker and PyTorch interpretation review findings

- push APPENDS/ADDITEMS values one at a time instead of spreading them
- replace an equal key on SETITEM(S), as unpickling does
- refuse a FRAME longer than the remaining stream as truncated
- decode BINUNICODE with surrogatepass and validate raw-unicode-escape text
- unwrap _rebuild_parameter chains iteratively
- resolve tensor key paths once per node and charge names before building them
- inventory every storage persistent ID and require its storage bytes
- bound archive records in the MCP summary with record_count and records_omitted

* fix(model): bound pickle integers, ZIP names and keep partial facts

- validate but do not convert protocol 0 integers beyond an exact long; refuse inexact memo keys
- decode STRING with Python's escape rules, keeping unknown escapes
- fill the format peek before classifying the file
- read PyTorch ZIPs under the session member count with a bounded metadata read, charging names as they are listed
- retain completed pickle facts before full-file hashing
- mark tensor coverage partial when a rebuild call cannot be read

* fix(model): keep Python string identity and bound dict-key work

- record the exact code point sequence of strings holding Python surrogates, so distinct keys stay distinct
- build each key's identity once per node, so a reused memoized key is not rebuilt per write
- decode raw-unicode-escape text in bounded batches instead of one fragment per backslash run
- keep the first equal key when SETITEM replaces its value

* fix(model): scan raw-unicode-escape text in one pass

Measure each backslash run once instead of retrying a regular expression from every backslash, and build output without a per-escape list.

* fix(model): keep GGUF partial tensor data offsets non-null

* fix(model): bound pickle tensor counts and validate FLOAT operands

* fix(model): bound shared tensor work and read expanded views

* fix(model): format the pickle changes and drop the unused ModelFormat type

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 17:10:56 +00:00
Eliran Zachandmorluto 73582aa342 feat(native): identify Nim, Zig, GHC, OCaml and D toolchains (#16252)
* feat(native): identify Nim, Zig, GHC, OCaml and D toolchains

Add identify_native_toolchain, a static, read-only reader that reports
whether a local ELF, PE or thin or universal Mach-O image was built by
Nim, Zig, Haskell (GHC), OCaml or D, including stripped images without
a DWARF producer.

The reader searches a bounded part of the selected image for a fixed
table of runtime symbol names, runtime messages, mangled names, source
paths and producer strings, and returns each observed marker with its
file offset, section or segment, matched text and occurrence count.
Data sections are searched before bytes outside sections and before
instruction sections, so a bounded scan reaches strings first;
coverage reports the bytes examined.

The verdict is derived from the listed markers only: a language needs
two distinct markers, one strong. Conflicting, too few or no markers
give unknown, and a version is reported only when a marker states it.

* perf(native): order toolchain scan ranges in linear time

Intersect instruction sections with the bytes outside data sections in one pass, so an image with tens of thousands of sections does not take quadratic time before the scan starts.

* fix(native): bound stated toolchain versions and describe scan order

Track distinct versions per marker in a Set and list at most eight,
counting the rest in versions_omitted, so an image with many version
strings costs constant time per match and a bounded result. A candidate
reports a version only when exactly one was stated.

Describe max_scan_bytes and examined_bytes as a total in scan order
rather than a prefix from the image start, and place the chunk-boundary
test's marker across an actual read boundary.

* fix(native): keep every stated toolchain version in the report

* fix(native): bound stated toolchain version bytes before keeping them

* feat(native): make the stated version budget a per-call control

* fix(native): give no larger-limit retry once a toolchain control is at its maximum

* fix(native): do not match toolchain markers on truncated runs

* fix(native): keep exact markers on a final run at the image end

* style(native): format the toolchain changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
2026-12-04 12:09:21 -05:00
Vincent Koc b7104bec93 test(artifacts): reuse the ESP flash MCP inventory reader (#16753) 2026-12-04 22:30:11 +08:00
Vincent Koc 1dd7550819 refactor(tests): reuse the devicetree CLI evidence reader (#16744) 2026-12-04 21:46:42 +08:00
Vincent Koc 76fb4f1850 test(sqlite): share short-lived database fixtures (#16737) 2026-12-04 21:18:55 +08:00
Vincent Koc 1e1d1b3f93 test(sourcemaps): share flat source map fixtures (#16726) 2026-12-04 20:47:42 +08:00
hhangandhhang 0a71a25e4d fix(tar): recognize gzip archives with long comments (#16188)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
2026-12-04 04:28:45 +00:00
Vincent Koc 6aa3ae45b1 test(cli): share default parser export comparison fixtures (#16550) 2026-12-04 11:05:11 +08:00
Vincent Koc a7e38b20b5 test(cli): share complete model inspection arguments (#16547) 2026-12-04 10:50:25 +08:00
Vincent Koc 1fb434f637 test(mcp): share the analysis settings ASAR fixture (#16545) 2026-12-04 10:49:43 +08:00
Vincent Koc 8a808adc30 test(cli): share retained JavaScript application fixtures (#16541) 2026-12-04 10:32:34 +08:00
Vincent Koc 0ce0bcf0fa test(artifacts): share extraction bundle fixture (#16540) 2026-12-04 10:31:29 +08:00
Vincent Koc c15d9f2905 test(cli): share Go binary inspection fixtures (#16536) 2026-12-04 10:06:23 +08:00
Vincent Koc 471c94c908 test(cli): share Maven and Gradle metadata fixtures (#16532) 2026-12-04 09:54:47 +08:00
Vincent Koc 6195b3d66b test(setup): share Hermes setup argument fixtures (#16523) 2026-12-04 08:23:28 +08:00
RRFZ c80acb9c1d fix(artifacts): read paletted KTX mip chains as one block (#16000) 2026-12-03 20:30:23 +00:00
RRFZ 2a96f92293 fix(ogg): accept compatible OpusHead minor versions (#16009) 2026-12-03 19:50:31 +00:00
Vincent Koc 059f129377 test(native): share dispatch environment fixtures (#16357) 2026-12-03 13:25:45 +00:00
Vincent Koc 7a06eba0f5 test(javascript): share literal mapping assertions (#16360) 2026-12-03 13:16:39 +00:00
Vincent Koc 655e939d6e test(nib): share registered object fixture tables (#16350) 2026-12-03 13:00:14 +00:00
Vincent Koc aef3fb790d test(api-contract): share retained view fixture calls (#16335) 2026-12-03 12:08:11 +00:00
Vincent Koc c41d023097 test(macos): share package resource fork fixtures (#16315) 2026-12-03 10:49:15 +00:00
Vincent Koc 30a70b138b test(javascript): reuse package specifier fixture writer (#16296) 2026-12-03 09:07:12 +00:00
07de725f17 feat(setup): register Mistral Vibe CLI client (#15278)
* feat(setup): register Mistral Vibe CLI client

* fix(setup): preserve inline Vibe entry order and reject non-boolean enable_mcp on read

* fix(setup): report duplicate Vibe registrations in doctor and preserve separated subtables

* docs(setup): record the Mistral Vibe 3.2.0 registration check

Mistral Vibe 3.2.0 on Linux loaded the setup registration through its
configuration schema and discovered REA's tools over stdio. After its own
`vibe mcp add` rewrote the file, setup made no change and uninstall removed
only the REA entry.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 12:46:21 +08:00
d318d752a5 feat(api-contract): resolve same-document OpenAPI path item references (#15966)
* feat(api-contract): resolve same-document OpenAPI path item references

Refs #14392.

* fix(api-contract): deduplicate shared declaration diagnostics

* fix(api-contract): preserve operations from unresolved reference chains

* fix(api-contract): preserve and deduplicate source diagnostics

* perf(api-contract): avoid temporary reference counting work

* fix(api-contract): locate malformed shared path references

* fix(api-contract): preserve reference failure reasons in narrow pages

* test(api-contract): assert narrow pages without assuming union fields

* fix(api-contract): diagnose malformed references in conflicting path items

* feat(api-contract): filter path item references by resolution state

Once same-document Path Items resolve, a contract can hold thousands of
resolved references beside a few unresolved ones. Finding those required
paging every reference. The path-item-references collection now accepts
states, and the partial-coverage unknown names the selection to use.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com>
Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 12:23:04 +08:00
Vincent Koc 714f1a1144 test(maven): share retained metadata Evidence assertions (#16205) 2026-12-03 03:21:06 +00:00
Vincent Koc f0e6a766f6 test(native): share successful export report fixtures (#16196) 2026-12-03 02:44:43 +00:00
Vincent Koc dc6bf4a306 test(apple): share keyed archive scalar parity fixtures (#16190) 2026-12-03 02:26:13 +00:00
Vincent Koc 31a71597ad test(js): share path autodetection fixture (#16172) 2026-12-03 01:34:28 +00:00
Vincent Koc 72145706ea test(cli): share artifact inspection response parsing (#16176) 2026-12-03 01:31:53 +00:00
Vincent Koc 2d9a339afd test(mcp): share artifact comparison fixture setup (#16162) 2026-12-03 01:03:06 +00:00
Vincent Koc fdaa06a304 test(il2cpp): share metadata and binary request arguments (#16112) 2026-12-02 21:45:00 +00:00
Vincent Koc 567441f50c test(javascript): share application version comparison CLI setup (#15986) 2026-12-02 13:52:05 +00:00
Vincent Koc 9df3dd2fba test(sqlite): share exact schema-name parity assertions (#15877) 2026-12-02 10:28:51 +00:00
Vincent Koc 190fe6275d test(model): share model Evidence view assertions (#15866) 2026-12-02 09:43:57 +00:00
Vincent Koc 0e23515936 test(wasm): share comparison Evidence fixtures (#15847) 2026-12-02 08:36:18 +00:00
Vincent Koc 11e0599256 test(gpu): share kernel report CLI fixture (#15844) 2026-12-02 08:20:45 +00:00
hhangandhhang ff188a3d29 fix(artifacts): check packed DDS payload extents (#15731)
Co-authored-by: hhang <169027046+xu91102@users.noreply.github.com>
2026-12-02 13:45:02 +08:00
Vincent Koc d8f79e1122 test(setup): reuse Cline setup helpers (#15773) 2026-12-02 04:40:59 +00:00
Vincent Koc 142bc62471 test(protobuf): share HAR record request fixtures (#15767) 2026-12-02 03:41:36 +00:00
Vincent Koc ca0ab102ab test(javascript): share CLI and MCP Evidence checks (#15741) 2026-12-02 02:31:44 +00:00
gensokyo-devandgensokyo-dev e2fce6bb6c fix(maven): read POMs in their declared XML encoding
The Maven reader decoded every file as strict UTF-8, so an ISO-8859-1 POM
such as Maven's own pom-encoding fixture, or a BOM-marked UTF-16 POM,
failed as "not valid UTF-8". Decode with the shared XML text decoder and
admit ISO-8859-1. A POM that declares an encoding REA does not decode is
now refused as unsupported and names that declaration.

Fixes #15664

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:04:06 +08:00
gensokyo-devandgensokyo-dev 3474dd6716 fix(artifacts): report a DDS with no payload bytes as truncated
Every DDS surface holds at least one texel, so a file that ends at its
payload offset is truncated even when the format's exact size is not
derived, such as planar video formats.

Fixes #15674

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:03:56 +08:00
gensokyo-devandgensokyo-dev ea8b79b362 fix(artifacts): derive the DDS payload size for every fixed-size DXGI format
The DXGI table listed only RGBA32, RGBA16 and RGBA8/BGRA8 formats, so a
DX10 texture in R8_UINT, R16_FLOAT, R32_FLOAT, RG8 and other single- or
two-channel formats had no expected payload size and passed the extent
check even with no pixel data. List every format with a fixed number of
bytes per texel.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-02 09:03:56 +08:00
Islam Gagiev 78243cb17d fix(artifacts): preserve pre-epoch ar member timestamps (#15502) 2026-12-02 08:48:43 +08:00
Vincent Koc 9006d17aef test(javascript): reuse package fixture file writer (#15701)
* test(javascript): reuse package fixture file writer

* test(javascript): remove unused fixture path imports
2026-12-02 00:42:49 +00:00
morluto 75474075c4 test(settings): fail analysis settings setup steps with the refusal (#15704)
* test(settings): fail analysis settings setup steps with the refusal

Setup MCP calls asserted only `isError` was not true, so a refused
setup step failed as "expected true not to be true" without the
refusal, and several setup calls were not checked at all. They now use
callOk, which fails at that step with the tool's content. Inventory
lookups no longer hide a missing substep or occurrence behind optional
chaining.

* test(settings): keep the fixture's reply checks on setup steps

callOk now also accepts a fixture's call function, so setup steps keep
the output-schema checks connectLocalToolsMcp applies to replies.
2026-12-02 00:40:31 +00:00
morluto 925dce1ded fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget (#15687)
* fix(pe)!: deliver inspect_pe_imports and inspect_pe_resources within the agent result budget

Neither tool had a detail input or a summary view, so their complete
Evidence was always delivered inline: about 200-480 KB of CLI JSON for
stock kernel32.dll, shell32.dll and explorer.exe, and over 1 MB over MCP.

Both now follow the inspect_deb_package pattern. With detail omitted,
complete Evidence is returned when it fits the agent result budget, and
otherwise the retained summary with delivery facts; detail complete always
returns everything, and inspect_analysis_view evidence-json pages the
retained record. The CLI gains --detail and --evidence_output.

The imports summary carries image identity, imphash, coverage with DLL
and function counts, issue/limitation counts and one name/function_count/
delay_load row per DLL, bounded to 16 KiB of rows with an omitted count.
The resources summary carries image identity, the resource directory,
coverage, directory/resource/icon-group counts and resource counts by type
and by language, each bounded to 8 KiB of rows with an omitted count.

The byte-bounded leading-prefix rule extract_artifact's summary used is
now byteBoundedList, shared by the three summaries.

BREAKING CHANGE: inspect_pe_imports and inspect_pe_resources output is now
complete Evidence or, when detail is omitted and the Evidence exceeds the
agent result budget, the inspect_analysis_view summary with delivery facts.
Callers that need the complete record inline pass detail "complete"
(CLI --detail complete); otherwise follow delivery.next.

Fixes #15619

* test(pe): cover byte-bounded lists and named resource identities in summaries

* fix(cli): withhold an over-budget summary answer and print its paging facts

The CLI printed {summary, evidence_bundle, delivery} for over-budget Evidence without measuring it, so a summary larger than a smaller configured agent result budget was printed whole. Like MCP since #15591, the CLI now measures that answer and, when it is over the budget, prints the bundle receipt and the delivery facts marked withheld, whose next call pages the saved Evidence.
2026-12-01 19:32:41 -05:00
morluto 941af21c73 test(javascript): fix the deadline phase in the oversized bundle test (#15703)
The test derives a retained-Evidence cap from a baseline run and expects
a second run to record the same failure bytes. With a 1 ms source
deadline the timeout lands before or during the worker launch depending
on host speed; during the launch the failure also keeps the interrupted
ownership inspection, about 7 KB more on macOS. The cap then either
rejects the record or admits the whole bundle, no removal happens and
the marker read fails with ENOENT.

The publication preload can now hold a mkdtemp under a named prefix.
Both runs hold the worker's runtime directory for 20 ms, so the 1 ms
deadline, armed first, always fires before launch.
2026-12-02 00:29:51 +00:00
Vincent Koc 691e089197 test(interface-builder): share app bundle fixture setup (#15695) 2026-12-02 00:12:54 +00:00