mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-17 20:19:29 +00:00
chore(index): remove the unused vector index, the ousast index subcommand and the [embeddings] section
Legacy inventory 2, item R1. The vector half of index.py (VectorIndex, VectorRecord, RetrievalHit, RetrievalPackage, the EmbeddingClient protocol, index_reuse_key, build/write/read/query_vector_index, build_retrieval_package and their helpers) had no importer in src; `ousast index` wrote index/chunks.json that nothing read, and was the only reader of `[embeddings]`. index.py keeps CodeChunk and chunk_text_namespace, which skills.py imports; chunk_file/build_code_chunks go with their only caller. `[embeddings] model` and `[embeddings] store` join RETIRED_KEYS (RetiredConfigError naming the reason), the same way the [variants] keys were retired; OPENROUTER_EMBEDDING_MODEL is no longer read, so the README and .env.example drop it (`ousast learn memory embed --model` names the model). test_index.py now tests the chunker only; test_config.py covers the two retired keys and no longer asserts the removed field. The module audit record is regenerated (counts unchanged: 151 modules, 0 orphaned; the index module's importer list shrinks to skills). RELEASE_NOTES Unreleased carries the line. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmM1j46qgKMh3zqD1QMwEo
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
69b5e0efcc
commit
e1db7e1920
@@ -43,7 +43,6 @@ from .gate import FALSE_POSITIVE_CEILING, RECALL_FLOOR
|
||||
from .harness import HarnessRuntime, HarnessTraceWriter, write_harness_config
|
||||
from .hunter import run_hunter_pool, write_hunter_trajectories
|
||||
from .improve import RoundOutcome, run_improvement
|
||||
from .index import build_code_chunks
|
||||
from .learn.cli import add_commands as add_learn_commands
|
||||
from .learn.cli import run as run_learn
|
||||
from .mapping import analyze_entry_points, attach_reachability_hints, ingest_sarif, write_entry_points, write_static_hints
|
||||
@@ -173,11 +172,6 @@ def _main(argv: list[str] | None) -> int:
|
||||
scan.add_argument("--config", type=Path, default=Path("openultrasast.toml"))
|
||||
scan.add_argument("--fail-on", choices=("never", "findings", "verified", "worth-fixing"), default="never")
|
||||
|
||||
index = subparsers.add_parser("index", help="chunk a local repository for embedding index construction")
|
||||
index.add_argument("path", type=Path)
|
||||
index.add_argument("--config", type=Path, default=Path("openultrasast.toml"))
|
||||
index.add_argument("--chunk-lines", type=int, default=80)
|
||||
|
||||
benchmark = subparsers.add_parser("benchmark", help="run a benchmark manifest and write scoreboard artifacts")
|
||||
benchmark.add_argument("manifest", type=Path)
|
||||
benchmark.add_argument("--mode", choices=("quick", "standard", "deep"), default="quick")
|
||||
@@ -426,8 +420,6 @@ def _main(argv: list[str] | None) -> int:
|
||||
return delivery.exit_code
|
||||
if args.command == "scan":
|
||||
return _scan(args.path, args.config, args.mode, args.fail_on)
|
||||
if args.command == "index":
|
||||
return _index(args.path, args.config, args.chunk_lines)
|
||||
if args.command == "benchmark":
|
||||
return _benchmark(args.manifest, args.config, args.mode)
|
||||
if args.command == "improve":
|
||||
@@ -1564,30 +1556,5 @@ def _model_candidates(args: argparse.Namespace) -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _index(path: Path, config_path: Path, chunk_lines: int) -> int:
|
||||
if not path.exists() or not path.is_dir():
|
||||
raise SystemExit(f"index path is not a directory: {path}")
|
||||
config = load_config(config_path if config_path.exists() else None)
|
||||
run = create_scan_run(path, config)
|
||||
snapshot, targets = preprocess_repository(run.target, run.root / "preprocess" / "file_targets.json")
|
||||
chunks = build_code_chunks(run.target, targets, max_lines=chunk_lines)
|
||||
payload = {
|
||||
"store": config.embeddings.store or "json-local",
|
||||
"embedding_model": config.embeddings.model,
|
||||
"repo_root": snapshot.root,
|
||||
"repo_commit": snapshot.commit,
|
||||
"chunk_count": len(chunks),
|
||||
"chunks": [chunk.__dict__ for chunk in chunks],
|
||||
}
|
||||
path_out = run.root / "index" / "chunks.json"
|
||||
path_out.parent.mkdir(parents=True, exist_ok=True)
|
||||
path_out.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
||||
print(f"scan_id={run.scan_id}")
|
||||
print(f"run_dir={run.root}")
|
||||
print(f"chunks={len(chunks)}")
|
||||
print(f"index_artifact={path_out}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user