Commit Graph
10 Commits
Author SHA1 Message Date
23970fc63f feat(web): deduplicate bundle findings across scripts by value and mechanism (#11354)
* feat(web): deduplicate bundle findings across scripts by value and mechanism

Per-script findings were deduplicated only within one script, so the same
endpoint or route observed in N scripts appeared N times in the merged
bundle, inflating the finding list and overstating the inventory.

Merge now deduplicates routes and endpoints across scripts by
(value, mechanism). The first occurrence keeps its location and order;
later occurrences fold into optional occurrences/script_keys on the
retained entry, so no script is silently dropped and single-script
findings keep their original shape. The key uses the existing compositeKey
helper (JSON) instead of a NUL join. bundleLimitations gains a line
describing the cross-script merge.

* fix(web): address Greptile review on cross-script bundle dedup

- Accept merged endpoint occurrences/script_keys in the web-bundle
  view row schema so unfiltered pages no longer throw.
- Match endpoint script_keys filters against retained script_keys,
  falling back to location.script_key for older records.
- Generate distinct finding keys in the wide-result capacity fixtures
  so routes/endpoints still exercise a 130,000-entry merged result.
- Append later script keys in place instead of rebuilding the list.
- Compare the dedup limitation against its owning constant instead
  of freezing the explanatory sentence in the test.
- Update the route-inventory guide for merged endpoints.

* test(web): expect the cross-script endpoint merge in the semantic budget case

Main added a regression where two budget-limited scripts both report
/health. With findings merged across scripts, it is one entry whose
occurrences and script_keys name both scripts, which keeps the case's
per-script attribution.

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-11-22 16:33:22 +08:00
7b6e816b0b feat(javascript): inventory Expo Router require.context route keys (#10624)
* feat(javascript): inventory Expo Router require.context route keys

Problem: Expo Router (Metro) web exports register file routes through a
bundled require.context map whose keys are literal route filenames such as
"./(app)/<section>/[id]/edit.tsx", "./_layout.tsx" and "./+not-found.tsx".
The route scan did not recognise that map, so the javascript-routes view of
analyze_javascript_application returned an empty inventory for these apps.

Fix: the route scan owner recognises Metro's context template,
Object.defineProperties({}, {"./file.tsx": getter, ...}). When every key is a
./-relative .js/.jsx/.ts/.tsx file and the map holds at least one _layout or
"+" file, each other key becomes a candidate with the new
expo-router-context-key mechanism, located at the key literal, with low
confidence and inferred derivation. The route-path owner converts keys with
Expo Router file conventions: groups (including group arrays) contribute no
segment, [id] -> :id, [...rest] -> :rest+, a trailing index names its
directory, platform extensions select the same route, and +api files keep
their API path. Layouts and other "+" files are not URL patterns.
Classification stays unknown; a bundled key does not establish platform,
navigator, server or reachability. A file map without a layout or "+" file
retains an interpretation unknown instead of becoming routes. Other
defineProperties calls are not read. The route inventory guide documents this.

Validation: new scan, inventory and CLI acceptance cases with a synthetic
Metro-style module. On the base, the scan and inventory cases failed with
empty candidates and routes; they pass now. Ran test:local for the route
scan, inventory, view, delivery-contract, result-budget and advertised
schema tests (378 passed), test:focused for
tests/acceptance/javascriptRoutesCli.test.ts (13 passed), docs:check and
check:fast. The conventions were checked against the published metro 0.88.0
context template and expo-router 58.0.31 matchers, not a real Expo export.

Refs morluto/rea#7510

* fix(javascript): admit Expo Router context keys within the fact budget

Review follow-up for Expo Router route keys.

The context-map reader converted every key and kept each derived path
in a local array before emission. Only a location per property was
charged, so a map with many long filenames retained route text beyond
the fact budget, including text later discarded at capacity. The reader
now establishes applicability in a first pass without keeping derived
paths. A second pass converts and admits one key at a time through the
budgeted fact owner. Emitted facts and their order are unchanged.

The route inventory guide said Expo keys stay classified unknown, but
the existing path-name heuristic still applies: ./login.tsx becomes
/login, classified system by path-name-heuristic. The guide now says a
bundled key adds no classification of its own.

Tests: a budgeted case with 80 long keys admits a key-ordered prefix and
stays within the limit. The route scan and inventory tests (355) and the
routes CLI acceptance tests (13) pass. check:fast and docs:check pass.

* docs(specs): record the Expo Router route key feature

The documentation guide asks each feature for a spec.md, plan.md and
tasks.md under docs/specs/. Add the record for reading Expo Router
require.context keys in the JavaScript route inventory, and index it.

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-22 16:15:33 +08:00
morluto 15de1d4dce feat(evidence)!: require JavaScript, browser, managed and reference-source facts their producers always write (#10990)
* feat(javascript)!: require the runtime parse-failure count and active Electron execution paths

The V8 Inspector projection always writes scripts.parse_failed_total and the
active Electron service always commits parameters.resolved_paths, so both are
now required. Runtime reconciliation reads the admitted execution paths only
and no longer falls back to request-spelled paths in parameters, and checks
the observed executable path against them on every capture.

JavaScriptStaticAnalysis.routes and module_runtime keep their omission, which
current producers still make (a checkpoint that cannot retain route facts; no
recovered factory runtime); their comments now say so instead of naming
historical analyses.

BREAKING CHANGE: JavaScript runtime observations without
scripts.parse_failed_total, and active Electron Evidence without
parameters.resolved_paths, are refused as malformed; recreate the observation.

* test(javascript): give the shared Node reconciliation fixture the required parse-failure count

* feat(browser)!: require browser observation facts their producers always write (#10991)

* feat(browser)!: require browser observation facts their producers always write

The source-map fetcher always writes effective_url (string or null), the web
bundle analyzer always writes schema_property_names_coverage, and the CDP
storage fingerprinter always marks IndexedDB schema fingerprints with
projection_version 2. Each is now required. The IndexedDB marker is tied to
its scope by a discriminated union and derived from the scope in the
producer, so compare_web_captures no longer carries the store-only
projection branch.

response_identity and the WebMCP consequential hint keep their omission,
which current producers still make (a body not fully read; an invalid
annotation); the guide no longer attributes it to historical captures.

BREAKING CHANGE: source-map items without effective_url, WebMCP declarations
without schema_property_names_coverage, and IndexedDB schema fingerprints
without projection_version are refused as malformed; recreate the capture.

* feat(managed)!: refuse members beside a null signature resolution (#10992)

* feat(managed)!: refuse members beside a null signature resolution

signature_resolution is null only when member decoding exceeded capacity,
and the capacity-recovery producer then examines no members. The managed
member inspection schema now enforces that: a null resolution with any
field, method, member reference, call edge or field access is malformed.

With that rule, every admitted inspection with members attests type-name
resolution, so the raw-digest fallback is unreachable and is deleted:
comparableSides, hasSignatureResolution, the comparison's
signatureResolutionExamined flag and the "does not attest" limitation. The
shared workflow example that carried resolved digests beside a null
attestation now attests resolution.

BREAKING CHANGE: managed member Evidence with a null signature_resolution
and any examined member is refused as malformed; recreate the observation.

* docs: describe historical Evidence by what the format revision now refuses (#10993)

SQLite worker_timeout_ms is required, so the SQLite guide no longer reads a
missing value as unknown settings. The IL2CPP, ESP image and process capture
guides now say that bundles exported without evidence_format are refused,
while a standalone record from an earlier release is still read with the
stated omission semantics (records carry no format marker yet). The route
inventory guide describes a parent without route_inventory by its meaning
rather than by its age.

* refactor(javascript): require static analysis coverage from the JavaScript worker (#11001)

* refactor(javascript): require static analysis coverage from the JavaScript worker

Both JavaScript static producers always write analysis_coverage: the
analyzer measures it on every parsed source and the failed-parse result
carries an unexamined coverage. The worker schema and the static analysis
type therefore require it, the preload-discovery checkpoint copies it
unconditionally, and ElectronBoundaryAnalysis reads Electron applicability
and examination limits from it alone. The fallback that re-derived Electron
use from semantic module links and retained references for analyses
without coverage is deleted, as are the graph and builder branches for a
missing coverage.

Retained Evidence graph observations are unchanged: the analysis view still
counts a stored JavaScript observation without analysis_coverage as
unmeasured, since standalone records carry no format marker yet.

The worker runs from the same build as its parent, so no external caller
sees the stricter reply schema.

* feat(browser)!: require storage fingerprint, Link context, mapping index and invalid-map identity facts (#11002)

* feat(browser)!: require storage fingerprint, Link context, mapping index and invalid-map identity facts

Each field is written by its only producer on every capture:

- The CDP storage capture always writes content_fingerprints,
  fingerprint_algorithm and fingerprints_complete, so their schema defaults
  are removed.
- The CDP Link header projection always writes context_url and
  context_scope, so they are required.
- The source-map fetcher writes source_index and declaration_index on every
  mapping row, so they are required.
- The fetcher judges a map invalid only after reading its complete body. A
  separate invalidSourceMapItem builder now takes the response identity as a
  required argument, and the schema's invalid member requires
  response_identity; fetch_failed keeps it optional because those rows can
  come from a body that was not fully read.

The browser and source-location guides no longer describe these fields as
optional for older saved captures.

BREAKING CHANGE: page inspections without the storage fingerprint fields or
Link context fields, source-map mapping rows without their indexes, and
invalid source-map items without response_identity are refused as malformed;
recreate the capture.

* test(browser): keep source-omission coverage on a still-defaulted field and refuse a missing fingerprint algorithm

* feat(browser)!: require web-bundle target origin, inspection producer facts, scenario redirect state and exclusion kind (#11014)

feat(browser)!: require web-bundle target origin, page inspection producer facts, scenario redirect state and exclusion kind

Each field is written by its only producer on every record:

- buildCaptureObservation always writes capture.target_origin (the validated
  origin or null), so analyze_web_bundle Evidence and both web-bundle view
  results require it; the view's conditional spread is gone.
- The CDP page capture always writes accessibility node states, script
  frame_id (null when unattributed) and worker opener_target_id and
  parent_frame_id, so their schema defaults are removed.
- PlaywrightScenarioNetwork writes redirected_from_transaction_state exactly
  when the predecessor ID is null, so request events now require it there and
  still refuse it on linked events.
- The reference-source importer writes entry_kind on every exclusion
  (unknown when the kind was not observed), so it is required.

The browser scenario contract and CLI guide no longer describe older
captures or exclusions without these fields.

BREAKING CHANGE: web-bundle analyses without capture.target_origin, page
inspections without these script, accessibility or worker fields, scenario
network events with a null predecessor and no redirect state, and reference
source graphs whose exclusions lack entry_kind are refused as malformed;
recreate the capture or re-import the source.
2026-11-15 19:37:10 +08:00
Kaoru0822andClaude Opus 5.5 eb39a07966 feat(evidence): read selected complete records without the whole bundle (#8528)
* feat(evidence): read selected complete records without the whole bundle

get_evidence_bundle could discover a record by exact ID, but reading it
required the complete canonical bundle: complete + filters was rejected,
and inspect_analysis_view refuses parents without a view, such as
annotations, pseudocode sources and native traces.

- Add detail: records, a page (offset, limit; default 0, 8) of the
  complete matching records in canonical bundle order. Records keep their
  original IDs, subjects, providers and readback; missing_evidence_links
  names direct links of the returned records that are not retained.
- The selection is labelled as historical and not an importable bundle;
  complete keeps returning the canonical bundle, and offset/limit
  require detail: records.
- Filters keep one owner shared by summary and records delivery, for the
  MCP session and the CLI's inspect-evidence-bundle.
- An oversized record page now advises a smaller limit or one
  evidence_id; whole-bundle overflow guidance mentions record reads.

Fixes #8307

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(evidence): compare record-selection guidance with its owners

Assert the record-selection limitations and oversized-page guidance
against their owning constants, and check the reported limit facts
separately, instead of pinning explanatory phrases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 08:56:58 -08:00
gensokyo-devandHarsH 6d5532a204 feat(web): page retained bundle endpoint observations and inferences (#7259)
Page retained web-bundle endpoint observations and inferences through shared CLI/MCP projections, preserving source identities, scoped unknowns, coverage and complete Evidence access.

Based on HarsH’s original implementation in #7213 (6b1d5d42). Real Chromium/CLI/SDK verification and whole-task cost limits are recorded in docs/verification/web-bundle-paging-2026-10-26.md.

Explicit user authorization permits leaving human-readiness declarations unchecked and bypassing reproduced main failures (ADB listing fixture, package catalog expectation, untouched APK verifier formatting). No human-review attestation is made.

Co-authored-by: HarsH <harshasalkar7@gmail.com>
2026-10-27 01:37:39 +08:00
morluto f97747c2fb fix(javascript): preserve route selection owners and uncertainty 2026-10-24 04:25:13 +08:00
morluto 5ee5e49cb4 fix(javascript): bind Next page admission to source context 2026-10-24 02:50:17 +08:00
morluto 38ecc0248e fix(javascript): preserve route flag values and lexical RPC names 2026-10-24 02:35:36 +08:00
morluto ddd7ac7b84 fix(javascript): preserve Next filesystem route spelling
Apply Next-specific uppercase %5F normalization while retaining ordinary percent sequences, encoded separators, and literal percent characters as distinct source segments.

Fixes #6641
2026-10-24 00:11:41 +08:00
gensokyo-dev 7d0efef62d feat(javascript): retain queryable static route inventories (#6019) 2026-10-22 16:54:14 +08:00