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
24 changes: 9 additions & 15 deletions .github/workflows/hourly-commercialization-loop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ jobs:
statistical or standards claim without a primary source already recorded in
the repository. Figma is not applicable because RankWeave has no UI.

This autonomous lane is Python-only. Do not edit Rust source, Cargo
manifests, build configuration, or Python build metadata. A Rust-core
increment requires a separately authored and reviewed maintainer pull
request.

Do not commit, push, open, approve, merge, publish, or release anything;
the workflow performs deterministic validation and packages one protected
pull request with maintainer-owned metadata.
Expand Down Expand Up @@ -606,17 +611,15 @@ jobs:
".gitmodules",
"AGENTS.md",
"CODEOWNERS",
"pyproject.toml",
"SECURITY.md",
}
forbidden_prefixes = (".github/", ".git/")
forbidden_prefixes = (".github/", ".git/", "crates/")
Comment on lines +614 to +617

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Python-only boundary remains deterministic

OpenCode can edit broadly, but the pre-execution gate rejects crates/ and pyproject.toml. Validation uses the restored trusted native extension.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

allowed_exact = {
"CHANGELOG.md",
"README.md",
"pyproject.toml",
}
allowed_prefixes = (
"crates/rankweave-core/src/",
"crates/rankweave-python/src/",
"src/rankweave/",
"tests/",
"docs/",
Expand All @@ -625,8 +628,6 @@ jobs:
".json",
".md",
".py",
".rs",
".toml",
".txt",
".yaml",
".yml",
Expand All @@ -651,14 +652,7 @@ jobs:
raise SystemExit(f"path is outside autonomous scope: {path_text}")
if path.suffix not in allowed_suffixes:
raise SystemExit(f"non-text or unsupported path changed: {path_text}")
if (
path_text.startswith("src/rankweave/") and path.suffix == ".py"
) or (
path_text.startswith(
("crates/rankweave-core/src/", "crates/rankweave-python/src/")
)
and path.suffix == ".rs"
):
if path_text.startswith("src/rankweave/") and path.suffix == ".py":
production_changed = True
info = path.lstat()
if stat.S_ISLNK(info.st_mode) or not stat.S_ISREG(info.st_mode):
Expand All @@ -680,7 +674,7 @@ jobs:

if not production_changed:
raise SystemExit(
"buyer-visible increment must change a production Python or Rust module"
"buyer-visible increment must change a production Python module"
)
if not any(path.startswith("tests/") for path in changed):
raise SystemExit("autonomous increment must include regression tests")
Expand Down
2 changes: 1 addition & 1 deletion crates/rankweave-core/examples/profile_accelerate_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ mod macos {
let mean = elapsed.iter().sum::<f64>() / elapsed.len() as f64;
println!(
"shape={CANDIDATES}x{DIMENSION}x{QUERIES} min_ms={:.3} mean_ms={mean:.3} p95_ms={:.3} max_ms={:.3} bit_mismatches={mismatched} approximate_top4_mismatches={top_four_mismatches} screened_top4_mismatches={screened_top_four_mismatches} maximum_ambiguity={maximum_ambiguity} max_abs_diff={maximum_absolute_difference:e}",
elapsed[0], elapsed[27], elapsed[29]
elapsed[0], elapsed[28], elapsed[29]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Nearest-rank index matches p95

Thirty sorted samples place nearest-rank p95 at rank 29. The zero-based selection elapsed[28] is correct.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

);
}

Expand Down
5 changes: 4 additions & 1 deletion docs/adr/0008-persistent-exact-semantic-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ and every ambiguous candidate is recomputed in coordinate order before stable
top-k. At 6,578 by 3,072 by four, the complete screened proof measured
3.605-4.762 ms, at most six ambiguous candidates per query, and zero screened
top-four differences from the scalar reference, despite 13,007 bit-different
BLAS dots. Near-tie and all-equal interval tests retain every candidate that
BLAS dots. A corrective 30-sample rerun using nearest-rank p95 (sample 29)
measured 3.573 ms minimum, 4.063 ms mean, 4.604 ms p95, and 5.686 ms maximum,
again with at most six ambiguous candidates and zero screened top-four
differences. Near-tie and all-equal interval tests retain every candidate that
can cross the boundary. This remains a profile, not an activated backend:
production code must additionally fall back for any operand set where the
standard no-underflow error model is not established, pool units to items
Expand Down
17 changes: 12 additions & 5 deletions docs/operations/hourly-commercialization-loop.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,16 @@ the red gate.
### 3. Implementation and deterministic validation

The verified red state is committed locally only so model fallback can return
to a known tree. The implementation phase may edit normal product,
documentation, version, and package files, but it still cannot execute Bash,
use the web, touch external directories, or edit `.github/`, `.git/`, or agent
control files.
to a known tree. The implementation phase may edit normal Python product and
documentation files, but it still cannot execute Bash, use the web, touch
external directories, or edit `.github/`, `.git/`, or agent control files.

This autonomous lane is limited to Python production changes. Rust source,
Cargo manifests, `pyproject.toml`, and the complete `crates/` tree are outside
its diff boundary. That restriction keeps model-authored native code out of
later credentialed builders and makes the trusted base extension the correct
native dependency for final validation. A Rust-core increment requires a
separate maintainer-authored and reviewed pull request.

A deterministic post-agent gate rejects:

Expand All @@ -84,7 +90,8 @@ A deterministic post-agent gate rejects:
- more than 25 changed files;
- any file larger than 256 KiB;
- more than 1 MiB of changed-file content;
- proposals without a production `src/rankweave/*.py` change.
- proposals without a production `src/rankweave/*.py` change;
- Rust, Cargo, or Python build-metadata changes.

The accepted proposal then runs, with no provider or GitHub credential and no
network access:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ and **GitHub mutation** into explicit trust zones.
8. Commit the verified red state locally so model fallback can reset to a known
tree without pushing anything.
9. Run an **implementation phase** with the same no-execution and no-web
permissions. Edits are allowed in normal product and documentation files but
denied under `.github/`, `.git/`, and agent-control files.
permissions. Edits are allowed in Python product and documentation files but
denied under `.github/`, `.git/`, agent-control files, `crates/`, Cargo
manifests, and Python build metadata. Native changes require a separate
maintainer-authored and reviewed pull request.
10. Apply a deterministic diff gate: text files only, no symlinks or submodules,
no protected paths, no rename/copy/conflict state, bounded file count,
bounded individual/aggregate bytes, and at least one production Python
Expand Down
31 changes: 31 additions & 0 deletions src/rankweave/_rankweave_core.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,34 @@ class SemanticUnitIndex:
str,
list[tuple[str, str, float]],
]: ...

