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
57 changes: 35 additions & 22 deletions .cursor/hooks/auto-commit-push.ps1
Original file line number Diff line number Diff line change
@@ -1,42 +1,55 @@
# Auto-commit and push after an agent run finishes (stop hook).
# Fail-open: empty stdout JSON; never block the agent on git issues.
# Local checkpoint after an agent run finishes (stop hook).
# Does not stage, commit, or push. Fail-open: empty stdout JSON.
# See docs/development/agent-checkpoint.md.
$ErrorActionPreference = "Continue"
try {
$input | Out-Null
$root = (Get-Location).Path
$safe = @("-c", "safe.directory=$root")
$gitExe = @(Get-Command git -CommandType Application -ErrorAction Stop)[0].Source

function Git([Parameter(ValueFromRemainingArguments = $true)]$Args) {
& git @safe @Args 2>&1
function Invoke-Git([Parameter(ValueFromRemainingArguments = $true)][string[]]$GitArgs) {
& $gitExe @safe @GitArgs 2>&1
}

$status = Git status --porcelain
$status = Invoke-Git status --porcelain
if (-not $status) {
Write-Output "{}"
exit 0
}

# Stage tracked updates and known source/docs; respect .gitignore
Git add -A | Out-Null
$staged = Git diff --cached --name-only
if (-not $staged) {
Write-Output "{}"
exit 0
}
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$dir = Join-Path $root "target/agent-work/checkpoints/$stamp"
New-Item -ItemType Directory -Force -Path $dir | Out-Null

$stamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss zzz"
$msg = @"
chore: agent session checkpoint
$tracked = Invoke-Git diff HEAD
$staged = Invoke-Git diff --cached
$untracked = Invoke-Git ls-files --others --exclude-standard
$status | Out-File -FilePath (Join-Path $dir "status.txt") -Encoding utf8
$tracked | Out-File -FilePath (Join-Path $dir "tracked.diff") -Encoding utf8
$staged | Out-File -FilePath (Join-Path $dir "staged.diff") -Encoding utf8
$untracked | Out-File -FilePath (Join-Path $dir "untracked.txt") -Encoding utf8

Automated stop-hook commit ($stamp).
"@
Git commit -m $msg | Out-Null
if ($LASTEXITCODE -ne 0) {
Write-Output "{}"
exit 0
$branch = Invoke-Git rev-parse --abbrev-ref HEAD
if ($branch -match '^(main|master)$') {
[Console]::Error.WriteLine("checkpoint: refusing to publish; HEAD is $branch")
}
if ($env:ZSTDF_AGENT_PUBLISH -eq "1") {
[Console]::Error.WriteLine("ZSTDF_AGENT_PUBLISH is ignored by the stop hook. It never pushes. Run scripts/publish_agent_branch.ps1 explicitly.")
}

$python = $null
foreach ($name in @("python", "python3", "py")) {
$cmd = Get-Command $name -ErrorAction SilentlyContinue
if ($cmd) { $python = $cmd.Source; break }
}
if ($python) {
& $python "scripts/check_pr_size.py" --worktree 2>&1 | ForEach-Object {
[Console]::Error.WriteLine($_)
}
}

Git push -u origin HEAD | Out-Null
[Console]::Error.WriteLine("checkpoint: $dir")
Write-Output "{}"
exit 0
}
Expand Down
46 changes: 45 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@1.99.1
with:
components: rustfmt, clippy

Expand All @@ -25,13 +25,31 @@ jobs:
- name: License declarations
run: py -3.12 scripts/check_licenses.py

- name: Pull request size warning
if: github.event_name == 'pull_request'
run: |
git fetch --no-tags origin ${{ github.base_ref }}
py -3.12 scripts/check_pr_size.py --base origin/${{ github.base_ref }}

- name: Clippy
run: cargo clippy --workspace --locked -- -D warnings

- name: Supply chain
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check
arguments: "--locked"
rust-version: "1.99.1"

- name: Check
run: cargo check --workspace --locked

- name: Download pinned public STDF samples
run: py -3.12 examples/public-stdf/download.py

- name: Test
env:
ZSTDF_REQUIRE_PUBLIC: "1"
run: cargo test --workspace --locked

- name: Fuzz smoke
Expand Down Expand Up @@ -59,3 +77,29 @@ jobs:
py -3.12 examples/viewer/generate_demo.py
npm install --no-save playwright
node scripts/smoke_viewer.cjs

fuzz:
name: cargo-fuzz smoke
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install nightly Rust
uses: dtolnay/rust-toolchain@nightly
with:
components: llvm-tools

- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked --version 0.13.1

- name: Seed corpus
run: python3 fuzz/seed_corpus.py

- name: decode_all smoke
working-directory: fuzz
run: cargo +nightly fuzz run decode_all -- -max_total_time=20

- name: truncate_prefix smoke
working-directory: fuzz
run: cargo +nightly fuzz run truncate_prefix -- -max_total_time=20
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/target/
**/target/
/fuzz/corpus/**/public-*
/fuzz/artifacts/
/output.parquet
/output.parquet.manifest.json
/dashboard.html
Expand Down
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ User instructions and host permissions take precedence.

- Choose checks from the collaboration guide. Record skipped/unavailable checks
explicitly. Never treat a planned check or another agent's assertion as a pass.
- The stop hook writes a local checkpoint and does not stage, commit, or push.
Only the coordinator publishes, and only with user authorization. Never push
to `main`. The explicit path is `scripts/publish_agent_branch.ps1`, which
pushes an `agent/...` branch only after format, Clippy, and tests pass.
See [the checkpoint note](docs/development/agent-checkpoint.md).
- Keep pull requests reviewable. `scripts/check_pr_size.py` warns in CI when a
diff exceeds 800 non-generated lines and is not entirely deletions or
generated files. Split the change when that warning fires.
- Production Rust forbids `unsafe_code`. `stdf-io` (read-only mmap) and
`stdf-parquet` (rename and process-liveness FFI) deny it instead, and allow
it only on those functions, each with a `SAFETY` comment. `clippy::unwrap_used`
and `clippy::panic` are denied outside tests. `rust-toolchain.toml` pins the
compiler, and `cargo deny check` runs in CI.
- In a shared checkout, the coordinator serializes Cargo builds, demo generation,
browser suites and release executable replacement. Workers request that slot.
- Use separate output directories for independent experiments. Do not kill an
Expand Down
Loading
Loading