Skip to content

Commit 2c3ce7f

Browse files
committed
feat: close remaining system-validation work items
1 parent fa7ea23 commit 2c3ce7f

22 files changed

Lines changed: 1978 additions & 406 deletions

AGENTS.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ bd close <id> # Complete work
1212
bd sync # Sync with git
1313
```
1414

15+
## Governance Runtime
16+
17+
Use the repo-local `dp` wrapper so governance gates are reproducible on a clean machine.
18+
19+
```bash
20+
./scripts/dp review --json
21+
./scripts/dp verify --json
22+
./scripts/dp enforce pre-commit --policy dp-policy.json --json
23+
./scripts/dp enforce pre-push --policy dp-policy.json --json
24+
```
25+
26+
`dp-policy.json` is the canonical policy source. `make check` is available at repo root.
27+
1528
## Landing the Plane (Session Completion)
1629

1730
**When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.
@@ -37,4 +50,3 @@ bd sync # Sync with git
3750
- NEVER stop before pushing - that leaves work stranded locally
3851
- NEVER say "ready to push when you are" - YOU must push
3952
- If push fails, resolve and retry until it succeeds
40-

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
SHELL := /bin/bash
2+
3+
.PHONY: check lint typecheck test review verify
4+
5+
check: typecheck test
6+
7+
lint:
8+
cd rlm-core && cargo fmt --check
9+
10+
typecheck:
11+
cd rlm-core && cargo check --quiet
12+
13+
test:
14+
cd rlm-core && cargo test --quiet
15+
16+
review: typecheck
17+
18+
verify: check

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ cd ../go/rlmcore
8282
go test ./...
8383
```
8484

85+
### Governance Gates
86+
87+
Run repository governance checks with the local `dp` runtime wrapper:
88+
89+
```bash
90+
./scripts/dp review --json
91+
./scripts/dp verify --json
92+
./scripts/dp enforce pre-commit --policy dp-policy.json --json
93+
./scripts/dp enforce pre-push --policy dp-policy.json --json
94+
```
95+
96+
`make check` is available at repo root and is the canonical enforcement command in `dp-policy.json`.
97+
8598
### Rust Usage
8699

