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
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ jobs:
run: |
TAGS=$(go -C ../../scripts/profile-tags run . local)
go build -tags "${TAGS}" ./...
go vet -tags "praxis_e2e,${TAGS}" .
go test -race -tags "${TAGS}" ./...

- name: Build and test cmd/agentop
Expand Down
51 changes: 44 additions & 7 deletions .github/workflows/praxis.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Praxis - fmt, clippy and tests for the Rust workspace in praxis/
#
# Runs when praxis/ changes, or when the Go code that praxis/ ports changes.
# Only a change to praxis/ (or to this file) makes a failure block the PR.
# A Go-only change runs the steps too, so drift shows, but does not block.
# A failure blocks the PR only for a change to praxis/, to this file, or to the Go side
# of praxis mode (the hop, the egress listener, cmd/cortex's praxis wiring). Any other
# Go change runs the steps too, so drift shows, but does not block.
#
name: Praxis

Expand Down Expand Up @@ -33,6 +34,13 @@
- "core/redact/**"
- "core/pipeline/subagent.go"
- "core/listener/forwardproxy/ingest_replay_test.go"
- "core/listener/forwardproxy/hop*.go"
- "core/listener/forwardproxy/egress*.go"
- "core/listener/forwardproxy/record.go"
- "core/listener/forwardproxy/tunnel.go"
- "cmd/cortex/praxis*.go"
- "cmd/cortex/gateway.go"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: The e2e harness also depends on cmd/cortex/ingest.go (ingestOptions, readGatewayToken) and on core/attribution/**, which holds the X-Cortex-Attribution encoder that the gateway decodes. praxis/filters/tests/attribution_wire.rs also reads core/attribution/testdata/wire.golden. A PR that changes only those files does not start this workflow. Consider adding both paths to the two paths lists. Separately, as you noted in the description, the new setup-go step (line 129) needs cache-dependency-path: cmd/cortex/go.sum. Without it, setup-go looks for a root go.sum, gives a warning and does not cache modules.

- "cmd/cortex/ingest.go"
push:
branches:
- main
Expand All @@ -58,6 +66,13 @@
- "core/redact/**"
- "core/pipeline/subagent.go"
- "core/listener/forwardproxy/ingest_replay_test.go"
- "core/listener/forwardproxy/hop*.go"
- "core/listener/forwardproxy/egress*.go"
- "core/listener/forwardproxy/record.go"
- "core/listener/forwardproxy/tunnel.go"
- "cmd/cortex/praxis*.go"
- "cmd/cortex/gateway.go"
- "cmd/cortex/ingest.go"

permissions:
contents: read
Expand All @@ -84,12 +99,14 @@
echo "blocking=true" >> "$GITHUB_OUTPUT"
exit 0
fi
pattern='^(praxis/|\.github/workflows/praxis\.yaml$)'
# The hop, the egress listener and the gateway wiring are praxis mode's Go side,
# not ported code: a change there that breaks the end-to-end tests must block.
pattern='^(praxis/|\.github/workflows/praxis\.yaml$|core/listener/forwardproxy/(hop|egress)[^/]*\.go$|cmd/cortex/(praxis[^/]*|gateway|ingest)\.go$)'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: The blocking pattern covers hop*.go/egress*.go and three cmd/cortex files. Some of the Go side of praxis mode lives elsewhere, though: hop branch points 1 and 2 are in core/listener/forwardproxy/server.go, branch point 5 is in record.go, the awaiting and joined tunnel settlement is in tunnel.go, the startPraxis and NewUpstreamClient wiring is in cmd/cortex/main.go, and the hop-header encoder is in core/attribution/wire.go. A PR that breaks the end-to-end tests through one of those files reports a warning and does not block. server.go at least triggers the workflow. record.go, tunnel.go, main.go and core/attribution/** do not trigger it at all, so the end-to-end tests don't run for them. Consider adding them to the paths: lists and to this pattern, or say in the header comment that these files are left out on purpose.

if git diff --name-only "$BASE_SHA" HEAD | grep -qE "$pattern"; then
echo "blocking=true" >> "$GITHUB_OUTPUT"
else
echo "blocking=false" >> "$GITHUB_OUTPUT"
echo "No praxis/ changes; failures do not block."
echo "No praxis-mode changes. Failures do not block."
fi

# Installs the toolchain that praxis/rust-toolchain.toml names.
Expand Down Expand Up @@ -120,17 +137,37 @@
continue-on-error: ${{ steps.changes.outputs.blocking != 'true' }}
run: cargo test --locked

- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: cmd/cortex/go.mod

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

suggestion: As the description already notes, add cache-dependency-path: cmd/cortex/go.sum. The repo root has no go.sum, so setup-go warns "Restore cache failed" and the step downloads modules on every run. Each setup-go step in ci.yaml sets this value.

cache-dependency-path: cmd/cortex/go.sum

# Runs from the repo root: the command names praxis/ and cmd/cortex. rustup reads
# rust-toolchain.toml only below praxis/, so the step names that toolchain itself.
- name: End-to-end (praxis mode)
id: e2e
continue-on-error: ${{ steps.changes.outputs.blocking != 'true' }}
run: |
set -euo pipefail
RUSTUP_TOOLCHAIN=$(sed -n 's/^channel = "\(.*\)"$/\1/p' praxis/rust-toolchain.toml)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: If rust-toolchain.toml ever switches to single quotes or adds a comment on the channel line, the sed prints nothing. RUSTUP_TOOLCHAIN is then exported empty, and set -u does not catch an empty value. A [ -n "$RUSTUP_TOOLCHAIN" ] || { echo '::error::no channel in praxis/rust-toolchain.toml'; exit 1; } guard would make that failure clear.

export RUSTUP_TOOLCHAIN
cargo build --locked -p cortex-gateway --manifest-path praxis/Cargo.toml
TAGS=$(GOWORK=off go -C scripts/profile-tags run . local)
CORTEX_GATEWAY_BIN=$PWD/praxis/target/debug/cortex-gateway GOWORK=off go -C cmd/cortex test -count=1 -timeout 15m -tags "praxis_e2e,$TAGS" -run TestPraxisE2E .

Check warning on line 156 in .github/workflows/praxis.yaml

View workflow job for this annotation

GitHub Actions / YAML Lint

156:151 [line-length] line too long (169 > 150 characters)

# A report-only run passes, so a warning on the PR shows the parity gap.
- name: Report failures that do not block
if: always() && steps.changes.outputs.blocking != 'true'
env:
FMT: ${{ steps.fmt.outcome }}
CLIPPY: ${{ steps.clippy.outcome }}
TEST: ${{ steps.test.outcome }}
E2E: ${{ steps.e2e.outcome }}
run: |
[ "$FMT" != failure ] || echo "::warning::cargo fmt failed (does not block: no praxis/ changes)"
[ "$CLIPPY" != failure ] || echo "::warning::cargo clippy failed (does not block: no praxis/ changes)"
[ "$TEST" != failure ] || echo "::warning::cargo test failed (does not block: no praxis/ changes)"
[ "$FMT" != failure ] || echo "::warning::cargo fmt failed (does not block: no praxis-mode changes)"
[ "$CLIPPY" != failure ] || echo "::warning::cargo clippy failed (does not block: no praxis-mode changes)"
[ "$TEST" != failure ] || echo "::warning::cargo test failed (does not block: no praxis-mode changes)"
[ "$E2E" != failure ] || echo "::warning::praxis end-to-end tests failed (does not block: no praxis-mode changes)"

# Size cap: the cache post-step must not save a target/ over 3 GiB.
- name: Cap the target/ cache size
Expand Down
Loading
Loading