Unknown not scannable¶
unknownNotScannable is a built‑in scan rule that detects values whose structural type cannot be determined.
When detectStructuralType(raw) returns unknown, the rule emits a warn‑level unknown.not.scannable scan event containing the raw value. If the structural type is anything else, no events are emitted.
Signature¶
export const unknownNotScannable: ScanRule (raw: unknown, path: FieldPath) => JaneEvent[]
Events¶
| Event code | Description |
|---|---|
unknown.not.scannable |
Structural type cannot be determined or classified. |
Design rationale¶
- Detects values with no predictable shape, traversal semantics, or behavioral guarantees.
- Surfaces opaque inputs that may be callable, throw on access, or vary across realms.
- Ensures containment, validation, and policy layers never operate on structurally indeterminate values.
- Emits a warning when the structural type is
unknown. - Provides metadata (
{ value }) for debugging and analysis. - Performs no mutation, normalization, or interpretation of the input.
Invoke¶
unknownNotScannable runs automatically whenever the scan stage is enabled.
If scan is not enabled, unknownNotScannable does not run and no unknown‑type detection occurs.
Examples¶
Unknown structural type detected¶
const weird = Object.create(null); // or a cross‑realm callable, proxy, etc.
const result = unknownNotScannable(weird, "$");
// → [ JaneEvent{ kind: "warn", code: "unknown.not.scannable", ... } ]
Known structural type¶
const result = unknownNotScannable({ a: 1 }, "$");
// → []
Non‑object or primitive¶
const result = unknownNotScannable(42, "$");
// → []