Skip to content

Polish LexShield OSS v0.1 to release-ready (60 golden, sinks, acceptance) - #6

Merged
mosesman831 merged 16 commits into
mainfrom
cursor/lexshield-v01-polish-cc14
Jul 11, 2026
Merged

Polish LexShield OSS v0.1 to release-ready (60 golden, sinks, acceptance)#6
mosesman831 merged 16 commits into
mainfrom
cursor/lexshield-v01-polish-cc14

Conversation

@mosesman831

Copy link
Copy Markdown
Contributor

Summary

Release-ready OSS v0.1 polish — completes remaining SPEC gaps, fixes, and quality bar for tagging v0.1.0.

Highlights

Area Delivered
Golden fixtures 60 scenarios (SPEC matrix + extras); Py/TS identical verdicts
Observability HTTP + OTLP trace sinks, stdout notifier, webhook challenges
Resilience LLM circuit breaker, challenge expiry, fail_on_classifier_error
Policy alternatives_min_confidence, expose_rule_ids, embedding stub interface
API Request ID middleware, OpenAPI export, execute upstream tests, Docker dev
CLI Bash completion, global -c, export-openapi
contrib/ Vercel AI SDK, LangChain, OpenAI Agents examples
Release CHANGELOG, CONTRIBUTING, taxonomy/builtin.yaml, make acceptance, release CI

Verification

pytest          → 168 passed
pnpm test       → 67 passed
pnpm test:golden → 60 scenarios
acceptance_v01  → 21/21 passed

Ready to tag

make acceptance
git tag v0.1.0 && git push origin v0.1.0

OSS only — no SaaS.

Open in Web Open in Cursor 

cursoragent and others added 16 commits July 11, 2026 12:48
Remove Cloud/SaaS from MVP scope, replace M6 with docs/polish,
simplify GTM to OSS launch, and add an explicit build-readiness go.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add SPEC §9 feature freeze: exact engine/SDK/CLI/API behaviors,
three demos, expression/redaction contracts, full policy pack YAML,
24-intent catalog, and Appendix D acceptance checklist.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add JSON schemas, policy packs from SPEC Appendix A, golden fixtures,
examples, docs skeletons, CI workflow example, and contrib placeholder.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add packages/engine-ts with ESM build (tsup), vitest, zod schemas for
Policy/ToolCallRequest/Verdict/Trace, YAML policy loader stubs, policy
engine and classifier pipeline stubs, SPEC §9.6 redaction, Shield SDK
surface, and basic tests.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Parallel scaffold of the full monorepo per SPEC v0.1:

- Root: MIT LICENSE, uv workspace, pnpm workspaces, README
- packages/engine-py: Pydantic models, policy/classifier/server stubs, redaction
- packages/cli: Typer CLI (init, check, run, evaluate, traces, challenge, packs)
- packages/engine-ts: @latticeag/lexshield with zod types and Shield stubs
- schemas/, packs/, fixtures/golden/, examples/, docs/, CI example

All Python (10) and TypeScript (10) tests pass; `uv run lexshield version` works.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Add expression parser/evaluator, full policy engine matching (tags,
expressions, priority/tie-break, unclassified fallback), deterministic
classifier parity with rules.yaml loading, golden and policy-engine tests.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
OSS-first implementation kickoff:

- SPEC v0.5: add §9B detailed implementation spec (module map, algorithms,
  golden matrix, CLI/API contracts, dev workflow)
- Python: real PolicyEngine, rule matching, safe expressions, compiled policies
- 10 golden fixtures + pytest harness (deterministic-only)
- CLI check/evaluate wired to Shield; trace writes on evaluate
- TypeScript golden confidence aligned with Python (0.5 unclassified)
- change-window pack priority fix for allow-infra-with-ticket

