mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 12:39:28 +00:00
feat(learn): candidate feature schema and builders (decision-engine task 1)
learn/schema.py is the closed, typed allow-list of candidate features: 66 features over 11 instruments (language one-hot, quick rules with 23 mechanism buckets and a prior count, engine, repo-facts, source span, entry-point distance, roles, delta, verify, agree, model sinks), two profiles (static 57; plane adds verify, agree and model sinks for 66), schema_version and a feature-set digest. No repository, path, file, function, rule or commit identity is a feature; site_match, in_fix_range, fixed-pin alerts, case.json fields and costs are refused. Missing is not zero: each record carries per-instrument state (ran | none | failed | not_applicable), and every feature of an instrument that did not run is null. learn/features.py builds records on the host (build_for_scan, whole repository or base..head delta); plane/tasks/features.py builds them per case in a Run from the delivered artifacts, dropping site_match and in_fix_range on read and ignoring fixed-pin alerts. The generator adds a model-free `features` entry per case before `remember`, which stores the records as `features` rows (re-validated). memory KINDS gains features, label, decision, experiment, arm_outcome and experiment_result. The committed validation-46 manifests are regenerated (entries appended; the first Run's entries are unchanged). The runner image must be rebuilt and re-pinned before a Run executes the new task. Proof on real artifacts (scratch store, not committed): the recorded validation-46 run gives 75 feature records over 15 cases (43 verify candidates plus vulnerable-pin alerts), each case's vulnerable pin exported and read (0.5k-9k files); remember stored 75 features rows beside 43 verdict, 84 alert, 61 unit_cost, 15 facts and 8 coverage rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
edcf145b00
commit
d1896cb8e7
@@ -0,0 +1,5 @@
|
||||
"""The learned decision engine (learned-decision-engine spec): instruments emit signals, a model decides.
|
||||
|
||||
Task 1 ships the candidate feature schema (:mod:`.schema`) and the host feature builder (:mod:`.features`); labels,
|
||||
training, calibration and the decision stage follow in later tasks.
|
||||
"""
|
||||
@@ -0,0 +1,540 @@
|
||||
"""Feature records per candidate, from the signals every instrument emitted (learned-decision-engine design section 1).
|
||||
|
||||
No model. The same per-instrument builders serve two callers:
|
||||
|
||||
- the plane task ``features`` (:mod:`..plane.tasks.features`), which reads a case's delivered artifacts;
|
||||
- the host: :func:`build_for_scan` over a checkout's quick findings and an engine result, for ``scan`` and
|
||||
``pre-push`` (a whole-repository scan, or a base..head delta with :class:`Delta`).
|
||||
|
||||
A candidate is ``(path, function, family)`` of one repository and pin: a function where at least one instrument
|
||||
emitted a signal of that family. The key stays in the record's envelope (``candidate`` is ``path::function``); the
|
||||
features never see it (:mod:`.schema`). Each instrument contributes a :class:`Part` -- its state, its values and its
|
||||
version -- and :func:`record` assembles and validates the record: an instrument that did not run leaves ``null``,
|
||||
never a zero.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from collections.abc import Iterable, Mapping, Sequence
|
||||
from dataclasses import asdict, dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from ..model.taxonomy import load_families
|
||||
from ..plane.tasks.repo_facts import _COMMENT_PREFIXES, DECLARATION, GLOBAL, _declared_name, enclosing, product_files
|
||||
from ..preprocess import build_file_target, detect_language
|
||||
from ..ruleset import DEFAULT_RULESET_DIR, PatternRule, load_ruleset
|
||||
from .schema import (
|
||||
BY_NAME,
|
||||
LANGUAGES,
|
||||
MECHANISMS,
|
||||
RULE_TAG_MECHANISM,
|
||||
RUNGS,
|
||||
SCHEMA_VERSION,
|
||||
FeatureRecordError,
|
||||
feature_set_digest,
|
||||
features_for,
|
||||
instruments_for,
|
||||
validate_record,
|
||||
)
|
||||
|
||||
ENGINE_RULE_PREFIX = "engine:"
|
||||
UNKNOWN_FAMILY = "unknown"
|
||||
# The operation a sink performs, by the CWE its semantic entry binds (a closed table; anything else is `other`).
|
||||
CWE_OPERATION = {
|
||||
"CWE-89": "sql", "CWE-943": "sql", "CWE-78": "command", "CWE-77": "command", "CWE-94": "code_eval", "CWE-95": "code_eval",
|
||||
"CWE-502": "deserialize", "CWE-22": "file_path", "CWE-98": "file_inclusion", "CWE-918": "outbound_request",
|
||||
"CWE-601": "redirect", "CWE-79": "html_output",
|
||||
} # fmt: skip
|
||||
# A semantic source entry's id mapped to its kind; an unlisted id is `other`.
|
||||
SOURCE_KIND = {
|
||||
"request": "request", "django-request": "request", "req": "request", "node-request": "request", "servlet": "request",
|
||||
"server": "server", "raw_body": "raw_body", "argv": "argv_stdin", "stdin": "argv_stdin", "input": "argv_stdin",
|
||||
} # fmt: skip
|
||||
_STEPS = re.compile(r"(\d+) steps")
|
||||
_WITNESS = re.compile(r"^(?P<source>.+?) -> (?P<sink>.+?)(?: in \S+)? \(line")
|
||||
_CALL = re.compile(r"(?<![A-Za-z0-9_$])([A-Za-z_]\w*)\s*\(")
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Part:
|
||||
"""One instrument's contribution to a record: its state, its feature values (only when ``ran``), its version."""
|
||||
|
||||
state: str
|
||||
values: Mapping[str, Any] = field(default_factory=dict)
|
||||
version: str | None = None
|
||||
|
||||
|
||||
NONE = Part("none")
|
||||
NOT_APPLICABLE = Part("not_applicable")
|
||||
|
||||
|
||||
def language_of(path: str) -> str:
|
||||
"""The closed language of a path (its extension), ``other`` outside :data:`.schema.LANGUAGES`."""
|
||||
language = detect_language(Path(path))
|
||||
return language if language in LANGUAGES else "other"
|
||||
|
||||
|
||||
def _clip(name: str, value: Any) -> Any:
|
||||
spec = BY_NAME[name]
|
||||
if value is None or spec.type != "int" or isinstance(value, bool):
|
||||
return value
|
||||
return max(0, min(int(value), spec.cap or 0))
|
||||
|
||||
|
||||
def record(
|
||||
candidate: str,
|
||||
family: str,
|
||||
language: str,
|
||||
profile: str,
|
||||
parts: Mapping[str, Part],
|
||||
*,
|
||||
unit: str = "pin",
|
||||
base: str | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""The validated record of one candidate. ``language`` sets the one-hot; an instrument absent from ``parts`` is
|
||||
``none``; a value for a feature of another instrument, or outside the profile, is refused."""
|
||||
closed = language if language in LANGUAGES else "other"
|
||||
parts = {**parts, "language": Part("ran", {f"lang.{name}": name == closed for name in LANGUAGES})}
|
||||
wanted = instruments_for(profile)
|
||||
stray = sorted(set(parts) - set(wanted))
|
||||
if stray:
|
||||
raise FeatureRecordError(f"parts for instruments outside the {profile} profile: {stray}")
|
||||
x: dict[str, Any] = {}
|
||||
for spec in features_for(profile):
|
||||
part = parts.get(spec.instrument, NONE)
|
||||
x[spec.name] = _clip(spec.name, part.values.get(spec.name)) if part.state == "ran" else None
|
||||
for name in wanted:
|
||||
part = parts.get(name, NONE)
|
||||
foreign = sorted(k for k in part.values if k not in BY_NAME or BY_NAME[k].instrument != name)
|
||||
if foreign:
|
||||
raise FeatureRecordError(f"instrument {name} supplied features it does not own: {foreign}")
|
||||
instruments = {name: {"state": parts.get(name, NONE).state, "version": parts.get(name, NONE).version} for name in wanted}
|
||||
out: dict[str, Any] = {
|
||||
"candidate": candidate, "family": family, "language": closed, "profile": profile, "schema_version": SCHEMA_VERSION,
|
||||
"feature_set_digest": feature_set_digest(), "unit": unit, "x": x, "instruments": instruments,
|
||||
} # fmt: skip
|
||||
if base is not None:
|
||||
out["base"] = base
|
||||
return validate_record(out)
|
||||
|
||||
|
||||
# --- per-instrument parts --------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def ruleset_digest(rules: Iterable[PatternRule]) -> str:
|
||||
"""sha256 of the rules as data: the quick instrument's version."""
|
||||
canonical = json.dumps([asdict(rule) for rule in rules], sort_keys=True, separators=(",", ":"))
|
||||
return "sha256:" + hashlib.sha256(canonical.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def _is_prior(item: object) -> bool:
|
||||
return bool(getattr(item, "framework", None) or getattr(item, "library", None))
|
||||
|
||||
|
||||
def quick_part(hits: Sequence[tuple[str, str]], rules: Mapping[str, PatternRule], version: str | None = None) -> Part:
|
||||
"""``hits`` are ``(rule_id, status)`` of the quick rules that fired in the candidate's function. Rule ids reach
|
||||
the record only as mechanism buckets and the prior count."""
|
||||
mechanisms = dict.fromkeys(MECHANISMS, 0)
|
||||
enabled = shadow = priors = 0
|
||||
precision: float | None = None
|
||||
for rule_id, status in hits:
|
||||
if status == "enabled":
|
||||
enabled += 1
|
||||
else:
|
||||
shadow += 1
|
||||
rule = rules.get(rule_id)
|
||||
if rule is None:
|
||||
mechanisms["other"] += 1
|
||||
continue
|
||||
for mechanism in sorted({RULE_TAG_MECHANISM.get(tag, "other") for tag in rule.tags} or {"other"}):
|
||||
mechanisms[mechanism] += 1
|
||||
precision = rule.precision_estimate if precision is None else max(precision, rule.precision_estimate)
|
||||
priors += 1 if _is_prior(rule) else 0
|
||||
values: dict[str, Any] = {"qr.enabled_hits": enabled, "qr.shadow_hits": shadow, "qr.prior_hits": priors}
|
||||
values.update({f"qr.mechanism.{m}": n for m, n in mechanisms.items()})
|
||||
values["qr.max_precision_estimate"] = None if precision is None else round(min(max(precision, 0.0), 1.0), 6)
|
||||
return Part("ran", values, version)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Vocabulary:
|
||||
"""The semantic entries of one language, to name a witness's sink operation and source kind and their origin."""
|
||||
|
||||
sinks: Mapping[str, tuple[str, str]] # call -> (operation, origin)
|
||||
sources: tuple[tuple[str, str, str], ...] # (pattern, kind, origin)
|
||||
|
||||
@classmethod
|
||||
def load(cls, language: str) -> Vocabulary:
|
||||
from ..semantic.facts import FactLoadError, load_facts
|
||||
|
||||
try:
|
||||
facts = load_facts().for_language(language)
|
||||
except FactLoadError:
|
||||
return cls({}, ())
|
||||
sinks: dict[str, tuple[str, str]] = {}
|
||||
for sink in facts.sinks:
|
||||
for call in sink.calls:
|
||||
sinks.setdefault(call, (CWE_OPERATION.get(sink.cwe, "other"), "prior" if _is_prior(sink) else "language"))
|
||||
sources = tuple(
|
||||
(pattern, SOURCE_KIND.get(src.id, "other"), "prior" if _is_prior(src) else "language")
|
||||
for src in facts.sources
|
||||
for pattern in src.patterns
|
||||
)
|
||||
return cls(sinks, sources)
|
||||
|
||||
def sink(self, text: str) -> tuple[str, str] | None:
|
||||
name = text.strip()
|
||||
for call in sorted(self.sinks, key=len, reverse=True):
|
||||
if name == call or name.endswith(("." + call, "->" + call, "::" + call)) or name.startswith(call + "("):
|
||||
return self.sinks[call]
|
||||
return None
|
||||
|
||||
def source(self, text: str) -> tuple[str, str] | None:
|
||||
for pattern, kind, origin in sorted(self.sources, key=lambda s: len(s[0]), reverse=True):
|
||||
if pattern in text:
|
||||
return kind, origin
|
||||
return None
|
||||
|
||||
|
||||
def engine_part(
|
||||
findings: Sequence[Mapping[str, Any]],
|
||||
*,
|
||||
completion: float | None,
|
||||
degraded: bool,
|
||||
vocabulary: Vocabulary | None = None,
|
||||
unstable: bool | None = None,
|
||||
version: str | None = None,
|
||||
) -> Part:
|
||||
"""The engine's findings in the candidate's function (``rung`` and ``witness`` when the producer kept them)."""
|
||||
rungs = [str(f["rung"]) for f in findings if str(f.get("rung")) in RUNGS]
|
||||
steps = [int(m.group(1)) for f in findings if (m := _STEPS.search(str(f.get("witness") or "")))]
|
||||
sink = source = None
|
||||
for finding in findings:
|
||||
match = _WITNESS.match(str(finding.get("witness") or ""))
|
||||
if match and vocabulary is not None:
|
||||
sink = sink or vocabulary.sink(match.group("sink"))
|
||||
source = source or vocabulary.source(match.group("source"))
|
||||
values = {
|
||||
"eng.findings": len(findings), "eng.rung_max": max(rungs, key=RUNGS.index) if rungs else None,
|
||||
"eng.witness_steps_min": min(steps) if steps else None, "eng.sink_kind": sink[0] if sink else None,
|
||||
"eng.sink_origin": sink[1] if sink else None, "eng.source_kind": source[0] if source else None,
|
||||
"eng.source_origin": source[1] if source else None, "eng.sanitizer_on_path": None,
|
||||
"eng.completion": None if completion is None else round(min(max(completion, 0.0), 1.0), 6), "eng.degraded": degraded,
|
||||
"eng.unstable": unstable,
|
||||
} # fmt: skip
|
||||
return Part("ran", values, version)
|
||||
|
||||
|
||||
def facts_part(callers: Sequence[Mapping[str, Any]], function: str, version: str | None = None) -> Part:
|
||||
"""``callers`` are the repo-facts call sites of the candidate's function in other files."""
|
||||
files = {str(site.get("path")) for site in callers}
|
||||
return Part("ran", {"facts.callers": len(callers), "facts.caller_files": len(files), "facts.is_global": function == GLOBAL}, version)
|
||||
|
||||
|
||||
def function_span(lines: Sequence[str], language: str, function: str) -> int | None:
|
||||
"""Lines of the first declaration of ``function`` up to the next declaration (Python: up to the next line indented
|
||||
no deeper), ``None`` when the file does not declare it. ``<global>`` counts the whole file."""
|
||||
if function == GLOBAL:
|
||||
return len(lines)
|
||||
pattern = DECLARATION.get(language)
|
||||
if pattern is None:
|
||||
return None
|
||||
start = next((i for i, line in enumerate(lines) if _declared_name(pattern, line) == function), None)
|
||||
if start is None:
|
||||
return None
|
||||
indent = len(lines[start]) - len(lines[start].lstrip(" \t"))
|
||||
for end in range(start + 1, len(lines)):
|
||||
line = lines[end]
|
||||
if language == "python":
|
||||
if line.strip() and not line.lstrip().startswith("#") and len(line) - len(line.lstrip(" \t")) <= indent:
|
||||
return end - start
|
||||
elif _declared_name(pattern, line):
|
||||
return end - start
|
||||
return len(lines) - start
|
||||
|
||||
|
||||
def source_part(lines: Sequence[str] | None, language: str, function: str) -> Part:
|
||||
if lines is None:
|
||||
return NONE
|
||||
span = function_span(lines, language, function)
|
||||
return Part("ran", {"facts.function_lines": span}) if span is not None else Part("failed")
|
||||
|
||||
|
||||
def verify_part(passes: Mapping[str, Sequence[Mapping[str, Any]]], candidate: str, line: int | None, version: str | None = None) -> Part:
|
||||
"""Pass verdicts of one candidate from the passes' ``units.jsonl``: asked in a pass when a unit's candidates list
|
||||
it, flagged when that unit's ``flagged`` names it. ``none`` when no pass asked it."""
|
||||
flags: dict[str, bool | None] = {}
|
||||
turns: list[float] = []
|
||||
offsets: list[int] = []
|
||||
for label in ("a", "b", "c"):
|
||||
asked = [u for u in passes.get(label) or () if any(f"{c[0]}::{c[1]}" == candidate for c in u.get("candidates") or ())]
|
||||
if not asked:
|
||||
flags[label] = None
|
||||
continue
|
||||
flagged = [f for u in asked for f in u.get("flagged") or () if f.get("candidate") == candidate]
|
||||
flags[label] = bool(flagged)
|
||||
turns.extend(float(u["turns"]) for u in asked if isinstance(u.get("turns"), (int, float)))
|
||||
for finding in flagged:
|
||||
reported = str(finding.get("reported_at") or "").rpartition(":")[2]
|
||||
if line is not None and reported.isdigit():
|
||||
offsets.append(abs(int(reported) - line))
|
||||
if flags["a"] is None and flags["b"] is None:
|
||||
return NONE
|
||||
values = {
|
||||
"verify.flag_a": flags["a"], "verify.flag_b": flags["b"], "verify.flag_c": flags["c"],
|
||||
"verify.votes": sum(1 for v in flags.values() if v), "verify.turns_mean": round(sum(turns) / len(turns), 3) if turns else None,
|
||||
"verify.site_offset": min(offsets) if offsets else None,
|
||||
} # fmt: skip
|
||||
return Part("ran", values, version)
|
||||
|
||||
|
||||
def agree_part(final: str | None) -> Part:
|
||||
return Part("ran", {"agree.final": final}) if final else NONE
|
||||
|
||||
|
||||
# --- the host path ---------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Delta:
|
||||
"""A base..head delta: the base checkout, the head-side changed line ranges per path (``git diff -U0``), and the
|
||||
base's quick findings and engine result, whose signals decide novelty."""
|
||||
|
||||
root: Path
|
||||
changed: Mapping[str, Sequence[tuple[int, int]]]
|
||||
findings: Sequence[Any] = ()
|
||||
engine_result: Mapping[str, Any] | None = None
|
||||
pin: str | None = None
|
||||
|
||||
|
||||
class SourceIndex:
|
||||
"""A checkout's product files read once: lines per path, the enclosing function of a line, and the name-level
|
||||
caller graph (the repo-facts patterns) for the entry-point distance."""
|
||||
|
||||
def __init__(self, root: Path) -> None:
|
||||
self.root = Path(root)
|
||||
self._lines: dict[str, list[str] | None] = {}
|
||||
self._callers: dict[str, set[str]] | None = None
|
||||
self._files: list[str] | None = None
|
||||
|
||||
def files(self) -> list[str]:
|
||||
if self._files is None:
|
||||
self._files = [p.relative_to(self.root).as_posix() for p in product_files(self.root)]
|
||||
return self._files
|
||||
|
||||
def lines(self, path: str) -> list[str] | None:
|
||||
if path not in self._lines:
|
||||
file = self.root / path
|
||||
self._lines[path] = file.read_text(encoding="utf-8", errors="replace").splitlines() if file.is_file() else None
|
||||
return self._lines[path]
|
||||
|
||||
def function_at(self, path: str, line: int | None, fallback: str | None = None) -> str:
|
||||
lines = self.lines(path)
|
||||
language = detect_language(Path(path))
|
||||
if lines and language in DECLARATION and line and 0 < line <= len(lines):
|
||||
return enclosing(lines, line - 1, language)
|
||||
return fallback or GLOBAL
|
||||
|
||||
def callers(self) -> dict[str, set[str]]:
|
||||
"""Function name -> the names of the functions that call it anywhere in the product files."""
|
||||
if self._callers is None:
|
||||
declared: dict[str, set[str]] = {}
|
||||
files = self.files()
|
||||
for path in files:
|
||||
language = detect_language(Path(path))
|
||||
pattern = DECLARATION.get(language)
|
||||
if pattern is not None:
|
||||
declared.setdefault(language, set()).update(
|
||||
n for line in self.lines(path) or () if (n := _declared_name(pattern, line))
|
||||
)
|
||||
graph: dict[str, set[str]] = {}
|
||||
for path in files:
|
||||
language = detect_language(Path(path))
|
||||
names, lines = declared.get(language, set()), self.lines(path) or []
|
||||
for index, line in enumerate(lines):
|
||||
if line.lstrip().startswith(_COMMENT_PREFIXES):
|
||||
continue
|
||||
for match in _CALL.finditer(line):
|
||||
if match.group(1) in names:
|
||||
graph.setdefault(match.group(1), set()).add(enclosing(lines, index, language))
|
||||
self._callers = graph
|
||||
return self._callers
|
||||
|
||||
|
||||
def entry_distance(function: str, entries: set[str], callers: Mapping[str, set[str]], cap: int = 6) -> int:
|
||||
"""Caller-graph hops from an entry point to ``function``; ``cap`` means not reached within ``cap - 1`` hops."""
|
||||
frontier, seen = {function}, {function}
|
||||
for hops in range(cap):
|
||||
if frontier & entries:
|
||||
return hops
|
||||
frontier = {c for name in frontier for c in callers.get(name, ()) if c not in seen}
|
||||
seen |= frontier
|
||||
if not frontier:
|
||||
break
|
||||
return cap
|
||||
|
||||
|
||||
def entry_names(root: Path, paths: Iterable[str]) -> tuple[set[str], set[str]]:
|
||||
"""(entry function names, paths with a file-level entry) by :func:`..mapping.analyze_entry_points`."""
|
||||
from ..mapping import analyze_entry_points
|
||||
|
||||
targets = [build_file_target(root, root / p) for p in sorted(set(paths)) if (root / p).is_file()]
|
||||
records = analyze_entry_points(root, targets)
|
||||
return {r.function_name for r in records if r.function_name}, {r.path for r in records}
|
||||
|
||||
|
||||
def _family_of(rule: PatternRule | None) -> str:
|
||||
if rule is None:
|
||||
return UNKNOWN_FAMILY
|
||||
family = load_families().family_of_cwe(rule.cwe)
|
||||
return family.id if family is not None else UNKNOWN_FAMILY
|
||||
|
||||
|
||||
def _engine_state(result: Mapping[str, Any] | None) -> str:
|
||||
if result is None:
|
||||
return "none"
|
||||
return "ran" if int(result.get("questions") or 0) > 0 else "failed"
|
||||
|
||||
|
||||
def _signals(
|
||||
index: SourceIndex, findings: Sequence[Any], engine_result: Mapping[str, Any] | None, rules: Mapping[str, PatternRule]
|
||||
) -> tuple[dict[tuple[str, str, str], list[tuple[str, str]]], dict[tuple[str, str, str], list[Mapping[str, Any]]]]:
|
||||
quick: dict[tuple[str, str, str], list[tuple[str, str]]] = {}
|
||||
for finding in findings:
|
||||
rule_id = str(finding.finding_id).split(":", 1)[0]
|
||||
function = index.function_at(finding.path, finding.line, finding.function_name)
|
||||
quick.setdefault((finding.path, function, _family_of(rules.get(rule_id))), []).append((rule_id, str(finding.status)))
|
||||
engine: dict[tuple[str, str, str], list[Mapping[str, Any]]] = {}
|
||||
for finding in (engine_result or {}).get("findings") or []:
|
||||
path, _, rest = str(finding.get("site") or "").partition(":")
|
||||
line_text, _, function_name = rest.partition(":")
|
||||
line = int(line_text) if line_text.isdigit() else None
|
||||
function = index.function_at(path, line, function_name or None)
|
||||
engine.setdefault((path, function, str(finding.get("family") or UNKNOWN_FAMILY)), []).append(finding)
|
||||
return quick, engine
|
||||
|
||||
|
||||
def _changed_in(index: SourceIndex, changed: Mapping[str, Sequence[tuple[int, int]]]) -> dict[tuple[str, str], int]:
|
||||
"""(path, function) -> changed lines inside it, by the head's enclosing declarations."""
|
||||
counts: dict[tuple[str, str], int] = {}
|
||||
for path, ranges in changed.items():
|
||||
for lo, hi in ranges:
|
||||
for line in range(int(lo), int(hi) + 1):
|
||||
key = (path, index.function_at(path, line))
|
||||
counts[key] = counts.get(key, 0) + 1
|
||||
return counts
|
||||
|
||||
|
||||
def _body_calls(lines: Sequence[str] | None, language: str, function: str) -> set[str]:
|
||||
if not lines:
|
||||
return set()
|
||||
return {m.group(1) for i, line in enumerate(lines) if enclosing(lines, i, language) == function for m in _CALL.finditer(line)}
|
||||
|
||||
|
||||
def build_for_scan(
|
||||
root: Path,
|
||||
findings: Sequence[Any],
|
||||
engine_result: Mapping[str, Any] | None,
|
||||
*,
|
||||
base: Delta | None = None,
|
||||
rules: Sequence[PatternRule] | None = None,
|
||||
quick_languages: Iterable[str] | None = None,
|
||||
engine_languages: Iterable[str] | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""``static`` records for a checkout: one per (path, function, family) with a quick or engine signal. ``findings``
|
||||
are the quick findings (enabled and shadow alike), ``engine_result`` the engine's record (``findings`` with
|
||||
``site``/``family``/``rung``/``witness``, ``questions``, ``completed``, ``degradations``; ``None`` when the engine
|
||||
did not run, ``questions == 0`` is ``failed``). With ``base`` only functions enclosing a changed line are
|
||||
candidates, and ``delta.*`` compares their signals with the base's."""
|
||||
from ..plane.tasks.alerts import covers
|
||||
from ..plane.tasks.alerts import engine_languages as engine_covered
|
||||
from ..plane.tasks.alerts import quick_languages as quick_covered
|
||||
from ..semantic.facts import FactLoadError, load_facts
|
||||
|
||||
root = Path(root)
|
||||
loaded = tuple(rules) if rules is not None else load_ruleset(DEFAULT_RULESET_DIR)
|
||||
by_id = {rule.rule_id: rule for rule in loaded}
|
||||
quick_langs = set(quick_languages if quick_languages is not None else quick_covered())
|
||||
engine_langs = set(engine_languages if engine_languages is not None else engine_covered())
|
||||
index = SourceIndex(root)
|
||||
quick, engine = _signals(index, findings, engine_result, by_id)
|
||||
keys = sorted(set(quick) | set(engine))
|
||||
changed: dict[tuple[str, str], int] = {}
|
||||
base_quick: dict[tuple[str, str, str], list[tuple[str, str]]] = {}
|
||||
base_engine: dict[tuple[str, str, str], list[Mapping[str, Any]]] = {}
|
||||
base_index: SourceIndex | None = None
|
||||
if base is not None:
|
||||
changed = _changed_in(index, base.changed)
|
||||
keys = [k for k in keys if (k[0], k[1]) in changed]
|
||||
base_index = SourceIndex(base.root)
|
||||
base_quick, base_engine = _signals(base_index, base.findings, base.engine_result, by_id)
|
||||
entries, file_entries = entry_names(root, {k[0] for k in keys}) if keys else (set(), set())
|
||||
callers = index.callers() if keys else {}
|
||||
quick_version = ruleset_digest(loaded)
|
||||
engine_state = _engine_state(engine_result)
|
||||
completed, questions = (engine_result or {}).get("completed"), (engine_result or {}).get("questions")
|
||||
completion = int(completed) / int(questions) if isinstance(completed, int) and isinstance(questions, int) and questions else None
|
||||
degraded = bool((engine_result or {}).get("degradations"))
|
||||
vocabularies: dict[str, Vocabulary] = {}
|
||||
try:
|
||||
sanitizer_calls = {language: {c for s in load_facts().for_language(language).sanitizers for c in s.calls} for language in LANGUAGES}
|
||||
except FactLoadError:
|
||||
sanitizer_calls = {}
|
||||
out: list[dict[str, Any]] = []
|
||||
for key in keys:
|
||||
path, function, family = key
|
||||
language = detect_language(Path(path))
|
||||
parts: dict[str, Part] = {}
|
||||
parts["quick"] = quick_part(quick.get(key, []), by_id, quick_version) if covers(quick_langs, language) else NONE
|
||||
if language in engine_langs and engine_state != "none":
|
||||
vocabulary = vocabularies.setdefault(language, Vocabulary.load(language))
|
||||
parts["engine"] = (
|
||||
engine_part(engine.get(key, []), completion=completion, degraded=degraded, vocabulary=vocabulary)
|
||||
if engine_state == "ran" else Part("failed")
|
||||
) # fmt: skip
|
||||
lines = index.lines(path)
|
||||
parts["source"] = source_part(lines, language, function)
|
||||
distance = 0 if function == GLOBAL and path in file_entries else entry_distance(function, entries, callers)
|
||||
parts["entry_points"] = Part("ran", {"facts.entry_distance": distance})
|
||||
parts["facts"] = facts_part(_callers_of(index, callers, path, function), function)
|
||||
if base is None or base_index is None:
|
||||
parts["delta"] = NOT_APPLICABLE
|
||||
else:
|
||||
head_n = len(quick.get(key, [])) + len(engine.get(key, []))
|
||||
base_n = len(base_quick.get(key, [])) + len(base_engine.get(key, []))
|
||||
novelty = "new" if base_n == 0 else "worsened" if head_n > base_n else "unchanged"
|
||||
known = sanitizer_calls.get(language, set())
|
||||
removed = bool((_body_calls(base_index.lines(path), language, function) - _body_calls(lines, language, function)) & known)
|
||||
values = {"delta.novelty": novelty, "delta.changed_lines": changed.get((path, function), 0), "delta.sanitizer_removed": removed}
|
||||
parts["delta"] = Part("ran", values)
|
||||
unit, pin = ("delta", base.pin) if base is not None else ("pin", None)
|
||||
out.append(record(f"{path}::{function}", family, language, "static", parts, unit=unit, base=pin))
|
||||
return out
|
||||
|
||||
|
||||
def _callers_of(index: SourceIndex, callers: Mapping[str, set[str]], path: str, function: str) -> list[dict[str, Any]]:
|
||||
"""The call sites of ``function`` in other product files, as repo-facts records them (capped at 40)."""
|
||||
if function == GLOBAL or function not in callers:
|
||||
return []
|
||||
sites: list[dict[str, Any]] = []
|
||||
pattern = re.compile(r"(?<![A-Za-z0-9_$])" + re.escape(function) + r"\s*\(")
|
||||
for other in index.files():
|
||||
if other == path or detect_language(Path(other)) != detect_language(Path(path)):
|
||||
continue
|
||||
for number, line in enumerate(index.lines(other) or (), start=1):
|
||||
if pattern.search(line) and not line.lstrip().startswith(_COMMENT_PREFIXES):
|
||||
sites.append({"path": other, "line": number})
|
||||
if len(sites) >= 40:
|
||||
return sites
|
||||
return sites
|
||||
|
||||
|
||||
__all__ = [
|
||||
"CWE_OPERATION", "NONE", "NOT_APPLICABLE", "SOURCE_KIND", "Delta", "Part", "SourceIndex", "Vocabulary", "agree_part",
|
||||
"build_for_scan", "engine_part", "entry_distance", "entry_names", "facts_part", "function_span", "language_of", "quick_part", "record",
|
||||
"ruleset_digest", "source_part", "verify_part",
|
||||
] # fmt: skip
|
||||
@@ -0,0 +1,258 @@
|
||||
"""The candidate feature record: a closed, typed allow-list (learned-decision-engine Req 1, 7.2; design section 1).
|
||||
|
||||
A candidate is ``(repo, pin, path, function, family)``. That key lives in the record's envelope, for joining labels
|
||||
and grouping folds, and is never a feature. The features are the closed list :data:`FEATURES`: each has a name, the
|
||||
instrument that produces it, a type (``bool``, ``int`` with a cap, ``float`` in [0, 1], or ``enum`` over a closed
|
||||
vocabulary), a profile (``static``: what ``scan``/``pre-push`` compute locally without a model; ``plane``: adds
|
||||
verify, agree and model roles) and whether it is a framework *prior* (Req 8.2). There is no free text, no
|
||||
identifier and no raw count of a repository-specific token: rule ids enter only through the closed mechanism
|
||||
buckets and the prior count, because a rule written after one case's miss would otherwise name that case.
|
||||
|
||||
**Missing is not negative (Req 1.2).** A record carries ``instruments: {name: {state, version}}`` with ``state`` in
|
||||
:data:`STATES`:
|
||||
|
||||
- ``ran``: the instrument read its input for this candidate; its features hold values (``0`` is a real zero);
|
||||
- ``none``: no coverage -- the instrument has no rule/model for the language, or it was not part of the run;
|
||||
- ``failed``: the instrument broke or did not demonstrably read its input (never zero findings);
|
||||
- ``not_applicable``: ``delta.*`` on a whole-repository scan, ``facts.*`` on a pair excerpt.
|
||||
|
||||
Every feature of an instrument whose state is not ``ran`` is ``null``. A feature of an instrument that ran is
|
||||
``null`` only where the spec says ``nullable`` (a minimum over no findings, an answer to a pass never asked).
|
||||
At training time a ``null`` becomes 0 plus one indicator ``missing.<instrument>`` per instrument.
|
||||
|
||||
**Excluded** (label information or identities, :data:`EXCLUDED_FIELDS`): ``site_match``, ``in_fix_range``, every
|
||||
fixed-pin alert, declared sites and ``case.json``, costs, rule ids, paths, file and function names, commit ids and
|
||||
repository names. :func:`validate_record` rejects them anywhere in a record's features, and the builders drop them on
|
||||
read.
|
||||
|
||||
Versioning: :data:`SCHEMA_VERSION` (bumped on any spec change) and :func:`feature_set_digest` (sha256 of the
|
||||
canonical :data:`FEATURES`), recorded in every record, so a model trained on one feature set never scores another.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import math
|
||||
from collections.abc import Iterable, Mapping
|
||||
from dataclasses import asdict, dataclass
|
||||
from typing import Any, Literal
|
||||
|
||||
SCHEMA_VERSION = 1
|
||||
PROFILES = ("static", "plane")
|
||||
STATES = ("ran", "none", "failed", "not_applicable")
|
||||
UNITS = ("pin", "delta")
|
||||
Profile = Literal["static", "plane"]
|
||||
FeatureType = Literal["bool", "int", "float", "enum"]
|
||||
|
||||
# The instruments, in record order. `language` always runs (it is the file's extension).
|
||||
INSTRUMENTS = (
|
||||
"language", "quick", "engine", "facts", "source", "entry_points", "roles", "delta", "verify", "agree", "model_sinks",
|
||||
) # fmt: skip
|
||||
|
||||
# The languages the engine or quick mode covers; anything else is `other` (a one-hot, never a name).
|
||||
LANGUAGES = ("c", "cpp", "groovy", "java", "javascript", "php", "python", "typescript", "other")
|
||||
|
||||
# The closed mechanism vocabulary: the ids of `benchmarks/pairs/mechanisms.toml` (a test keeps them equal).
|
||||
MECHANISMS = (
|
||||
"source_reaches_sink", "container_taint", "config_sink_weak_literal", "unchecked_length_copy", "unchecked_alloc_size",
|
||||
"null_deref_unguarded", "signed_size_operand", "fixed_buffer_capacity", "identity_from_request_body",
|
||||
"missing_auth_guard", "secret_in_client", "permissive_default", "path_join_user_input", "prototype_pollution", "redos",
|
||||
"uaf", "type_confusion", "validation_strength", "cross_artifact", "unconstrained_protected_read",
|
||||
"unconstrained_protected_write", "unguarded_privileged_action", "other",
|
||||
) # fmt: skip
|
||||
|
||||
# A quick rule's `tags` mapped into the mechanism vocabulary; an unmapped tag counts as `other`.
|
||||
RULE_TAG_MECHANISM = {
|
||||
"injection": "source_reaches_sink",
|
||||
"syscall_entry": "source_reaches_sink",
|
||||
"deserialization": "source_reaches_sink",
|
||||
"network_entry": "source_reaches_sink",
|
||||
"filesystem_entry": "path_join_user_input",
|
||||
"memory_unsafe": "unchecked_length_copy",
|
||||
"crypto": "config_sink_weak_literal",
|
||||
"insecure_default": "permissive_default",
|
||||
}
|
||||
|
||||
RUNGS = ("suspicion", "model_corroborated", "model_entailed", "execution_confirmed")
|
||||
OPERATIONS = (
|
||||
"sql", "command", "code_eval", "deserialize", "file_path", "file_inclusion", "outbound_request", "redirect", "html_output",
|
||||
"other",
|
||||
) # fmt: skip
|
||||
SOURCE_KINDS = ("request", "server", "raw_body", "argv_stdin", "inferred_role", "prior", "other")
|
||||
ORIGINS = ("language", "inferred_wrapper", "model_role", "prior")
|
||||
NOVELTY = ("new", "worsened", "unchanged", "unknown", "not_applicable")
|
||||
FINALS = ("agreed", "disputed", "rejected")
|
||||
|
||||
# Fields that carry label information or an identity. None may be a feature; builders drop them on read.
|
||||
EXCLUDED_FIELDS = frozenset(
|
||||
{
|
||||
"site_match", "in_fix_range", "fixed_ranges", "ranges", "sites", "declared_sites", "case", "case_json",
|
||||
"usd", "cost", "rule_id", "rule_ids", "path", "file", "function", "candidate", "repo", "repository", "pin",
|
||||
"commit", "base", "sha", "title", "witness", "site", "reported_at",
|
||||
}
|
||||
) # fmt: skip
|
||||
|
||||
|
||||
class FeatureRecordError(ValueError):
|
||||
"""A record names a feature outside the allow-list, a value outside its type, or a label/identity field."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class FeatureSpec:
|
||||
name: str
|
||||
instrument: str
|
||||
type: FeatureType
|
||||
profile: Profile
|
||||
cap: int | None = None # int: the value is clipped to [0, cap]
|
||||
vocabulary: tuple[str, ...] = () # enum: the closed set of values
|
||||
prior: bool = False # a framework/library prior (Req 8.2): off by default for the engine
|
||||
nullable: bool = False # may be null while its instrument ran (a minimum over nothing, a pass never asked)
|
||||
|
||||
|
||||
def _specs() -> tuple[FeatureSpec, ...]:
|
||||
specs: list[FeatureSpec] = [FeatureSpec(f"lang.{name}", "language", "bool", "static") for name in LANGUAGES]
|
||||
specs += [
|
||||
FeatureSpec("qr.enabled_hits", "quick", "int", "static", cap=20),
|
||||
FeatureSpec("qr.shadow_hits", "quick", "int", "static", cap=20),
|
||||
]
|
||||
specs += [FeatureSpec(f"qr.mechanism.{m}", "quick", "int", "static", cap=10) for m in MECHANISMS]
|
||||
specs += [
|
||||
FeatureSpec("qr.max_precision_estimate", "quick", "float", "static", nullable=True),
|
||||
FeatureSpec("qr.prior_hits", "quick", "int", "static", cap=10, prior=True),
|
||||
FeatureSpec("eng.findings", "engine", "int", "static", cap=10),
|
||||
FeatureSpec("eng.rung_max", "engine", "enum", "static", vocabulary=RUNGS, nullable=True),
|
||||
FeatureSpec("eng.witness_steps_min", "engine", "int", "static", cap=50, nullable=True),
|
||||
FeatureSpec("eng.sink_kind", "engine", "enum", "static", vocabulary=OPERATIONS, nullable=True),
|
||||
FeatureSpec("eng.source_kind", "engine", "enum", "static", vocabulary=SOURCE_KINDS, nullable=True),
|
||||
FeatureSpec("eng.sink_origin", "engine", "enum", "static", vocabulary=ORIGINS, nullable=True),
|
||||
FeatureSpec("eng.source_origin", "engine", "enum", "static", vocabulary=ORIGINS, nullable=True),
|
||||
FeatureSpec("eng.sanitizer_on_path", "engine", "bool", "static", nullable=True),
|
||||
FeatureSpec("eng.completion", "engine", "float", "static", nullable=True),
|
||||
FeatureSpec("eng.degraded", "engine", "bool", "static"),
|
||||
FeatureSpec("eng.unstable", "engine", "bool", "static", nullable=True),
|
||||
FeatureSpec("facts.callers", "facts", "int", "static", cap=40),
|
||||
FeatureSpec("facts.caller_files", "facts", "int", "static", cap=20),
|
||||
FeatureSpec("facts.is_global", "facts", "bool", "static"),
|
||||
FeatureSpec("facts.function_lines", "source", "int", "static", cap=500),
|
||||
FeatureSpec("facts.entry_distance", "entry_points", "int", "static", cap=6),
|
||||
FeatureSpec("roles.sink_confidence", "roles", "float", "static", nullable=True),
|
||||
FeatureSpec("roles.source_in_function", "roles", "bool", "static"),
|
||||
FeatureSpec("delta.novelty", "delta", "enum", "static", vocabulary=NOVELTY),
|
||||
FeatureSpec("delta.changed_lines", "delta", "int", "static", cap=200),
|
||||
FeatureSpec("delta.sanitizer_removed", "delta", "bool", "static"),
|
||||
FeatureSpec("verify.flag_a", "verify", "bool", "plane", nullable=True),
|
||||
FeatureSpec("verify.flag_b", "verify", "bool", "plane", nullable=True),
|
||||
FeatureSpec("verify.flag_c", "verify", "bool", "plane", nullable=True),
|
||||
FeatureSpec("verify.votes", "verify", "int", "plane", cap=3),
|
||||
FeatureSpec("verify.turns_mean", "verify", "float", "plane", nullable=True),
|
||||
FeatureSpec("verify.site_offset", "verify", "int", "plane", cap=200, nullable=True),
|
||||
FeatureSpec("agree.final", "agree", "enum", "plane", vocabulary=FINALS),
|
||||
FeatureSpec("ms.flagged", "model_sinks", "bool", "plane"),
|
||||
FeatureSpec("ms.operation", "model_sinks", "enum", "plane", vocabulary=OPERATIONS, nullable=True),
|
||||
]
|
||||
return tuple(specs)
|
||||
|
||||
|
||||
FEATURES: tuple[FeatureSpec, ...] = _specs()
|
||||
BY_NAME: Mapping[str, FeatureSpec] = {spec.name: spec for spec in FEATURES}
|
||||
# `float` features are fractions or means; `verify.turns_mean` is a mean of tool turns, the only unbounded float.
|
||||
UNBOUNDED_FLOATS = frozenset({"verify.turns_mean"})
|
||||
|
||||
|
||||
def features_for(profile: str) -> tuple[FeatureSpec, ...]:
|
||||
"""The features a record of ``profile`` carries: ``static`` never sees an instrument absent in deployment."""
|
||||
if profile not in PROFILES:
|
||||
raise FeatureRecordError(f"unknown profile {profile!r} (one of {', '.join(PROFILES)})")
|
||||
return FEATURES if profile == "plane" else tuple(spec for spec in FEATURES if spec.profile == "static")
|
||||
|
||||
|
||||
def instruments_for(profile: str) -> tuple[str, ...]:
|
||||
used = {spec.instrument for spec in features_for(profile)}
|
||||
return tuple(name for name in INSTRUMENTS if name in used)
|
||||
|
||||
|
||||
def feature_set_digest() -> str:
|
||||
"""sha256 of the canonical feature list: any change to a name, type, cap, vocabulary or profile changes it."""
|
||||
canonical = json.dumps([asdict(spec) for spec in FEATURES], sort_keys=True, separators=(",", ":"))
|
||||
return hashlib.sha256(canonical.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def _check_value(spec: FeatureSpec, value: object) -> None:
|
||||
where = f"feature {spec.name}"
|
||||
if spec.type == "bool":
|
||||
if not isinstance(value, bool):
|
||||
raise FeatureRecordError(f"{where}: expected a bool, got {value!r}")
|
||||
elif spec.type == "int":
|
||||
if isinstance(value, bool) or not isinstance(value, int) or not 0 <= value <= (spec.cap or 0):
|
||||
raise FeatureRecordError(f"{where}: expected an int in [0, {spec.cap}], got {value!r}")
|
||||
elif spec.type == "float":
|
||||
if isinstance(value, bool) or not isinstance(value, (int, float)) or not math.isfinite(value) or value < 0:
|
||||
raise FeatureRecordError(f"{where}: expected a finite non-negative number, got {value!r}")
|
||||
if spec.name not in UNBOUNDED_FLOATS and value > 1:
|
||||
raise FeatureRecordError(f"{where}: expected a fraction in [0, 1], got {value!r}")
|
||||
elif not isinstance(value, str) or value not in spec.vocabulary:
|
||||
raise FeatureRecordError(f"{where}: {value!r} is outside the vocabulary {list(spec.vocabulary)}")
|
||||
|
||||
|
||||
def validate_x(x: Mapping[str, object], instruments: Mapping[str, Mapping[str, object]], profile: str) -> None:
|
||||
"""The features of one record against the allow-list and the instruments' states."""
|
||||
specs = {spec.name: spec for spec in features_for(profile)}
|
||||
unknown = sorted(set(x) - set(specs))
|
||||
if unknown:
|
||||
label = sorted(k for k in unknown if k.rsplit(".", 1)[-1] in EXCLUDED_FIELDS)
|
||||
why = f" (label or identity fields: {label})" if label else ""
|
||||
raise FeatureRecordError(f"features outside the {profile} allow-list: {unknown}{why}")
|
||||
missing = sorted(set(specs) - set(x))
|
||||
if missing:
|
||||
raise FeatureRecordError(f"features missing from the record: {missing}")
|
||||
wanted = set(instruments_for(profile))
|
||||
if set(instruments) != wanted:
|
||||
raise FeatureRecordError(f"instruments {sorted(instruments)} != the {profile} profile's {sorted(wanted)}")
|
||||
for name, info in instruments.items():
|
||||
if not isinstance(info, Mapping) or info.get("state") not in STATES:
|
||||
raise FeatureRecordError(f"instrument {name}: state must be one of {STATES}, got {info!r}")
|
||||
for name, spec in specs.items():
|
||||
value, state = x[name], instruments[spec.instrument]["state"]
|
||||
if state != "ran":
|
||||
if value is not None:
|
||||
raise FeatureRecordError(f"feature {name}: instrument {spec.instrument} is {state}, so the value must be null")
|
||||
continue
|
||||
if value is None:
|
||||
if not spec.nullable:
|
||||
raise FeatureRecordError(f"feature {name}: instrument {spec.instrument} ran, so null is not allowed here")
|
||||
continue
|
||||
_check_value(spec, value)
|
||||
|
||||
|
||||
RECORD_FIELDS = ("candidate", "family", "language", "profile", "schema_version", "feature_set_digest", "unit", "x", "instruments")
|
||||
|
||||
|
||||
def validate_record(record: Mapping[str, Any]) -> dict[str, Any]:
|
||||
"""A feature record, checked: envelope fields, versions, profile, and :func:`validate_x`. Returns it as a dict."""
|
||||
extra = sorted(set(record) - {*RECORD_FIELDS, "base"})
|
||||
if extra:
|
||||
raise FeatureRecordError(f"record fields outside the schema: {extra}")
|
||||
missing = [name for name in RECORD_FIELDS if name not in record]
|
||||
if missing:
|
||||
raise FeatureRecordError(f"record fields missing: {missing}")
|
||||
if record["schema_version"] != SCHEMA_VERSION or record["feature_set_digest"] != feature_set_digest():
|
||||
raise FeatureRecordError("record built for another schema version or feature set")
|
||||
if record["unit"] not in UNITS:
|
||||
raise FeatureRecordError(f"unit {record['unit']!r} is not one of {UNITS}")
|
||||
if not isinstance(record["x"], Mapping) or not isinstance(record["instruments"], Mapping):
|
||||
raise FeatureRecordError("x and instruments must be objects")
|
||||
validate_x(record["x"], record["instruments"], str(record["profile"]))
|
||||
return dict(record)
|
||||
|
||||
|
||||
def names(specs: Iterable[FeatureSpec] = FEATURES) -> tuple[str, ...]:
|
||||
return tuple(spec.name for spec in specs)
|
||||
|
||||
|
||||
__all__ = [
|
||||
"BY_NAME", "EXCLUDED_FIELDS", "FEATURES", "FINALS", "INSTRUMENTS", "LANGUAGES", "MECHANISMS", "NOVELTY", "OPERATIONS",
|
||||
"ORIGINS", "PROFILES", "RULE_TAG_MECHANISM", "RUNGS", "SCHEMA_VERSION", "SOURCE_KINDS", "STATES", "UNITS",
|
||||
"FeatureRecordError", "FeatureSpec", "feature_set_digest", "features_for", "instruments_for", "names",
|
||||
"validate_record", "validate_x",
|
||||
] # fmt: skip
|
||||
Reference in New Issue
Block a user