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
17 changes: 10 additions & 7 deletions .cortexkit/WORKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@ A check that prints nothing and exits 0 is not a pass unless this guide says tha

## Rust (`crates/aft`, package `agent-file-tools`)

Integration suites require `--features test-hooks` explicitly. Lib-only tests do
not need it; production and release builds must never enable it.

| Gate | Command | Proof it ran |
|---|---|---|
| Format | `cargo fmt --all -- --check` | Silent on success. Show `cargo fmt --version` and exit 0. |
| Windows compile | `RUSTFLAGS="-D warnings -A deprecated" cargo check -p agent-file-tools --tests --target x86_64-pc-windows-gnu` | `Finished` line. Compile-only: it cannot catch Windows runtime failures. |
| Windows compile | `RUSTFLAGS="-D warnings -A deprecated" cargo check -p agent-file-tools --tests --target x86_64-pc-windows-gnu --features test-hooks` | `Finished` line. Compile-only: it cannot catch Windows runtime failures. |
| Unit (lib) | `cargo test -p agent-file-tools --lib -- <filter>` | `test result: ok. N passed` with N > 0. A filter that matches nothing reports `0 passed`, which is not a pass. |
| Binary tests | `cargo test -p agent-file-tools --bin aft -- <filter>` | Same as above. Shared infrastructure (locks, leases, capability gates, path identity) breaks fixtures here too. |
| Integration | `cargo test -p agent-file-tools --test integration -- <filter>` | Same as above. |
| Integration | `cargo test --features test-hooks -p agent-file-tools --test integration -- <filter>` | Same as above. |
| Windows native tests | `bash scripts/windows-gate.sh --filter <filter>` or `cargo test -p agent-file-tools --lib -- <filter>` | Run with `runon: "windows"`. The Windows job snapshots tracked and untracked files, but not ignored files. A gate filter that runs zero tests fails. |
| Other test targets | `--test engine`, `--test list_envelope`, `--test rest`, `--test semantic`, `--test alert`, `--test watcher_integration` | Same as above. |
| Other test targets | `--test engine`, `--test list_envelope`, `--test rest`, `--test semantic`, `--test alert`, `--test watcher_integration`, with `--features test-hooks` | Same as above. |
| Real rust-analyzer | prefix with `AFT_TEST_REQUIRE_RUST_ANALYZER=1` | Without it, real-server tests skip silently. |
| Full suite | `cargo test -p agent-file-tools`, or `scripts/rust-test-gate.sh` | The gate prints `GATE PASSED` / `GATE FAILED` as its last line. |
| Full suite | `cargo test --features test-hooks -p agent-file-tools`, or `scripts/rust-test-gate.sh` | The gate prints `GATE PASSED` / `GATE FAILED` as its last line. |

### Build server jobs (`runon`)

Expand All @@ -27,10 +30,10 @@ A check that prints nothing and exits 0 is not a pass unless this guide says tha
- **Build a scratch copy of the source with its own target folder.** Linux jobs share the checkout's warm build folder (`CARGO_TARGET_DIR=/run/motor/target`). A copy built there, for example a red-first proof under `$TMPDIR`, leaves its outputs where later jobs in the real checkout reuse them as current, so a gate can pass on old code. Give the copy `CARGO_TARGET_DIR=$TMPDIR/copy-target` or `--target-dir`. If it already happened, `cargo clean -p <crates>` repairs it.