87100
```rust
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
[VG-DP-ENFORCE-PRE-COMMIT] running
2-
error: Failed to spawn: `dp`
3-
Caused by: No such file or directory (os error 2)
4-
exit_code=2
1+
{
2+
"stage": "pre-commit",
3+
"policy": "/Users/rand/src/loop/dp-policy.json",
4+
"cwd": "/Users/rand/src/loop",
5+
"ok": true,
6+
"steps": [
7+
{
8+
"name": "check",
9+
"command": [
10+
"make",
11+
"check"
12+
],
13+
"exit_code": 0,
14+
"duration_ms": 2737,
15+
"stdout": "cd rlm-core && cargo check --quiet\ncd rlm-core && cargo test --quiet\n\nrunning 634 tests\n....................................................................................... 87/634\n....................................................................................... 174/634\n...........................................................iii......................... 261/634\n....................................................................................... 348/634\n....................................................................................... 435/634\n.............i....i...iiiii............................................................ 522/634\n....................................................................................... 609/634\n.........................\ntest result: ok. 624 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out; finished in 0.55s\n\n\nrunning 40 tests\niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii....\ntest result: ok. 4 passed; 0 failed; 36 ignored; 0 measured; 0 filtered out; finished in 0.98s\n\n",
16+
"stderr": "warning: unused import: `std::path::PathBuf`\n --> src/dp_integration/review.rs:560:9\n |\n560 | use std::path::PathBuf;\n | ^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(unused_imports)]` on by default\n\nwarning: unused imports: `LeanRef`, `LinkSource`, `LinkType`, and `Link`\n --> src/sync/engine.rs:609:24\n |\n609 | use crate::topos::{Link, LinkType, LinkSource, LeanRef, ToposRef};\n | ^^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^\n\nwarning: unused variable: `action_id`\n --> src/reasoning/store.rs:741:14\n |\n741 | let (action_id, outcome_id) = trace.log_action(&chosen, \"Action\", \"Outcome\");\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_action_id`\n |\n = note: `#[warn(unused_variables)]` on by default\n\nwarning: unused variable: `questions`\n --> src/spec_agent/agent.rs:658:13\n |\n658 | let questions = agent.refine(&mut ctx, &[]).await.unwrap();\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_questions`\n\nwarning: function `probability_with_edges` is never used\n --> src/epistemic/proptest.rs:27:8\n |\n27 | fn probability_with_edges() -> impl Strategy<Value = f64> {\n | ^^^^^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(dead_code)]` on by default\n\nwarning: fields `code`, `language`, `max_issues`, `vulnerabilities`, `severity`, and `confidence` are never read\n --> src/signature/mod.rs:684:13\n |\n682 | struct AnalyzeCode {\n | ----------- fields in this struct\n683 | #[input(desc = \"Source code to analyze\")]\n684 | code: String,\n | ^^^^\n...\n687 | language: String,\n | ^^^^^^^^\n...\n690 | max_issues: Option<u32>,\n | ^^^^^^^^^^\n...\n693 | vulnerabilities: Vec<String>,\n | ^^^^^^^^^^^^^^^\n...\n696 | severity: String,\n | ^^^^^^^^\n...\n699 | confidence: f64,\n | ^^^^^^^^^^\n\nwarning: multiple fields are never read\n --> src/signature/mod.rs:793:13\n |\n791 | struct AllTypes {\n | -------- fields in this struct\n792 | #[input(desc = \"A string\")]\n793 | string_field: String,\n | ^^^^^^^^^^^^\n...\n796 | int_field: i32,\n | ^^^^^^^^^\n...\n799 | float_field: f64,\n | ^^^^^^^^^^^\n...\n802 | bool_field: bool,\n | ^^^^^^^^^^\n...\n805 | list_field: Vec<String>,\n | ^^^^^^^^^^\n...\n808 | optional_list_field: Option<Vec<i32>>,\n | ^^^^^^^^^^^^^^^^^^^\n...\n811 | array_field: [i32; 2],\n | ^^^^^^^^^^^\n...\n814 | output: String,\n | ^^^^^^\n\nwarning: fields `severity` and `category` are never read\n --> src/signature/mod.rs:835:13\n |\n832 | struct EnumAnnotated {\n | ------------- fields in this struct\n...\n835 | severity: String,\n | ^^^^^^^^\n...\n839 | category: String,\n | ^^^^^^^^\n\n",
17+
"ok": true
18+
}
19+
]
20+
}
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
[VG-DP-ENFORCE-PRE-PUSH] running
2-
error: Failed to spawn: `dp`
3-
Caused by: No such file or directory (os error 2)
4-
exit_code=2
1+
{
2+
"stage": "pre-push",
3+
"policy": "/Users/rand/src/loop/dp-policy.json",
4+
"cwd": "/Users/rand/src/loop",
5+
"ok": true,
6+
"steps": [
7+
{
8+
"name": "check",
9+
"command": [
10+
"make",
11+
"check"
12+
],
13+
"exit_code": 0,
14+
"duration_ms": 2718,
15+
"stdout": "cd rlm-core && cargo check --quiet\ncd rlm-core && cargo test --quiet\n\nrunning 634 tests\n....................................................................................... 87/634\n....................................................................................... 174/634\n...........................................................iii......................... 261/634\n....................................................................................... 348/634\n....................................................................................... 435/634\n..............i....i..iiiii............................................................ 522/634\n....................................................................................... 609/634\n.........................\ntest result: ok. 624 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out; finished in 0.54s\n\n\nrunning 40 tests\niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii....\ntest result: ok. 4 passed; 0 failed; 36 ignored; 0 measured; 0 filtered out; finished in 0.97s\n\n",
16+
"stderr": "warning: unused import: `std::path::PathBuf`\n --> src/dp_integration/review.rs:560:9\n |\n560 | use std::path::PathBuf;\n | ^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(unused_imports)]` on by default\n\nwarning: unused imports: `LeanRef`, `LinkSource`, `LinkType`, and `Link`\n --> src/sync/engine.rs:609:24\n |\n609 | use crate::topos::{Link, LinkType, LinkSource, LeanRef, ToposRef};\n | ^^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^\n\nwarning: unused variable: `action_id`\n --> src/reasoning/store.rs:741:14\n |\n741 | let (action_id, outcome_id) = trace.log_action(&chosen, \"Action\", \"Outcome\");\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_action_id`\n |\n = note: `#[warn(unused_variables)]` on by default\n\nwarning: unused variable: `questions`\n --> src/spec_agent/agent.rs:658:13\n |\n658 | let questions = agent.refine(&mut ctx, &[]).await.unwrap();\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_questions`\n\nwarning: function `probability_with_edges` is never used\n --> src/epistemic/proptest.rs:27:8\n |\n27 | fn probability_with_edges() -> impl Strategy<Value = f64> {\n | ^^^^^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(dead_code)]` on by default\n\nwarning: fields `code`, `language`, `max_issues`, `vulnerabilities`, `severity`, and `confidence` are never read\n --> src/signature/mod.rs:684:13\n |\n682 | struct AnalyzeCode {\n | ----------- fields in this struct\n683 | #[input(desc = \"Source code to analyze\")]\n684 | code: String,\n | ^^^^\n...\n687 | language: String,\n | ^^^^^^^^\n...\n690 | max_issues: Option<u32>,\n | ^^^^^^^^^^\n...\n693 | vulnerabilities: Vec<String>,\n | ^^^^^^^^^^^^^^^\n...\n696 | severity: String,\n | ^^^^^^^^\n...\n699 | confidence: f64,\n | ^^^^^^^^^^\n\nwarning: multiple fields are never read\n --> src/signature/mod.rs:793:13\n |\n791 | struct AllTypes {\n | -------- fields in this struct\n792 | #[input(desc = \"A string\")]\n793 | string_field: String,\n | ^^^^^^^^^^^^\n...\n796 | int_field: i32,\n | ^^^^^^^^^\n...\n799 | float_field: f64,\n | ^^^^^^^^^^^\n...\n802 | bool_field: bool,\n | ^^^^^^^^^^\n...\n805 | list_field: Vec<String>,\n | ^^^^^^^^^^\n...\n808 | optional_list_field: Option<Vec<i32>>,\n | ^^^^^^^^^^^^^^^^^^^\n...\n811 | array_field: [i32; 2],\n | ^^^^^^^^^^^\n...\n814 | output: String,\n | ^^^^^^\n\nwarning: fields `severity` and `category` are never read\n --> src/signature/mod.rs:835:13\n |\n832 | struct EnumAnnotated {\n | ------------- fields in this struct\n...\n835 | severity: String,\n | ^^^^^^^^\n...\n839 | category: String,\n | ^^^^^^^^\n\n",
17+
"ok": true
18+
}
19+
]
20+
}
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
[VG-DP-REVIEW] running
2-
error: Failed to spawn: `dp`
3-
Caused by: No such file or directory (os error 2)
4-
exit_code=2
1+
{
2+
"stage": "review",
3+
"policy": "/Users/rand/src/loop/dp-policy.json",
4+
"cwd": "/Users/rand/src/loop",
5+
"ok": true,
6+
"steps": [
7+
{
8+
"name": "typecheck",
9+
"command": [
10+
"make",
11+
"typecheck"
12+
],
13+
"exit_code": 0,
14+
"duration_ms": 146,
15+
"stdout": "cd rlm-core && cargo check --quiet\n",
16+
"stderr": "",
17+
"ok": true
18+
}
19+
]
20+
}
Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
[VG-DP-VERIFY] running
2-
error: Failed to spawn: `dp`
3-
Caused by: No such file or directory (os error 2)
4-
exit_code=2
1+
{
2+
"stage": "verify",
3+
"policy": "/Users/rand/src/loop/dp-policy.json",
4+
"cwd": "/Users/rand/src/loop",
5+
"ok": true,
6+
"steps": [
7+
{
8+
"name": "check",
9+
"command": [
10+
"make",
11+
"check"
12+
],
13+
"exit_code": 0,
14+
"duration_ms": 2763,
15+
"stdout": "cd rlm-core && cargo check --quiet\ncd rlm-core && cargo test --quiet\n\nrunning 634 tests\n....................................................................................... 87/634\n....................................................................................... 174/634\n.........................................................iii........................... 261/634\n....................................................................................... 348/634\n....................................................................................... 435/634\n..............i....i.iiiii............................................................. 522/634\n....................................................................................... 609/634\n.........................\ntest result: ok. 624 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out; finished in 0.55s\n\n\nrunning 40 tests\niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii....\ntest result: ok. 4 passed; 0 failed; 36 ignored; 0 measured; 0 filtered out; finished in 1.02s\n\n",
16+
"stderr": "warning: unused import: `std::path::PathBuf`\n --> src/dp_integration/review.rs:560:9\n |\n560 | use std::path::PathBuf;\n | ^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(unused_imports)]` on by default\n\nwarning: unused imports: `LeanRef`, `LinkSource`, `LinkType`, and `Link`\n --> src/sync/engine.rs:609:24\n |\n609 | use crate::topos::{Link, LinkType, LinkSource, LeanRef, ToposRef};\n | ^^^^ ^^^^^^^^ ^^^^^^^^^^ ^^^^^^^\n\nwarning: unused variable: `action_id`\n --> src/reasoning/store.rs:741:14\n |\n741 | let (action_id, outcome_id) = trace.log_action(&chosen, \"Action\", \"Outcome\");\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_action_id`\n |\n = note: `#[warn(unused_variables)]` on by default\n\nwarning: unused variable: `questions`\n --> src/spec_agent/agent.rs:658:13\n |\n658 | let questions = agent.refine(&mut ctx, &[]).await.unwrap();\n | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_questions`\n\nwarning: function `probability_with_edges` is never used\n --> src/epistemic/proptest.rs:27:8\n |\n27 | fn probability_with_edges() -> impl Strategy<Value = f64> {\n | ^^^^^^^^^^^^^^^^^^^^^^\n |\n = note: `#[warn(dead_code)]` on by default\n\nwarning: fields `code`, `language`, `max_issues`, `vulnerabilities`, `severity`, and `confidence` are never read\n --> src/signature/mod.rs:684:13\n |\n682 | struct AnalyzeCode {\n | ----------- fields in this struct\n683 | #[input(desc = \"Source code to analyze\")]\n684 | code: String,\n | ^^^^\n...\n687 | language: String,\n | ^^^^^^^^\n...\n690 | max_issues: Option<u32>,\n | ^^^^^^^^^^\n...\n693 | vulnerabilities: Vec<String>,\n | ^^^^^^^^^^^^^^^\n...\n696 | severity: String,\n | ^^^^^^^^\n...\n699 | confidence: f64,\n | ^^^^^^^^^^\n\nwarning: multiple fields are never read\n --> src/signature/mod.rs:793:13\n |\n791 | struct AllTypes {\n | -------- fields in this struct\n792 | #[input(desc = \"A string\")]\n793 | string_field: String,\n | ^^^^^^^^^^^^\n...\n796 | int_field: i32,\n | ^^^^^^^^^\n...\n799 | float_field: f64,\n | ^^^^^^^^^^^\n...\n802 | bool_field: bool,\n | ^^^^^^^^^^\n...\n805 | list_field: Vec<String>,\n | ^^^^^^^^^^\n...\n808 | optional_list_field: Option<Vec<i32>>,\n | ^^^^^^^^^^^^^^^^^^^\n...\n811 | array_field: [i32; 2],\n | ^^^^^^^^^^^\n...\n814 | output: String,\n | ^^^^^^\n\nwarning: fields `severity` and `category` are never read\n --> src/signature/mod.rs:835:13\n |\n832 | struct EnumAnnotated {\n | ------------- fields in this struct\n...\n835 | severity: String,\n | ^^^^^^^^\n...\n839 | category: String,\n | ^^^^^^^^\n\n",
17+
"ok": true
18+
}
19+
]
20+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# VG-GRAPH-MEMORY-001
2+
Date: 2026-02-20
3+
Issues: `loop-vu7`, `loop-y27`
4+
5+
## Scope
6+
Optimize graph-analysis hot paths in drift detection by reducing repeated symbol allocation/hashing and batching short-lived analysis allocations.
7+
8+
## Target Module
9+
- `/Users/rand/src/loop/rlm-core/src/sync/drift.rs`
10+
11+
## Implemented
12+
1. Added internal `StringInterner` (`SymbolId`) for repeated symbol names used in:
13+
- `detect_concept_drift`
14+
- `detect_behavior_drift`
15+
2. Added internal typed arena (`TypedArena<T>`) and migrated temporary analysis-node allocation to arena-backed storage.
16+
3. Switched concept/structure/theorem/link lookups from repeated string-key matching to symbol-keyed lookups.
17+
4. Kept all changes internal to sync drift analysis (no public API changes).
18+
19+
## Migration Notes
20+
1. This is an internal implementation detail only; no serialization schema or external contract changes.
21+
2. Existing drift outputs and suggestions are preserved semantically.
22+
3. Allocation model changed for temporary analysis nodes only (single vector-backed arena per pass).
23+
24+
## Correctness Validation
25+
- `cargo test --offline sync::drift:: -- --nocapture` passed.
26+
- Added unit and property-based tests:
27+
- `test_string_interner_reuses_ids`
28+
- `prop_string_interner_idempotent`
29+
- `prop_behavior_drift_is_order_invariant`
30+
31+
## Success Metrics and Benchmark/Profiling Plan
32+
1. Metric: total allocations in drift detection passes.
33+
- Method: compare baseline vs candidate with allocation profiling (`heaptrack`/`Instruments`) on synthetic large specs (10k+ symbols).
34+
2. Metric: peak RSS during `detect_all`.
35+
- Method: capture RSS over repeated runs using `/bin/ps` sampling.
36+
3. Metric: wall-clock latency of `detect_all`.
37+
- Method: run N>=30 iterations on fixed fixture and report p50/p95.
38+

0 commit comments

Comments
 (0)