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
6 changes: 5 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ index = "sparse+https://pkgs.dev.azure.com/devdiv/_packaging/DeepPrompt/Cargo/in
# BinSkim compliance flags (OneBranch BA2007)
# Required for Windows builds in the ADO sign pipeline.
[target.'cfg(target_os = "windows")']
rustflags = ["-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", "-Clink-args=/DYNAMICBASE /CETCOMPAT"]
rustflags = ["-Ccontrol-flow-guard", "-Ctarget-feature=+crt-static", "-Clink-arg=/DYNAMICBASE"]

# CET shadow stacks are x64-only; the ARM64 linker rejects /CETCOMPAT.
[target.'cfg(all(target_os = "windows", target_arch = "x86_64"))']
rustflags = ["-Clink-arg=/CETCOMPAT"]
15 changes: 14 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,24 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest, windows-latest, windows-11-arm]
runs-on: ${{ matrix.os }}
timeout-minutes: 40
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Verify native Windows ARM64 toolchain
if: matrix.os == 'windows-11-arm'
shell: pwsh
run: |
if ($env:RUNNER_ARCH -ne 'ARM64') {
throw "Expected an ARM64 runner, got $env:RUNNER_ARCH"
}
$version = rustc --version --verbose
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
$version
if ($version -notcontains 'host: aarch64-pc-windows-msvc') {
throw "Expected a native aarch64-pc-windows-msvc Rust toolchain"
}
- name: Test Unix installer
if: runner.os != 'Windows'
run: bash scripts/test-install.sh
Expand Down
11 changes: 8 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ cargo build --release

After the version bump is merged and CI passes, open **Actions > Release >
Run workflow**, select **main**, and enter the tag matching the workspace
version in `Cargo.toml`, for example `v1.2.9`. The equivalent CLI command is:
version in `Cargo.toml`, for example `v1.3.0`. The equivalent CLI command is:

```bash
gh workflow run release.yml --repo microsoft/tgrep --ref main -f tag=v1.2.9
gh workflow run release.yml --repo microsoft/tgrep --ref main -f tag=v1.3.0
```