Mandatory when you touch them:
- A list-cutting site (`.take(`, `truncate(`, a cap): register it, then run `cargo test -p agent-file-tools --test list_envelope`.
- A new file under the search engine: register its owner, then run `cargo test -p agent-file-tools --test engine`.
- A list-cutting site (`.take(`, `truncate(`, a cap): register it, then run `cargo test --features test-hooks -p agent-file-tools --test list_envelope`.
- A new file under the search engine: register its owner, then run `cargo test --features test-hooks -p agent-file-tools --test engine`.
- An agent tool argument: regenerate with `bun run --cwd packages/opencode-plugin build:tool-schemas`. The committed `crates/aft/src/subc_tool_schemas.json` must match byte for byte.
- Config keys or the resolver: run `bun scripts/capture-config-parity.ts` (zero diff), then `cargo test -p agent-file-tools --test integration config_parity`.
- Config keys or the resolver: run `bun scripts/capture-config-parity.ts` (zero diff), then `cargo test --features test-hooks -p agent-file-tools --test integration config_parity`.
- Search ranking or routing files (the `RANKING_FENCE_PREFIXES` in `benchmarks/aft-search/search_quality_lib.py`): say so in your report. The train needs a search-quality descriptor, and ranking changes need benchmark evidence.

## TypeScript (`packages/*`)
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/storm-suite/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ runs:
steps:
- name: Build calibrated storm harness with compiler timings
shell: bash
run: cargo test --profile ci-storm --locked -p agent-file-tools --test integration --no-run --timings
run: cargo test --features test-hooks --profile ci-storm --locked -p agent-file-tools --test integration --no-run --timings

- name: Require every calibrated storm case
shell: bash
run: |
cargo nextest list --profile default --cargo-profile ci-storm --locked -p agent-file-tools --test integration -E 'test(subc_storm)' -T json > target/storm-inventory.json
cargo nextest list --features test-hooks --profile default --cargo-profile ci-storm --locked -p agent-file-tools --test integration -E 'test(subc_storm)' -T json > target/storm-inventory.json
python3 scripts/ci-storm-inventory.py --check-inventory target/storm-inventory.json

- name: Run all calibrated storm tests
shell: bash
run: cargo nextest run --no-fail-fast --profile default --cargo-profile ci-storm --locked -p agent-file-tools --test integration -E 'test(subc_storm)'
run: cargo nextest run --no-fail-fast --features test-hooks --profile default --cargo-profile ci-storm --locked -p agent-file-tools --test integration -E 'test(subc_storm)'

- name: Retain storm compiler timings and inventory
if: always()
Expand Down
65 changes: 38 additions & 27 deletions .github/workflows/_unit-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- uses: ./.github/actions/setup-nextest

- name: Build nextest archive (Linux Rust suite)
run: cargo nextest archive --workspace -E '(kind(lib) | kind(bin) | kind(test)) - binary(=watcher_integration)' --archive-file "$LINUX_NEXTEST_ARCHIVE"
run: cargo nextest archive --features test-hooks --workspace -E '(kind(lib) | kind(bin) | kind(test)) - binary(=watcher_integration)' --archive-file "$LINUX_NEXTEST_ARCHIVE"
env:
LINUX_NEXTEST_ARCHIVE: ${{ runner.temp }}/linux-nextest.tar.zst