def preflight_authorized_packed(
self,
model_identity: str,
packed_authorization: bytes,
) -> tuple[
tuple[str, str, str, str, str, str, int, int],
str,
str,
int,
str,
str,
list[tuple[str, str, float]],
]: ...

def rank_authorized_batch_packed(
self,
model_identity: str,
query_vectors: list[list[float]],
packed_authorization: bytes,
) -> list[
tuple[
tuple[str, str, str, str, str, str, int, int],
str,
str,
int,
str,
str,
list[tuple[str, str, float]],
]
]: ...
Comment on lines +104 to +119

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Collection contracts remain aligned

The native binding returns a list as declared. The public adapter converts it to an immutable tuple, preserving its separate contract.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

11 changes: 7 additions & 4 deletions tests/test_hourly_commercialization_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,22 @@ def test_autonomous_diff_is_text_only_bounded_and_policy_safe():
for protected_path in (
'".gitmodules"',
'"CODEOWNERS"',
'"pyproject.toml"',
'"SECURITY.md"',
'"AGENTS.md"',
'".github/"',
'".git/"',
'"crates/"',
):
assert protected_path in workflow
assert "non-regular file changed" in workflow
assert "NUL byte found" in workflow
assert "non-text or unsupported path changed" in workflow
assert '"crates/rankweave-core/src/"' in workflow
assert '"crates/rankweave-python/src/"' in workflow
assert '".rs"' in workflow
assert "must change a production Python or Rust module" in workflow
assert '"crates/rankweave-core/src/"' not in workflow
assert '"crates/rankweave-python/src/"' not in workflow
assert '".rs"' not in workflow
assert "must change a production Python module" in workflow
assert "This autonomous lane is Python-only" in workflow


def test_ignored_native_core_is_restored_from_trusted_copy_after_each_cleanup():
Expand Down
23 changes: 23 additions & 0 deletions tests/test_semantic_index.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import ast
import struct
from pathlib import Path

import pytest

Expand Down Expand Up @@ -152,3 +154,24 @@ def test_exact_index_fails_closed(
exact_index().rank_authorized(model, query, authorization)
assert str(raised.value).count(code) == 1
assert "exact semantic index rejected input" in str(raised.value)


def test_native_stub_declares_every_packed_scope_operation() -> None:
stub = ast.parse(
(Path(__file__).parents[1] / "src/rankweave/_rankweave_core.pyi").read_text(
encoding="utf-8"
)
)
index_class = next(
node
for node in stub.body
if isinstance(node, ast.ClassDef) and node.name == "SemanticUnitIndex"
)
methods = {
node.name for node in index_class.body if isinstance(node, ast.FunctionDef)
}
assert {
"rank_authorized_packed",
"preflight_authorized_packed",
"rank_authorized_batch_packed",
} <= methods