Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .ratchet.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@
"contracts": 1,
"state-file": 4
},
"src/traust_engine/metrics/history.py": {
"contracts": 2
},
"src/traust_engine/metrics/spend.py": {
"contracts": 1
},
"src/traust_engine/ops/admission.py": {
"core-internal": 2
},
Expand All @@ -46,12 +40,6 @@
"src/traust_engine/portfolio/graph.py": {
"database": 1
},
"src/traust_engine/registry/models.py": {
"contracts": 1
},
"src/traust_engine/registry/ops.py": {
"contracts": 1
},
"src/traust_engine/sweep/engine.py": {
"contracts": 1
},
Expand Down
3 changes: 0 additions & 3 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@
# Disposition ledger and corpus resolution
/src/traust_engine/corpus/ @traust-security/traust-admins

# Metrics journal
/src/traust_engine/metrics/history.py @traust-security/traust-admins

* @traust-security/traust-admins
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ tagged `PENDING(decision: …)`); deleted when traust retires or ports it:

| Module | Kept for |
|---|---|
| `traust_engine.engine` | `HarnessEngine` facade: `.metrics`, `.models`, `.adapters`, `.sweep`, `.portfolio` |
| `traust_engine.engine` | `HarnessEngine` facade: `.adapters`, `.sweep`, `.portfolio` |
| `traust_engine.sweep` | sweep stages: collect, draft, sweep, emit, benchmark, rule lane, mining, calibration |
| `traust_engine.portfolio` | portfolio graph layers |
| `traust_engine.metrics`, `traust_engine.registry` | metrics journal and spend pricing |
| `traust_engine.adapters` | opengrep (sweep stages) and checkov (portfolio graph) |
| `traust_engine.corpus` | the report population the sweep stages read |

The opengrep rule pack ships under `data/secure-code-audit/opengrep-rules/`. This library ships **no configuration files and never loads
config itself — it is a pure consumer.** A caller builds the context once
(`traust_contracts.load_context()`, done for you by
`HarnessEngine.load(config_home=…)`) and the engine receives it *injected*: the
ops namespaces (`h.metrics`, `h.adapters`, …) hold the frozen `HarnessContext` and
ops namespaces (`h.sweep`, `h.adapters`, …) hold the frozen `HarnessContext` and
derive paths from it; stateless functions take already-resolved arguments. No
environment overrides, no cwd or workspace-shaped guessing; a required-but-absent
file fails closed with `DeploymentConfigMissing` at the entry point. The config
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ ignore = ["RUF001", "RUF002", "RUF003"]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "E741", "E402", "E501", "RUF012"]
"src/traust_engine/metrics/history.py" = ["E501"]
6 changes: 2 additions & 4 deletions src/traust_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
ops — continuous ops: pack spec, controller (tick), admission, reaper

Kept for traust until its PENDING decisions (sweep stages, portfolio graph
layers, metrics journal) retire or port them:
engine — the ``HarnessEngine`` facade (metrics, models, adapters, sweep, portfolio)
layers) retire or port them:
engine — the ``HarnessEngine`` facade (adapters, sweep, portfolio)
sweep — class-generalization scan engine
portfolio — source-code dependency graph analysis
metrics — hash-chained metrics recording + spend tracking
registry — model resolution and spend pricing
adapters — opengrep (sweep stages) and checkov (portfolio graph)
corpus — population resolver the sweep stages read
"""
Expand Down
2 changes: 1 addition & 1 deletion src/traust_engine/_ops_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
needs. The resolution logic itself lives in :mod:`traust_engine.locations`; this
just binds it to ``self._ctx.locations`` so no namespace re-derives it.

PENDING(decision: sweep stages | portfolio graph layers | metrics journal) — kept for traust;
PENDING(decision: sweep stages | portfolio graph layers) — kept for traust;
deleted when traust retires or ports it.
"""

Expand Down
2 changes: 1 addition & 1 deletion src/traust_engine/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
arithmetic or a repo-layout assumption — the latter breaks the moment the
package is installed as a wheel (the original HARNESS_ROOT bug).

PENDING(decision: sweep stages | metrics journal) — kept for traust;
PENDING(decision: sweep stages) — kept for traust;
deleted when traust retires or ports it.
"""

Expand Down
19 changes: 4 additions & 15 deletions src/traust_engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
from traust_engine import HarnessEngine

h = HarnessEngine(ctx) # explicit context (tests, app)
h.metrics.append("census", {"repos": 812})
ok, issues = h.metrics.verify()
h.sweep.collect(...)

Namespaces mirror the engine's submodules: `.metrics`, `.models`, `.adapters` (the rule-lane
stage's opengrep config), `.sweep`, `.portfolio`.
Namespaces mirror the engine's submodules: `.adapters` (the rule-lane stage's opengrep
config), `.sweep`, `.portfolio`.

PENDING(decision: sweep stages | portfolio graph layers | metrics journal) — kept for traust;
PENDING(decision: sweep stages | portfolio graph layers) — kept for traust;
deleted when traust retires or ports it.
"""

Expand All @@ -26,9 +25,7 @@
from traust_contracts import HarnessContext, load_context

from traust_engine.adapters.ops import AdaptersOps
from traust_engine.metrics.ops import MetricsOps
from traust_engine.portfolio.ops import PortfolioOps
from traust_engine.registry.ops import ModelsOps
from traust_engine.sweep.ops import SweepOps


Expand All @@ -45,14 +42,6 @@ def load(cls, *, config_home: Path | None = None) -> HarnessEngine:
def ctx(self) -> HarnessContext:
return self._ctx

@cached_property
def metrics(self) -> MetricsOps:
return MetricsOps(self._ctx)

@cached_property
def models(self) -> ModelsOps:
return ModelsOps(self._ctx)

@cached_property
def adapters(self) -> AdaptersOps:
return AdaptersOps(self._ctx)
Expand Down
10 changes: 1 addition & 9 deletions src/traust_engine/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
below the ops layer. The resolution logic lives here, once; ops pass ``self._loc``
and never re-derive it.

PENDING(decision: sweep stages | portfolio graph layers | metrics journal) — kept for traust;
PENDING(decision: sweep stages | portfolio graph layers) — kept for traust;
deleted when traust retires or ports it.
"""

Expand Down Expand Up @@ -141,8 +141,6 @@ def sarif_tool_uri(loc: Locations | None) -> str | None:
PHASE0_REL = SCAN_TESTING_REL / "phase-0"
SWEEPS_REL = SCAN_TESTING_REL / "sweeps"
VALIDATION_BENCHMARK_REL = SCAN_TESTING_REL / "validation-benchmark"
#: The metrics-history journal lives under the configured metrics root, not results.
METRICS_HISTORY_REL = Path("metrics") / "metrics-history.jsonl"
#: Sweep-engine and regression-rule draft staging under the metrics root.
RULE_DRAFTS_REL = Path("metrics") / "rule-mining" / "rule-drafts"

Expand Down Expand Up @@ -197,9 +195,3 @@ def scan_testing_dir(loc: Locations | None) -> Path | None:
def benchmark_dir(loc: Locations | None) -> Path | None:
"""``<analysis-results>/scan-testing/validation-benchmark``, or None."""
return _under_results(VALIDATION_BENCHMARK_REL, loc)


def metrics_history(loc: Locations | None) -> Path | None:
"""``<metrics-root>/metrics/metrics-history.jsonl``, or None."""
pt = progress_tracker_dir(loc)
return pt / METRICS_HISTORY_REL if pt else None
5 changes: 0 additions & 5 deletions src/traust_engine/metrics/__init__.py

This file was deleted.

Loading
Loading