Tests: 35 Python + 26 TypeScript (10 golden scenarios parity)

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
- init: copy pack rules.yaml (follow symlinks), embed challenge-delete in baseline
- check: strict fails on warnings, taxonomy intent ref warnings
- evaluate: stdin ToolCallRequest, --caller JSON, --environment/--env, --tags
- traces: resolve path from config or --trace-file, pretty-print list/show
- challenge: wire ChallengeStore with config path resolution, print id/status
- main: add completion stub
- tests: evaluate, challenge, packs apply, and smoke flows

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Implement challenge creation on CHALLENGE verdicts in Shield.evaluate using
matched rule challenge config. Add NDJSON trace format with redacted arguments
and classifications, update_outcome patching, and StdoutTraceSink.

guard_sync uses asyncio.run with optional await_challenge polling. from_config
loads all sinks, challenge store path, proxy upstreams, and fail_on_classifier_error.
Add execute_upstream for httpx forwarding when ALLOW.

Move challenge ID creation from PolicyEngine to Shield. Add test_shield.py
covering guard, guard_sync, challenge creation, and record_outcome.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Implement taxonomy severity map, LLM classifier stub, classifier pipeline
with severity merge and caching, full Shield SDK (session context, guardSync,
trace sink, challenge store), LocalApiClient, and expanded test coverage.
All 25 golden fixtures pass.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
- Add runnable Python/TS examples with bundled policy configs
- Fill docs (policy, intents, SDKs, security, CLI) with real content
- Update README with verified deterministic quickstart
- Replace example workflow with ci.yml (pytest, pnpm test/golden, pack check)
- Add lexshield-check-packs CLI entry point for validating all packs

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Parallel implementation of remaining v0.1 OSS features:

- LLM classifier (OpenAI-compatible, mocked tests) + severity merge pipeline
- Shield: challenges, guard_sync, record_outcome, execute_upstream, trace redaction
- FastAPI: execute/proxy, auth token, policy reload, trace/challenge APIs
- CLI: init packs+rules, evaluate stdin, traces, challenge, run with config
- 25 golden fixtures (Py/TS parity)
- TypeScript: full Shield, pipeline, LLM, challenges, traces, LocalApiClient
- Examples, filled docs, CI workflow (pytest + vitest + pack check)

Tests: 98 Python, 47 TypeScript (25 golden scenarios)

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Introduce community-maintained patterns for Vercel AI SDK, LangChain,
and OpenAI Agents SDK under contrib/, with a new docs/integrations.md
guide and root README links. Includes runnable demos that reuse
examples/python-block-exfil policy fixtures.

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
- Add OpenAPI tags, route descriptions with -c config pattern, and request ID middleware
- Export OpenAPI via scripts/export_openapi.py and lexshield export-openapi CLI
- Expand test_api.py: execute upstream forward, traces, challenges, policy reload, readyz
- Add docker-compose.yml and Dockerfile for lexshield run local development

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
…t section

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
Parallel polish across engine, CLI, TS SDK, fixtures, and release tooling:

- 60 golden fixtures (SPEC §9B matrix complete + extras); Py/TS parity
- HTTP/OTLP trace sinks, webhook challenge notifier, LLM circuit breaker
- Challenge expiry, fail_on_classifier_error, expose_rule_ids, alternatives threshold
- FastAPI: middleware, OpenAPI export, execute+upstream tests, docker-compose
- CLI: bash completion, global -c/--config, export-openapi
- contrib/: Vercel AI SDK, LangChain, OpenAI Agents adapter examples
- taxonomy/builtin.yaml, CHANGELOG, CONTRIBUTING, Makefile, acceptance_v01.py
- release.yml CI on tags; docs/examples updated (no stub language)

Tests: 168 Python, 67 TypeScript; acceptance 21/21 pass

Co-authored-by: Moses Man <mosesman831@users.noreply.github.com>
@mosesman831
mosesman831 marked this pull request as ready for review July 11, 2026 13:46
Copilot AI review requested due to automatic review settings July 11, 2026 13:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@mosesman831
mosesman831 merged commit a6437e0 into main Jul 11, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants