feat: Python SDK (v0.1.0) — programmatic project access#93
Conversation
Introduces synix.open(path) and synix.init(path, pipeline=...) entry points with Project, Release, SearchHandle, and typed error hierarchy. Supports build, release, search, artifact inspection, and ref listing through a stable Python API without touching CLI or internals directly. 68 e2e tests + 18 incremental cache tests covering build idempotency, release lifecycle, search correctness, and content-addressed dedup.
|
Note Red Team Review — OpenAI GPT-5.4 | Adversarial review (docs + diff only) Threat assessment — Medium-high risk: this PR adds a new public SDK surface on top of unstable internals, and several API/behavior choices look sticky, under-validated, and not aligned with the project’s own stated boundaries. One-way doors
Findings
Missing
Verdict — Block: the SDK is a major new public API, but it currently hard-codes unsafe scratch behavior, leaks internals, and ships with unresolved contract/design inconsistencies. Review parameters
|
|
Note Architectural Review — Claude Opus | Blind review (docs + diff only) Summary This PR adds a Python SDK ( Alignment Strong fit. DESIGN.md §4.1 explicitly bets on Python-first over config, and this SDK is the natural extension: pipelines defined in Python can now be driven from Python. The data plane reads go through releases (consistent with build/release separation in §1.5), artifacts are immutable and content-addressed, and the incremental rebuild tests validate cache key semantics from §3.3. The "architecture is a runtime concern" hypothesis is served directly — an agent runtime can now swap pipelines programmatically. The v2 buffer sketch in Observations
Verdict This is a strong incremental step — it makes Synix embeddable as infrastructure (the "boto3" framing is apt), the test coverage is thorough, and the design respects build/release separation. The Review parameters
|
- Rename `open()` to `open_project()` to avoid shadowing Python builtin;
keep `open` as deprecated alias for backwards compatibility
- Use UUID-based scratch dir for `release("HEAD")` — prevents concurrent
stomping (GPT critical finding)
- Deep-copy pipeline in `build()` to prevent caller mutation (both reviews)
- Remove `source()` fallback to undeclared sources — now raises SdkError
with list of declared sources (GPT warning)
- Add `ProjectionNotFoundError` — `flat_file()` no longer raises
`SearchNotAvailableError` (GPT minor, wrong error taxonomy)
- Extract `_resolve_flat_file_path()` — dedup flat_file/flat_file_path
(Claude concern)
- Wrap `_get_closure()` receipt parsing in SdkError (Claude concern)
- Remove dead `SdkArtifact._from_snapshot_dict` (Claude nit)
|
Note Red Team Review — OpenAI GPT-5.4 | Adversarial review (docs + diff only) Threat assessment — Medium-high risk: this PR adds a new public SDK surface with several irreversible API decisions, while the docs and implementation already disagree in ways users will notice immediately. One-way doors
Findings
Missing
Verdict — Block: this is a public API addition with real one-way doors, and the current implementation has unsafe file-boundary handling plus hardcoded search/release assumptions that undercut the project’s stated extensibility. Review parameters
|
|
Note Architectural Review — Claude Opus | Blind review (docs + diff only) Summary Adds a Python SDK ( Alignment Strong fit. DESIGN.md §4.1 explicitly chose Python-first because "experimentation is a code activity." The SDK is the natural completion of that bet — pipelines defined in Python can now be executed in Python without shelling out. The build/release separation (§1.5) is preserved: Observations
Verdict This is a well-structured, well-tested incremental step that makes Synix embeddable as a library — a necessary precondition for the agent-runtime and benchmark use cases the project targets. Ship it after addressing the Review parameters
|
…atch race - Remove `open` re-export from __init__.py — no longer shadows builtin (both reviews, v2) - Export `SdkError` from __init__.py for user-facing error handling - Add path traversal validation in SdkSource — rejects `../` and absolute paths in add_text/remove (GPT critical) - Fix scratch release race: _get_closure reads snapshot_oid from receipt written by execute_release, not by re-resolving HEAD independently (Claude concern #3) - Scratch close() cleans up both work/ and releases/ dirs - Update sdk-design.md examples to use open_project (Claude question #4) - Update sdk.md quick start to use open_project - All tests use open_project; 3 new tests for path traversal + undeclared source
|
Note Red Team Review — OpenAI GPT-5.4 | Adversarial review (docs + diff only) Threat assessment — Medium-high risk: this PR ships a new public SDK surface from zero to “boto3 for synix” in one shot, with multiple irreversible API decisions and several mismatches against the documented model. One-way doors
Findings
Missing
Verdict — Block: the SDK is too big a public surface to merge with doc/API mismatches, design-principle drift ( Review parameters
|
|
Note Architectural Review — Claude Opus | Blind review (docs + diff only) Summary This PR introduces a Python SDK ( Alignment Strong fit. DESIGN.md §4.1 explicitly chose Python-first over config, and the SDK extends that principle from pipeline definition to pipeline consumption. The read path goes through releases (immutable snapshots), preserving the build/release separation from §1.5. Artifacts remain immutable and content-addressed — Observations
Verdict This is a well-executed incremental step — it makes Synix embeddable in agent runtimes (the primary use case) without introducing new concepts, respects immutability and provenance throughout, and ships with thorough e2e coverage. Review parameters
|
- Export full error hierarchy from __init__.py (SynixNotFoundError, ReleaseNotFoundError, ArtifactNotFoundError, SearchNotAvailableError, EmbeddingRequiredError, PipelineRequiredError, ProjectionNotFoundError) - Remove stale deprecated-alias note from sdk.md (open was already removed) - Update sdk.md error import example to use `from synix import` (not sdk) - Fix variable name `l` → `layer` in list comprehension
|
Note Red Team Review — OpenAI GPT-5.4 | Adversarial review (docs + diff only) Threat assessment — Medium-high risk: this adds a new public SDK surface and exports it from One-way doors
Findings
Missing
Verdict — Block: this is a substantial public API addition with real one-way-door impact, and the implementation is too coupled to current release file layout and under-specified for concurrency and adapter extensibility. Review parameters
|
|
Note Architectural Review — Claude Opus | Blind review (docs + diff only) Summary This PR introduces a Python SDK ( Alignment Strong fit. DESIGN.md §4.1 explicitly chose Python-first over config, and the SDK extends that bet to runtime consumption — agents can now embed Synix directly rather than shelling out. The build/release separation (DESIGN.md §1.5) is respected: all data-plane reads go through Observations
Verdict This is a well-structured, well-tested incremental step that makes Synix directly embeddable in agent runtimes — a natural progression from CLI-only access that advances the core vision. Review parameters
|
- Fix stale synix.open() → open_project() in sdk.md and sdk-design.md - Fix incorrect BuildResult attributes in sdk-design.md (layers_built, cost_estimate → built, total_time, snapshot_oid) - Fix incorrect release_to() return type in sdk-design.md (dict, not object) - Document path traversal validation in SdkSource - Document build() deep-copy behavior - Update CLAUDE.md module comment to open_project - Add SDK link to README Learn More table
|
Note Red Team Review — OpenAI GPT-5.4 | Adversarial review (docs + diff only) Threat assessment — Medium-high risk: this PR introduces a new public SDK surface in one shot, wired directly to internals and documented as if stable, but the behavioral contract is underspecified and partly inconsistent with the project’s own design. One-way doors
Findings
Missing
Verdict — Block: this is not just additive docs; it cements a public API with architectural layering problems and inconsistent user-facing semantics. Review parameters
|
|
Note Architectural Review — Claude Opus | Blind review (docs + diff only) Summary This PR adds a Python SDK ( Alignment Strong fit. DESIGN.md's Python-first decision (§4.1) explicitly argues that the target user is already writing Python and the interface should be composable with agent code. The SDK directly enables the two use cases the design anticipates: agent runtime integration (core memory in system prompts, RAG tool) and benchmark harnesses. The read boundary being releases (§1.5 build/release separation) is faithfully preserved — all data-plane reads go through Observations
Verdict This is a well-designed, well-tested incremental step that makes synix embeddable as a library — directly advancing the Python-first and build/release separation principles from DESIGN.md. Review parameters
|
Closes #57
Summary
synix.sdk) — complete programmatic access: init, open, source management, build, release, search, inspectsynix.open_project(path)/synix.init(path, pipeline=...)Project,Release,SearchHandle,SdkSourceembedding_configraisesEmbeddingRequiredErrorSdkArtifact,SdkSearchResult,BuildResultSdkError→SynixNotFoundError,ReleaseNotFoundError,ArtifactNotFoundError,SearchNotAvailableError,EmbeddingRequiredError,ProjectionNotFoundError,PipelineRequiredErrorReview Fixes
Round 1
open()shadows Python builtin (Claude)open_project()scratch_{uuid}dirs under.synix/work/build()mutates pipeline in-place (both)source()fallback creates undeclared sources (GPT)SdkErrorwith declared source listflat_file()raisesSearchNotAvailableError(GPT)ProjectionNotFoundErrorflat_file()/flat_file_path()duplication (Claude)_resolve_flat_file_path()_get_closureKeyError on malformed receipt (Claude)ReleaseNotFoundError_from_snapshot_dictdead code (Claude)Round 2
openstill re-exported from__init__.py(both)SdkErrornot exported (GPT)__init__.pyexportsSdkSource.add_text/remove(GPT critical)_validate_name()rejects../, absolute paths, nested paths_get_closure()readssnapshot_oidfrom receipt written byexecute_releasesdk-design.mduses deprecatedsynix.open()(Claude)open_projectclose()leaks receipt dir (implicit)work/scratch dir andreleases/receipt dirTest Coverage
tests/e2e/test_sdk.py— 71 tests (init, open, source, build, release, search, inspect, errors, path traversal)tests/e2e/test_sdk_incremental.py— 9 tests (full lifecycle: build → add → rebuild → release → search)tests/e2e/test_release_embeddings.py— 6 tests (embedding generation, fail-closed enforcement)