The workflow validates the version, creates a missing tag at the exact commit
Expand Down Expand Up @@ -72,7 +72,12 @@ the publish step creates a missing tag and a tag named like a branch (such as

The CI workflow runs on PRs and pushes to `main`, weekly on Monday at 08:00 UTC,
and manually with **Actions > CI > Run workflow**. Its native Linux, macOS and
Windows matrix is fail-fast disabled and bounded to 40 minutes per test job.
Windows x64/ARM64 test matrix is fail-fast disabled and bounded to 40 minutes
per test job. The `windows-11-arm` job verifies an ARM64 runner and the native
`aarch64-pc-windows-msvc` Rust host before running the same locked workspace,
managed lifecycle, pinned legacy compatibility and vendored tests as Windows x64.
Both Windows architectures retain control-flow guard, static CRT and
`/DYNAMICBASE`; the x64-only `/CETCOMPAT` linker flag is not passed on ARM64.
Existing Rust and Python agent integration coverage is retained. Workspace
builds/tests are locked; the separately excluded `vendor/ignore` manifest runs
its upstream unit/integration tests **and doctests** on each OS at version
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude = ["vendor/ignore"]
resolver = "2"

[workspace.package]
version = "1.2.10"
version = "1.3.0"
edition = "2024"
rust-version = "1.88"
license = "MIT"
Expand Down
30 changes: 29 additions & 1 deletion SHARED_WORKTREE_INDEXES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1787,7 +1787,12 @@ or changes something resets the backoff, and the rest of that traversal
continues at the base interval. A traversal that changes nothing keeps its
current backoff on every continuation and doubles it on completion, so an idle
namespace is paced rather than rescanned back to back. Lifecycle triggers
still run the next pass at the base interval. Catalog transactions that change
still run the next pass at the base interval. When a collection traversal
completes after any of its passes retired, removed or recovered something, the
daemon starts another traversal at the base interval instead of waiting for
the periodic schedule: retiring a checkpoint can make its generations
collectable only in a later traversal. Traversals repeat until one changes
nothing. Catalog transactions that change
no rows do not invalidate workers' cached operation control.

Reclamation throughput follows these bounds, not free space. Before a member's
Expand Down Expand Up @@ -1877,6 +1882,8 @@ seal, but never synthesizes one from the abandoned bytes.
Deletion journals exact owned identities and each bounded physical step before
performing it, then records the result. Authentication-block-aligned tail
truncations and final unlink cannot exceed the remaining deletion-byte budget.
A verified member that fits the remaining budget is unlinked in one journaled
step; only larger members are first truncated in `chunk_bytes` steps.
After interruption, the exact journaled target length alone is not success:
recovery verifies every surviving prefix block against the original producer
proof before crediting the removed tail. A rewritten prefix at that same length
Expand Down Expand Up @@ -1946,6 +1953,11 @@ its actual and recovered credits and continue from the returned cursor with a
fresh operation token and current policy/allocation versions. Require the final
`Removed` state and complete accounting before claiming the object was reclaimed.

Bounded metadata cleanup can reclaim producer proof rows for a confirmed removed
member while its object is still `PendingDeletion`. The member's deletion record
remains until the whole object is removed, and proofs for surviving members are
retained. Freed catalog pages can be reused; this does not vacuum the database.

```bash
tgrep shared discover /trusted/cache
tgrep shared maintenance /trusted/cache/tgrep-managed-v2/<repository-id> hello
Expand All @@ -1962,6 +1974,22 @@ live asynchronous `.start` is unavailable offline. Recovery requests are
`{"cursor":null-or-returned-recovery-cursor}` and use policy bounds.
Concurrent replay preserves the first completed, failed or cancelled recovery
receipt. Newly eligible work requires a new token, not reuse of that receipt.
Recovery passes resumed past the operation phase first examine a bounded
prefix of unfinished (`accepted`, `preparing` or `cancelling`) receipts,
resolving those whose instance has ended, or that were cancelled or exhausted
their lifetime. This fast path uses at most half the examination and time
budgets so deferred receipts cannot starve the ordinary sweep; a one-row
budget uses only that sweep. It releases their reservations, then ends each
receipt: a not-committed one is
`cancelled` with recovery-required `interrupted-operation` (or
`operation-deadline` once expired), and a committed collection keeps its
saved progress as a completed result. A receipt whose reservation belongs to a
producer of this instance that has not ended, or whose operation still names a
live object, is left to the full sweep. `operations_recovered` and
`reservations_released` count this work. Replaying such a token then returns
its terminal receipt; look it up, acknowledge it and use a new token.
Malformed receipts and per-receipt eligibility errors are reported in `issues`
without preventing unrelated recovery and catalog cleanup.

A maintenance `session` accepts NDJSON
`{"id":1,"method":"objects.page","params":{"cursor":null}}`
Expand Down
2 changes: 1 addition & 1 deletion fuzz/Cargo.lock

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

81 changes: 75 additions & 6 deletions tgrep-cli/src/serve/shared/managed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,31 @@ impl RetrySchedule {
}
}

/// Records a finished automatic collection pass and returns its continuation.
/// A sweep that retired, removed or recovered anything requests another at
/// the base retry interval, because retiring a checkpoint can make its
/// generations collectable only in a later sweep. Sweeping stops once a whole
/// sweep changes nothing, and the retry schedule then backs off.
fn collection_pass_completed(
progress: CollectionProgress,
now: Instant,
schedule: &mut RetrySchedule,
sweep_changed: &mut bool,
requested: &mut bool,
) -> Option<managed::CollectionCursor> {
*sweep_changed |= progress.retired != 0
|| progress.removed != 0
|| progress.recovered_objects != 0
|| progress.logical_bytes_reclaimed != 0
|| progress.recovered_logical_bytes != 0;
schedule.completed(now, *sweep_changed, progress.next.is_some());
if progress.next.is_none() {
*requested |= *sweep_changed;
*sweep_changed = false;
}
progress.next
}

const SCHEDULER_TICK: Duration = Duration::from_millis(100);
const SCHEDULER_IDLE_TICK: Duration = Duration::from_millis(1600);

Expand Down Expand Up @@ -3096,11 +3121,10 @@ pub(super) fn run(root: &Path, options: Options<'_>, policy: Policy) -> Result<(
}
Ok(previous) => match previous.result.map(serde_json::from_value::<CollectionProgress>) {
Some(Ok(progress)) => {
collection_changes |= progress.retired != 0 || progress.removed != 0 || progress.recovered_objects != 0
|| progress.logical_bytes_reclaimed != 0 || progress.recovered_logical_bytes != 0;
collection_cursor = progress.next;
collection_schedule.completed(Instant::now(), collection_changes, collection_cursor.is_some());
if collection_cursor.is_none() { collection_changes = false; }
collection_cursor = collection_pass_completed(
progress, Instant::now(), &mut collection_schedule,
&mut collection_changes, &mut collection_requested,
);
}
Some(Err(error)) => {
collection_cursor = None;
Expand Down Expand Up @@ -3168,7 +3192,9 @@ pub(super) fn run(root: &Path, options: Options<'_>, policy: Policy) -> Result<(
})();
failures.check("collection", started_collection);
if collection.is_some() || !failures.names().is_empty() { quiet = false; }
if collection_cursor.is_some() { wake = collection_schedule.next_due(retry); }
if collection.is_none() && (collection_cursor.is_some() || (enabled && collection_requested)) {
wake = collection_schedule.next_due(retry);
}
let phase_failures = failures.names();
*scheduler.scheduler_snapshot.lock().map_err(|_| Error::corrupt("scheduler observations poisoned"))? = json!({
"initializing":false,"tick_ms":SCHEDULER_TICK.as_millis(),"idle_tick_ms":SCHEDULER_IDLE_TICK.as_millis(),"maximum_backoff_multiplier":64,
Expand Down Expand Up @@ -3948,6 +3974,49 @@ mod scheduling_tests {
);
}

#[test]
fn productive_collection_sweeps_continue_until_one_changes_nothing() {
let base = Duration::from_millis(100);
let now = Instant::now();
let mut schedule = RetrySchedule::default();
let (mut changed, mut requested) = (false, false);
let continuation = CollectionProgress {
removed: 1,
next: Some(managed::CollectionCursor::default()),
..CollectionProgress::default()
};
let next = collection_pass_completed(
continuation,
now,
&mut schedule,
&mut changed,
&mut requested,
);
assert!(next.is_some() && changed && !requested);
// A sweep's final pass can be unproductive; an earlier pass still counts.
let next = collection_pass_completed(
CollectionProgress::default(),
now,
&mut schedule,
&mut changed,
&mut requested,
);
assert!(next.is_none() && !changed && requested);
assert_eq!(schedule.delay(base), base);
assert!(schedule.due(now + base, base));

requested = false;
collection_pass_completed(
CollectionProgress::default(),
now + base,
&mut schedule,
&mut changed,
&mut requested,
);
assert!(!requested, "a sweep that changes nothing stops sweeping");
assert_eq!(schedule.delay(base), base * 2);
}

#[test]
fn waiting_continuations_let_ticks_back_off_and_start_on_time() {
let retry = Duration::from_secs(5);
Expand Down
6 changes: 5 additions & 1 deletion tgrep-cli/tests/watcher_watch_registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,12 @@ fn assert_polling_server_refreshes(mode_args: &[&str]) {
);
thread::sleep(Duration::from_millis(50));
}
// Disk evidence is published before the live reader and cache are swapped.
assert!(
wait_for_no_match(port, "poll_added_marker", Duration::from_secs(15)),
"poll did not publish the deletion to search results"
);
assert_eq!(search_matches(port, "poll_modified_marker"), 1);
assert_eq!(search_matches(port, "poll_added_marker"), 0);
let status = server_status(port);
assert_eq!(status["watch_mode_active"], "poll");
assert!(status["last_reconcile_error"].is_null());
Expand Down
Loading
Loading