Expand Down Expand Up @@ -468,17 +468,17 @@ jobs:
run: cargo build -p agent-file-tools --bin aft
- name: Run worker broker host policy and rendered socket rule regressions
run: |
cargo test -p agent-file-tools --lib -- gh_shim --test-threads=1
binary_listing="$(cargo test -p agent-file-tools --bin aft -- --list)"
cargo test -p agent-file-tools --features test-hooks --lib -- gh_shim --test-threads=1
binary_listing="$(cargo test -p agent-file-tools --features test-hooks --bin aft -- --list)"
[[ "$binary_listing" == *"gh_shim_broker_seatbelt_root_uses_the_shared_namespace_definition: test"* ]]
cargo test -p agent-file-tools --bin aft -- gh_shim_broker_seatbelt_root_uses_the_shared_namespace_definition --test-threads=1
cargo test -p agent-file-tools --features test-hooks --bin aft -- gh_shim_broker_seatbelt_root_uses_the_shared_namespace_definition --test-threads=1
- name: Require worker-read test inventory and run the native gate
shell: bash
run: |
set -euo pipefail
unset AFT_TEST_AFT_BINARY NEXTEST_BIN_EXE_aft CARGO_BIN_EXE_aft
cargo --version
listing="$(cargo test -p agent-file-tools --test worker_jail -- --list)"
listing="$(cargo test --features test-hooks -p agent-file-tools --test worker_jail -- --list)"
printf '%s\n' "$listing"
for test in \
gh_shim_router_host_read_uses_served_catalog_arguments \
Expand All @@ -498,16 +498,16 @@ jobs:
worker_jail_temp_denies_other_task_directory; do
[[ "$listing" == *"$test: test"* ]] || { printf 'missing native test: %s\n' "$test" >&2; exit 1; }
done
cargo test -p agent-file-tools --test worker_jail -- gh_shim_router_host --test-threads=1 --nocapture
cargo test -p agent-file-tools --test worker_jail -- worker_gh_read --test-threads=1 --nocapture
cargo test -p agent-file-tools --test worker_jail -- worker_jail_temp_denies_other_task_directory --exact --test-threads=1 --nocapture
probe_listing="$(cargo test -p agent-file-tools --test sandbox_launch_probe -- --list)"
cargo test --features test-hooks -p agent-file-tools --test worker_jail -- gh_shim_router_host --test-threads=1 --nocapture
cargo test --features test-hooks -p agent-file-tools --test worker_jail -- worker_gh_read --test-threads=1 --nocapture
cargo test --features test-hooks -p agent-file-tools --test worker_jail -- worker_jail_temp_denies_other_task_directory --exact --test-threads=1 --nocapture
probe_listing="$(cargo test --features test-hooks -p agent-file-tools --test sandbox_launch_probe -- --list)"
[[ "$probe_listing" == *"launcher_closes_late_inherited_listener_above_marker_slots: test"* ]]
[[ "$probe_listing" == *"launcher_fd_probe_required_mode_cannot_silently_skip: test"* ]]
[[ "$probe_listing" == *"launcher_failure_marker_cannot_be_forged_by_jailed_exec: test"* ]]
cargo test -p agent-file-tools --test sandbox_launch_probe -- launcher_closes_late_inherited_listener_above_marker_slots --exact --test-threads=1 --nocapture
cargo test -p agent-file-tools --test sandbox_launch_probe -- launcher_fd_probe_required_mode_cannot_silently_skip --exact --test-threads=1 --nocapture
cargo test -p agent-file-tools --test sandbox_launch_probe -- launcher_failure_marker_cannot_be_forged_by_jailed_exec --exact --test-threads=1 --nocapture
cargo test --features test-hooks -p agent-file-tools --test sandbox_launch_probe -- launcher_closes_late_inherited_listener_above_marker_slots --exact --test-threads=1 --nocapture
cargo test --features test-hooks -p agent-file-tools --test sandbox_launch_probe -- launcher_fd_probe_required_mode_cannot_silently_skip --exact --test-threads=1 --nocapture
cargo test --features test-hooks -p agent-file-tools --test sandbox_launch_probe -- launcher_failure_marker_cannot_be_forged_by_jailed_exec --exact --test-threads=1 --nocapture

# ---------------------------------------------------------------------------
# Real-kernel Landlock probes. This stays separate from the general unit lane
Expand All @@ -533,7 +533,7 @@ jobs:
run: cargo build -p agent-file-tools --bin aft

- name: Run sandbox launch probes
run: cargo test -p agent-file-tools --test sandbox_launch_probe -- --test-threads=1 --nocapture
run: cargo test --features test-hooks -p agent-file-tools --test sandbox_launch_probe -- --test-threads=1 --nocapture
env:
AFT_REQUIRE_LANDLOCK: "1"

Expand All @@ -543,7 +543,7 @@ jobs:
set -euo pipefail
cargo --version
test_name="bash_reply_timing_contract_test::subc_promoted_foreground_is_killed_at_its_timeout"
if ! listing="$(cargo test --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --list 2>&1)"; then
if ! listing="$(cargo test --features test-hooks --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --list 2>&1)"; then
printf '%s\n' "$listing" >&2
exit 1
fi
Expand All @@ -552,7 +552,7 @@ jobs:
printf 'expected test missing from integration inventory: %s\n' "$test_name" >&2
exit 1
fi
cargo test --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --exact
cargo test --features test-hooks --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --exact

