diff --git a/.github/workflows/hourly-commercialization-loop.yml b/.github/workflows/hourly-commercialization-loop.yml index c6ae731..663451d 100644 --- a/.github/workflows/hourly-commercialization-loop.yml +++ b/.github/workflows/hourly-commercialization-loop.yml @@ -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. @@ -606,17 +611,15 @@ jobs: ".gitmodules", "AGENTS.md", "CODEOWNERS", + "pyproject.toml", "SECURITY.md", } - forbidden_prefixes = (".github/", ".git/") + forbidden_prefixes = (".github/", ".git/", "crates/") allowed_exact = { "CHANGELOG.md", "README.md", - "pyproject.toml", } allowed_prefixes = ( - "crates/rankweave-core/src/", - "crates/rankweave-python/src/", "src/rankweave/", "tests/", "docs/", @@ -625,8 +628,6 @@ jobs: ".json", ".md", ".py", - ".rs", - ".toml", ".txt", ".yaml", ".yml", @@ -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): @@ -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") diff --git a/crates/rankweave-core/examples/profile_accelerate_batch.rs b/crates/rankweave-core/examples/profile_accelerate_batch.rs index abda208..d953866 100644 --- a/crates/rankweave-core/examples/profile_accelerate_batch.rs +++ b/crates/rankweave-core/examples/profile_accelerate_batch.rs @@ -246,7 +246,7 @@ mod macos { let mean = elapsed.iter().sum::() / 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] ); } diff --git a/docs/adr/0008-persistent-exact-semantic-index.md b/docs/adr/0008-persistent-exact-semantic-index.md index bd3313f..93be818 100644 --- a/docs/adr/0008-persistent-exact-semantic-index.md +++ b/docs/adr/0008-persistent-exact-semantic-index.md @@ -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 diff --git a/docs/operations/hourly-commercialization-loop.md b/docs/operations/hourly-commercialization-loop.md index 90ca486..01c10fa 100644 --- a/docs/operations/hourly-commercialization-loop.md +++ b/docs/operations/hourly-commercialization-loop.md @@ -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: @@ -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: diff --git a/docs/superpowers/specs/2026-08-04-nim-commercialization-loop-design.md b/docs/superpowers/specs/2026-08-04-nim-commercialization-loop-design.md index 241e500..b0550df 100644 --- a/docs/superpowers/specs/2026-08-04-nim-commercialization-loop-design.md +++ b/docs/superpowers/specs/2026-08-04-nim-commercialization-loop-design.md @@ -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 diff --git a/src/rankweave/_rankweave_core.pyi b/src/rankweave/_rankweave_core.pyi index 9106a53..a1e1b20 100644 --- a/src/rankweave/_rankweave_core.pyi +++ b/src/rankweave/_rankweave_core.pyi @@ -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]], + ] + ]: ... diff --git a/tests/test_hourly_commercialization_workflow.py b/tests/test_hourly_commercialization_workflow.py index bec21f5..b81f77d 100644 --- a/tests/test_hourly_commercialization_workflow.py +++ b/tests/test_hourly_commercialization_workflow.py @@ -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(): diff --git a/tests/test_semantic_index.py b/tests/test_semantic_index.py index d74e40a..1952ad1 100644 --- a/tests/test_semantic_index.py +++ b/tests/test_semantic_index.py @@ -1,4 +1,6 @@ +import ast import struct +from pathlib import Path import pytest @@ -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