Skip to content

feat(python): add missing ingest_working_state and contest methods#2

Merged
GustyCube merged 12 commits intomasterfrom
claude/repo-review-improvements-E2OK9
Feb 15, 2026
Merged

feat(python): add missing ingest_working_state and contest methods#2
GustyCube merged 12 commits intomasterfrom
claude/repo-review-improvements-E2OK9

Conversation

@GustyCube
Copy link
Copy Markdown
Owner

The Python client was missing 2 of 15 gRPC methods. This adds
ingest_working_state() for working memory snapshots and contest()
for marking records as contested with conflicting evidence.

The Python client was missing 2 of 15 gRPC methods. This adds
ingest_working_state() for working memory snapshots and contest()
for marking records as contested with conflicting evidence.
Adds ValidityMode, TaskState, AuditAction, ProvenanceKind, and
EdgeKind enums that were present in pkg/schema/enums.go but missing
from the Python types module.
Previously only 6 types were in __all__. Now exports all enums
and dataclasses so users can do `from membrane import DecayCurve`
instead of reaching into `membrane.types`.
The Python client previously only supported insecure channels. Now
accepts tls, tls_ca_cert, api_key, and timeout parameters. All RPC
calls pass metadata/timeout automatically. Updates README with
missing methods (ingest_working_state, contest) and TLS docs.
- Fix import from non-existent 'membrane_client' to 'membrane'
- Fix getting-started example to use actual client API signature
  (positional args, TrustContext object instead of loose kwargs)
- Replace raw protobuf example in examples.md with the actual
  Python client library usage
listRecords previously fetched IDs then called getRecord per ID,
resulting in 7*N queries. Now uses getRecordsBatch which does one
query per table (7 total) for batches >3.

Also fixes orphaned relations on update (tags and provenance were
replaced but relations were not) and adds compound indexes on
(type, salience) and (scope, sensitivity) for common query patterns.
Reinforce() previously had no upper bound on salience, allowing
repeated reinforcement to push values arbitrarily high. Now capped
at 1.0. Also makes Reinforce atomic by setting salience on the
record struct before calling Update (previously called UpdateSalience
and Update separately).

ApplyDecay() now guards against NaN/Inf values from misconfigured
decay curves, falling back to MinSalience.
Previously, srv.Stop() was called before cancel(), meaning gRPC
could still be draining in-flight requests while background
schedulers ran. Now cancels context first (stopping schedulers),
then gracefully drains gRPC, then closes the database.
IngestOutcome was missing validation for source, target_record_id,
and outcome_status fields. Merge was missing bounds check on the
ids slice, allowing unbounded payloads.
The Snapshot struct had no timestamp indicating when metrics were
collected, making staleness invisible to consumers. Now includes
a CollectedAt field set at the start of collection.
- Test on Go 1.22 and 1.23 for forward compatibility
- Add gofmt check to catch unformatted code
- Add go mod tidy check to catch stale dependency state
- Generate coverage profile with -coverprofile
- Run staticcheck (was in Makefile but missing from CI)
Adds protoc version requirement, Python prerequisites, instructions
for keeping SDKs in sync with proto changes, and scoped commit
message examples.
@GustyCube GustyCube merged commit 13d776c into master Feb 15, 2026
1 of 3 checks passed
@GustyCube GustyCube deleted the claude/repo-review-improvements-E2OK9 branch February 15, 2026 23:51
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.

2 participants