# ---------------------------------------------------------------------------
# Release-calibrated storm latency on a dedicated free Linux runner. The
Expand Down Expand Up @@ -653,8 +653,12 @@ jobs:
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}

# Library and binaries as shipped (no test hooks), then every target
# with the hooks the test suites need.
- name: Cargo check (locked, MSRV floor)
run: cargo check --workspace --all-targets --locked
run: |
cargo check --workspace --lib --bins --locked
cargo check --workspace --all-targets --features test-hooks --locked

# ---------------------------------------------------------------------------
# Rust + plugin tests on macOS
Expand Down Expand Up @@ -778,7 +782,7 @@ jobs:
started=$SECONDS
trap 'printf "### macOS libtest archive\n\nRunner: macos-26 (%s)\n\nBuild duration: %ss\n" "$RUNNER_NAME" "$((SECONDS - started))" >> "$GITHUB_STEP_SUMMARY"' EXIT
# Native time reports resident-memory and paging counters for the build.
/usr/bin/time -l cargo nextest archive --workspace --lib --test sandbox_launch_probe -E 'kind(lib)' --config "$LIBTEST_CARGO_CONFIG" --timings --archive-file "$MACOS_LIBTEST_ARCHIVE"
/usr/bin/time -l cargo nextest archive --features test-hooks --workspace --lib --test sandbox_launch_probe -E 'kind(lib)' --config "$LIBTEST_CARGO_CONFIG" --timings --archive-file "$MACOS_LIBTEST_ARCHIVE"
env:
MACOS_LIBTEST_ARCHIVE: ${{ runner.temp }}/macos-libtest-nextest.tar.zst

Expand All @@ -793,10 +797,10 @@ jobs:
if-no-files-found: error

- name: Run the serial backtrace probe with local debug objects
run: cargo test -p agent-file-tools --lib panic_hook_preserves_default_backtrace_behavior_and_persists --config "$LIBTEST_CARGO_CONFIG"
run: cargo test -p agent-file-tools --features test-hooks --lib panic_hook_preserves_default_backtrace_behavior_and_persists --config "$LIBTEST_CARGO_CONFIG"

- name: Capture lib source inventory
run: cargo nextest list --workspace --lib --profile gate -T json --cargo-quiet --config "$LIBTEST_CARGO_CONFIG" > "$RUNNER_TEMP/macos-libtest-inventory.json"
run: cargo nextest list --workspace --lib --features test-hooks --profile gate -T json --cargo-quiet --config "$LIBTEST_CARGO_CONFIG" > "$RUNNER_TEMP/macos-libtest-inventory.json"

- name: Report macOS libtest archive size
run: |
Expand Down Expand Up @@ -847,12 +851,12 @@ jobs:
- name: Build nextest archive (macOS bin tests)
# Keep the real CLI alongside the binary test harness without compiling
# the unrelated library harnesses and integration suite.
run: cargo nextest archive --workspace --bins --test sandbox_launch_probe -E 'kind(bin)' --archive-file "$MACOS_BIN_ARCHIVE"
run: cargo nextest archive --features test-hooks --workspace --bins --test sandbox_launch_probe -E 'kind(bin)' --archive-file "$MACOS_BIN_ARCHIVE"
env:
MACOS_BIN_ARCHIVE: ${{ runner.temp }}/macos-bin-nextest.tar.zst

- name: Capture bin source inventory
run: cargo nextest list --workspace --bins --profile gate -T json --cargo-quiet > "$RUNNER_TEMP/macos-bin-inventory.json"
run: cargo nextest list --workspace --bins --features test-hooks --profile gate -T json --cargo-quiet > "$RUNNER_TEMP/macos-bin-inventory.json"

- name: Report macOS bin archive size
run: |
Expand Down Expand Up @@ -1110,7 +1114,7 @@ jobs:
- uses: ./.github/actions/setup-nextest

- name: Capture watcher inventory for the split proof
run: cargo test -p agent-file-tools --features test-timing-hooks --test watcher_integration -- --list > "$RUNNER_TEMP/macos-watcher-inventory.txt" 2>&1
run: cargo test --features test-hooks -p agent-file-tools --features test-timing-hooks --test watcher_integration -- --list > "$RUNNER_TEMP/macos-watcher-inventory.txt" 2>&1
env:
CARGO_TERM_COLOR: never

Expand Down Expand Up @@ -1218,7 +1222,7 @@ jobs:
set -euo pipefail
cargo --version
test_name="bash_reply_timing_contract_test::subc_promoted_foreground_is_killed_at_its_timeout"
if ! listing="$(cargo test --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --list 2>&1)"; then
if ! listing="$(cargo test --features test-hooks --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --list 2>&1)"; then
printf '%s\n' "$listing" >&2
exit 1
fi
Expand All @@ -1227,7 +1231,7 @@ jobs:
printf 'expected test missing from integration inventory: %s\n' "$test_name" >&2
exit 1
fi
cargo test --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --exact
cargo test --features test-hooks --locked -p agent-file-tools --features test-timing-hooks --test integration "$test_name" -- --exact

- name: Fetch pinned subc-core
id: subc_core
Expand Down Expand Up @@ -1288,7 +1292,7 @@ jobs:
- uses: ./.github/actions/setup-nextest

- name: Build nextest archive (Windows Rust suite)
run: cargo nextest archive --workspace -E "(kind(lib) | kind(bin) | kind(test)) - binary(=watcher_integration)" --archive-file "$env:WINDOWS_NEXTEST_ARCHIVE"
run: cargo nextest archive --features test-hooks --workspace -E "(kind(lib) | kind(bin) | kind(test)) - binary(=watcher_integration)" --archive-file "$env:WINDOWS_NEXTEST_ARCHIVE"
shell: pwsh
env:
WINDOWS_NEXTEST_ARCHIVE: ${{ runner.temp }}/windows-nextest.tar.zst
Expand Down Expand Up @@ -1530,14 +1534,21 @@ jobs:
cache-on-failure: true
save-if: ${{ github.ref == 'refs/heads/main' }}

# Library and binaries as shipped (no test hooks), then every target
# with the hooks the test suites need. pwsh doesn't stop on a failing
# native command, so each one checks its own exit code.
- name: Cargo check (deny warnings)
run: cargo check --workspace --all-targets
run: |
cargo check --workspace --lib --bins
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
cargo check --workspace --all-targets --features test-hooks
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
shell: pwsh
env:
RUSTFLAGS: "-D warnings"

- name: Check feature-enabled provider conformance (deny warnings)
run: cargo check -p agent-file-tools --features test-timing-hooks --test rest
run: cargo check -p agent-file-tools --features test-hooks --features test-timing-hooks --test rest
shell: pwsh
env:
RUSTFLAGS: "-D warnings"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cost-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Run original stress volumes
shell: bash
run: >-
cargo test -p agent-file-tools --lib --
cargo test -p agent-file-tools --features test-hooks --lib --
views_incremental_random_sequences_equal_full_rebuild
tool_result_fixtures_release_descriptors
bash_changed_files_flush_native_no_false_complete_during_50k_activity
Expand Down
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ Typo-class fixes do not need an issue. Open the PR; a maintainer applies the
## Before you push

Run `bun run format` and `cargo fmt`. CI rejects unformatted code.

## Rust test hooks

Pass `--features test-hooks` when building or running integration tests, including
`cargo test --features test-hooks -p agent-file-tools`. The integration and rest
harnesses fail at compile time without it rather than silently skipping tests.
Lib-only tests (`cargo test -p agent-file-tools --lib`) do not need the feature.
Never enable `test-hooks` for a production or release build.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"targeted_mechanism": "none",
"kind": "harness",
"slice_class": "non_ranking",
"fixtures": [
"harness-goldens"
]
}
Loading
Loading