Skip to content

Claude/review lance graph architecture i6 t kf#3

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/review-lance-graph-architecture-i6TKf
Mar 5, 2026
Merged

Claude/review lance graph architecture i6 t kf#3
AdaWorldAPI merged 2 commits into
mainfrom
claude/review-lance-graph-architecture-i6TKf

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

No description provided.

claude added 2 commits March 4, 2026 23:50
…g traversal + 7 ground truth tests

Implements the full SPO (Subject-Predicate-Object) graph primitives stack:

- graph/fingerprint.rs: label_fp() with 11% density guard, dn_hash(), hamming_distance()
- graph/sparse.rs: Bitmap [u64;BITMAP_WORDS] (fixes old [u64;2] truncation), pack_axes()
- graph/spo/truth.rs: TruthValue (NARS frequency/confidence), TruthGate (OPEN/WEAK/NORMAL/STRONG/CERTAIN)
- graph/spo/builder.rs: SpoBuilder with forward/reverse/relation query vector construction
- graph/spo/store.rs: SpoStore with 2^3 projection verbs (SxP2O, PxO2S, SxO2P), gated queries, semiring chain walk
- graph/spo/semiring.rs: HammingMin semiring (min-plus over Hamming distance)
- graph/spo/merkle.rs: MerkleRoot, ClamPath, BindSpace with verify_lineage (known gap documented) and verify_integrity
- graph/mod.rs: ContainerGeometry enum with Spo=6

Ground truth integration tests (7/7 pass):
1. SPO hydration round-trip (insert + forward/reverse query)
2. 2^3 projection verbs consistency (all three agree on same triple)
3. TruthGate filtering (OPEN=2, STRONG=1, CERTAIN=0 for test data)
4. Belichtung prefilter rejection rate (<10 hits from 100 edges)
5. Semiring chain traversal (3 hops with increasing cumulative distance)
6. ClamPath+MerkleRoot integrity (documents verify_lineage no-op gap)
7. Cypher vs projection verb convergence (SPO side validated)

31 unit tests + 7 integration tests, all passing. Clippy clean.

https://claude.ai/code/session_016SeGMg1pgf1MqK8YWkedvV
@AdaWorldAPI AdaWorldAPI merged commit c436c48 into main Mar 5, 2026
AdaWorldAPI pushed a commit that referenced this pull request Apr 18, 2026
The 5th and foundational chess research direction: load the full
historical record (5B Lichess games + 10M master games + Syzygy
endgame tablebases) into our native encoding and make it queryable
via Cypher with semantic similarity.

Compression: 200B position-occurrences → ~325 GB on SSD after
CAM-PQ palette compression + FEN deduplication. ChessBase needs
600 GB for 10M games; we carry 500× more in half the space.

Three query classes impossible in any existing chess tool:
  - Semantic position similarity (palette distance is O(1))
  - Multi-hop NARS confidence paths (truth propagation)
  - Human-intuition move mining (engine-dispreferred but winning)

~1400 lines of new code, ~10 days focused work. Most infrastructure
already shipped (AriGraph, CausalEdge64, Cypher parser, BindSpace,
PaletteSemiring).

Recommended as Tier 0 substrate — every subsequent experiment (#2
style benchmark, #3 learning, #1 longitudinal) is measurably more
credible with 5 billion games behind it.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
AdaWorldAPI pushed a commit that referenced this pull request Apr 20, 2026
Addresses all 5 follow-ups from .claude/knowledge/cam-pq-unified-pipeline.md:

#1 Wire register_cam_udfs in execute_with_context
  - CypherQuery::with_cam_codebook(codebook) builder method
  - execute_with_context auto-registers cam_distance + cam_heel_distance
    UDFs when codebook is set
  - One-line unblock for SQL/Cypher CAM-PQ queries

#2 Migrate cam_pq_calibrate output to Lance schema
  - codebook_to_lance() in lance-graph/src/cam_pq/storage.rs
  - Converts (codebook, fingerprints) -> (vectors_batch, codebook_batch)
  - Arrow RecordBatches ready for Lance write; bridges bgz-tensor's raw
    calibration output to the canonical storage format

#3 impl OrchestrationBridge for codec research (nd.* step-types)
  - codec_bridge.rs: CodecResearchBridge owns StepDomain::Ndarray
  - nd.tensors / nd.calibrate / nd.probe dispatch via codec_research
  - Parses args from step.reasoning as WireRequest JSON
  - Complements planner's lg.* bridge

#4 Generic OrchestrationBridge routing endpoint
  - POST /v1/shader/route — accepts WireUnifiedStep JSON
  - Composed bridge: tries CodecResearchBridge first (nd.*), falls
    through to PlannerAwareness (lg.*) if DomainUnavailable
  - planner_bridge.rs preserved as typed convenience (rich responses)
  - Both patterns coexist: generic route + typed Wire DTOs

#5 WireUnifiedStep + WireStepResult DTOs
  - Generic step envelope: {step_id, step_type, reasoning}
  - Generic result: {step_id, step_type, status, reasoning, confidence}
  - POST /v1/shader/route uses these; per-op endpoints stay for
    convenience with their richer typed responses

All 5 follow-ups delivered in one commit. 46/46 shader-driver tests
pass. lance-graph compiles clean.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
AdaWorldAPI added a commit that referenced this pull request Apr 30, 2026
…ring

F1 (MySQL <-> SPO oracle parity) shipped via MedCareV2 PRs #1, #2, #3,
medcare-rs PR #71, and lance-graph PR #309. The vision doc still claimed
F1 was "the next concrete deliverable". Rewrite section 7 to: state F1
has shipped, describe the LanceProbe -> ParityWitness -> DriftSink flow,
name the contract DTO
(lance-graph-callcenter::transcode::parallelbetrieb::DriftEvent), list
F1's known gaps (no latency claims; in-memory ring buffer), and state
F2 RBAC+audit wiring (medcare-rs adopting RlsRewriter) as the next
posture. No other sections touched.
AdaWorldAPI added a commit that referenced this pull request May 6, 2026
…ITICAL fixes required)

Meta-1 review surfaces 10 findings; 2 CRITICAL fixes block Round 2 opening:

CRITICAL #1: Doctor.Anamnese Full predicate-write violates BMV-Ä §57 append-only
  → fix: empty writable_predicates, keep only "append" action
CRITICAL #2: Receptionist clinical-blind fails safety (no Identity-read for
  allergy/triage lookup before scheduling)
  → fix: merge Patient permission to Detail-depth + 3 demographic writes,
    add Identity-read on Diagnosis + LabResult

HIGH #3-#4 (defer to Round 3 gate.rs): Diagnosis finalize/retract Escalate +
  Patient anonymize/merge/delete Escalate (GDPR Art.17 + §35 BDSG)
MEDIUM #5-#8 (backlog): Missing entities (Termin, Recall, ePA) + audit trail hook
LOW #9-#10 (backlog): PKV/GKV modulation + dynamic reason strings

Round 2 implications surfaced for W5/W8.
Round 3 implications surfaced for W9/W12 (Escalate wrapping + §73 SGB V test).

Concrete diff for W3-revision-2 included at end of file.
Next commit: W3-revision-2 applies the two CRITICAL fixes.
AdaWorldAPI added a commit that referenced this pull request May 6, 2026
…1 CRITICAL fix path)

Meta-2 review surfaces 5 findings; 1 CRITICAL flagged for verification:

CRITICAL #1: W7 hard-depends on StepDomain::MedCare which may not exist upstream
  → Recommended fix path: fetch lance-graph-contract/src/orchestration.rs to
    verify DomainProfile shape, then either confirm variant exists OR commit
    W7-revision-2 with inline-constructed DomainProfile fallback

MEDIUM #2: MedCareStack empty struct doc-comment overclaims as "facade"
  → Doc-only fix; defer to next field-growth commit

MEDIUM #3: Missing with_default_policies() builder
  → Backlog; lands when rls_registry field lands

LOW #4-#5: Cross-crate test + dev-deps deferred

Round 3 implications surfaced:
- W9 imports list (medcare_rbac::{policy, role, access})
- W10 lib.rs gate re-export shape
- W12 §73 SGB V tests must include BtM Escalate + Ueberweisung row visibility
  (Meta-1 carry-forward)

Sprint orchestrator: verify upstream StepDomain::MedCare before
committing W7-revision-2, OR apply fail-safe inline construction.
AdaWorldAPI added a commit that referenced this pull request May 6, 2026
…e (sprint closure)

Meta-3 final review surfaces 5 findings; ZERO CRITICAL:

HIGH #1: Action operations (Operation::Act) unreachable via gate
  → Doc note recommended; orchestration layer is the right home for action gating
HIGH #2: BtM Escalate "v1 limitation" tests use loose is_allowed() assertions
  → Recommend tightening to explicit assert_eq!(AccessDecision::Allow)
    for clearer future test-failure messages

MEDIUM #3: Three name paths for Policy (rbac, gate, lib)
  → Backlog; doc-only canonicalization
MEDIUM #4: 20-200 ns gate decision claim unbenchmarked
  → Backlog; criterion-based gate-bench follow-up
LOW #5: TD-MEMBRANE-FIRST-VS-ANY untested
  → Backlog; vacuous in v1 without divergence case

Sprint-wide closure:
- Round 1 (medcare-rbac): 26 tests, solid, 2 CRITICAL fixes applied
- Round 2 (medcare-realtime skeleton): 5 tests, 1 CRITICAL casing+HIPAA fix
- Round 3 (gate impl): 33 tests, 2 HIGH documentation gaps
- Total: 64 tests across 3 crates

VERDICT: Ship. POLICY-1 medcare-side seam CLOSED for v1. Topology I-1/I-2/I-3/I-4
upheld. PR #29 three TD caveats honestly carried forward.
AdaWorldAPI added a commit that referenced this pull request May 6, 2026
…closure

12 workers + 3 metas across 3 rounds, 4 CRITICAL fixes applied as inline
revisions (W3-rev2, W4-rev2, W7-rev2). Meta-3 final verdict: SHIP.

Total shipped:
- medcare-rs: 14 commits, 13 files, ~1,865 LOC, 64 tests
- lance-graph sprint-log: 21 commits (12 agent logs + 3 meta reviews +
  scaffolding + this synthesis)

POLICY-1 / MEMBRANE-GATE-1 medcare-side seam: SHIPPED v1
- Mirror of smb-office-rs#29 with regulatory adaptations
- Three TD caveats from PR #29 honestly carried forward
- Topology I-1/I-2/I-3/I-4 invariants preserved

Outstanding from Meta-3 (backlog):
- HIGH #1: Action ops doc note (5 min)
- HIGH #2: Tighten v1-limit assertions (10 min)
- MEDIUM #3-#4: Policy name canonicalization + bench harness
- LOW #5: TD-MEMBRANE-FIRST-VS-ANY test (vacuous in v1)

Synthesis includes:
- Findings summary (4 CRITICAL applied + 2 HIGH backlog)
- Topology invariant preservation table
- Upstream gaps surfaced (StepDomain verified, BMV-Ä retention, BtM Escalate)
- Test posture per-crate
- Recommended follow-up sprint scope (~half day)
- What the cca2a pattern validated this run
- Full branch state at sprint closure (commit lists for both repos)

Ready for CI verification + PR to medcare-rs main.
AdaWorldAPI pushed a commit that referenced this pull request May 7, 2026
5 issues raised by codex on PR #355 + 1 clippy CI failure resolved.

P1: registry.rs append used SchemaPtr::new(...) with default
ontology_context_id = 0, leaving every registry-created row with
ctx_id 0. The driver.rs MUL profile gate at lines 303-321 therefore
always selected DEFAULT, never reaching MEDICAL/CALLCENTER even for
Healthcare/Medical rows. Fixed by adding a LazyLock<NamespaceRegistry>
at module scope and stamping ctx_id from seed_defaults().get() onto
the SchemaPtr at the append site:
  let ctx_id = SEED_NAMESPACE_REGISTRY.get(&proposal.namespace).unwrap_or(0);
  let schema_ptr = SchemaPtr::new(ns, etid, kind).with_context_id(ctx_id);
Now WorkOrder rows get ctx=1 (CALLCENTER), Healthcare rows ctx=2
(MEDICAL), Medical/{ICD10CM..CHEBI} rows ctx=10..19 (MEDICAL).

P2: build.rs CARGO_PKG_NAME is the package whose build script is
running — always "lance-graph-callcenter" here. The previous
CARGO_PKG_NAME == "lance-graph-callcenter" check was tautologically
true, so transitive cargo check of unrelated crates that pull
callcenter would still hit the cargo::error= abort that FIX-2 was
supposed to dodge. Replaced with CARGO_PRIMARY_PACKAGE which cargo
sets to "1" only for direct builds; transitive builds leave it
unset, the abort path stays dormant, and only cargo:warning lines
fire.

P2: engine_bridge.rs codebook_index recovery used
set_bits.iter().next() which returns the LOWEST set bit, so when
codebook_index = 1234 with positive top_k containing 777, the
recovered headline was 777 not 1234. Fixed by storing
codebook_index explicitly in qualia[9] at encode (qualia[9..18]
was reserved per the agent's design) and reading it back at
decode. f32 represents any integer in [0, 2^24] exactly, so
u16 codebook_index round-trips losslessly. The set_bits iterator
now feeds only non-headline top_k slots.

P2: registry.rs hydrate_once_sync called parse_ttl_directory which
dropped ProvenanceBundles on the floor; the new attach_provenance
method was therefore never wired into production hydration.
MappingRow.attribute_sources stayed empty even when TTL contained
per-attribute dcterms:source. Fixed by adding
parse_ttl_directory_with_provenance — a single-walk variant that
returns proposals + bundles + failures — and threading bundles
into MappingRow.attribute_sources after the proposal append loop
(inside the existing write-lock to avoid deadlock with public
attach_provenance). Added HydrationReport.provenance_attached
counter so callers can verify the cascade-cols handoff actually
fires.

CI clippy: mul_threshold_profile_test.rs lines 45-47 + 55-57
asserted on const-evaluated profile field comparisons,
triggering -D clippy::assertions_on_constants in CI. Added
#[allow(clippy::assertions_on_constants)] on the two affected
tests; const-block migration is unnecessary because the asserts
are still useful as regression guards if the const profile
values are ever touched.

Files changed:
- crates/lance-graph-ontology/src/registry.rs (+22 / -3)
- crates/lance-graph-ontology/src/ttl_parse.rs (+57 / -3)
- crates/lance-graph-ontology/src/proposal.rs (+5)
- crates/lance-graph-callcenter/build.rs (+9 / -8)
- crates/lance-graph-contract/tests/mul_threshold_profile_test.rs (+5)
- crates/cognitive-shader-driver/src/engine_bridge.rs (+25 / -10)

Verification:
- cargo check -p lance-graph-ontology -p lance-graph-callcenter -p lance-graph-contract --tests: clean
- cargo check --manifest-path crates/cognitive-shader-driver/Cargo.toml --tests: clean (pre-existing unused-import warnings only)
- cargo clippy --manifest-path crates/lance-graph-contract/Cargo.toml --lib --tests -- -D warnings: clean (the original CI failure)

OGIT PR #3 codex findings (validator failures on namespace path
layout + missing required entity fields) are tracked as a separate
follow-up commit on the OGIT repo.

https://claude.ai/code/session_01WevBiZ3jzVocu8fBpTY8sq
AdaWorldAPI pushed a commit that referenced this pull request May 7, 2026
Append-only log update from agent-ogit-validator-fix (in flight).
Tracks the 2 codex P1 fixes for OGIT PR #3:
1. 10 BioPortal namespace stub layout: NTO/Medical/<NAME>/namespace.ttl
   -> NTO/Medical/<NAME>.ttl flat (file basename matches subject local name).
2. 25 SQL stubs missing required entity fields: dcterms:description,
   dcterms:valid, dcterms:creator, ogit:mandatory-attributes,
   ogit:optional-attributes, ogit:allowed.

Agent is mid-flight; the OGIT-side commit will land separately.

https://claude.ai/code/session_01WevBiZ3jzVocu8fBpTY8sq
AdaWorldAPI pushed a commit that referenced this pull request May 16, 2026
…ixes (CSI-7/8/9)

The Opus honest meta-review (final of the 12+1 fleet) graded sprint-11
+ Wave F at **B** (down from W-F10 Sonnet draft's B+) and surfaced 3
P0 integration gaps where worker output never reached the build path
because lib.rs / workspace registration was orphaned between worker
DONE and meta-review SPAWN. Fixed all three in this commit.

W-Meta-Opus review (~/sprint-log-11/meta-review-opus.md, 161 lines)
- Independent per-worker grades W-F1..W-F12 (W-F10 placeholders filled)
- CSI-7..13 cross-cutting findings missed by Sonnet drafts
- Sprint-11 grade: B (not B+) — Wave F integration discipline lapsed
- Recommends promoting E-META-10 (v1-API-under-v2 alias) to iron rule
  in CLAUDE.md alongside I-SUBSTRATE-MARKOV / I-NOISE-FLOOR-JIRAK
- Sprint-12 spawn recommendation: YES, conditional on Wave F + #386
  merge

P0 fix #1 — CSI-7: sigma-tier-router workspace registration
- Added `crates/sigma-tier-router` to `Cargo.toml` workspace `members`
- Removed the self-declared `[workspace]` table from
  `crates/sigma-tier-router/Cargo.toml` (it forced the crate into
  standalone mode, preventing parent-workspace inclusion)
- Validation: `cargo test --manifest-path crates/sigma-tier-router/Cargo.toml` — 12/12 tests pass; clean cargo check

P0 fix #2 — CSI-8: cognitive-shader-driver lib.rs gaps
- Added `pub mod attention_mask;` and `pub mod attention_mask_actor;`
  at the top of the pub-mod block (alphabetically before bindspace)
- W-F2 + W-F3 modules now reachable to downstream consumers; tests
  will execute on workspace cargo test

P0 fix #3 — CSI-9: ndarray hpc/stream/mod.rs (cross-repo, this commit
prepares ndarray for the companion change)
- Edited `/home/user/ndarray/src/hpc/stream/mod.rs` to register
  `pub mod qualia;` + `pub mod splat_field;` alongside the existing
  `pub mod inference;` (W-F5 had registered itself; W-F4/W-F6 left
  orphans)
- Re-exports: `QualiaI4Row`, `QualiaStream`, `SplatField`,
  `SplatFieldStream`
- Validation: `cargo test --lib hpc::stream` in ndarray — **18/18
  pass** (6 each × 3 streams)
- The ndarray-side change requires a separate commit + push to
  the `/home/user/ndarray` repo (its own git history); main thread
  will land that as a sibling PR

Aggregate Wave F test totals (verified via Opus review)
- Rust impl workers (W-F1/2/3/4/5/6/7): 60 tests across 7 files
- Governance/doc workers (W-F8/9/10/11/12): 5 markdown files, ~1500
  LOC docs
- Opus meta-review: 161 lines
- Total Wave F LOC: ~5000 (code + docs + plans)

Remaining gaps (per Opus review, NOT P0 but tracked)
- W-F2's local `type MailboxId = u32` shadow alias (CSI-10) → keep
  for back-compat; sprint-12 refactor consolidates
- E-META-10 promotion to iron rule → sprint-12 work
- ndarray companion PR for CSI-9 → sibling commit

https://claude.ai/code/session_01UwJuKqP828qyX1VkLgGJFS
AdaWorldAPI pushed a commit that referenced this pull request May 18, 2026
Wave-5 worker W-INT-1. New excluded crate at `crates/four-repo-demo/`
that demonstrates three of the four glue surfaces working together:

* `cognitive-shader-actor::CognitiveShaderActor` wrapping a real
  `SupervisableShader` (`SumShader`) — running-sum state via
  `Arc<Mutex<i64>>`, payload is `arrow_array::RecordBatch`.
* `lance-graph-contract::actor::SupervisableShader` trait consumed
  end-to-end (impl is real, not stub).
* `lance-graph-contract::ir::{Operator, OperatorTree, EngineHint,
  Cardinality}` — builds a 3-node tree (RangeScan → Filter →
  CognitiveApply) and computes total estimated cardinality.

The example at `examples/run_demo.rs`:
1. Spawns CognitiveShaderActor<SumShader> via ractor 0.15.13
2. Sends two ShaderMessage::Apply with single-row Int64 batches (5, 7)
3. Sends ShaderMessage::Drain
4. Prints the running sum (12) + the operator tree + cardinality estimate

Test results (cargo test --manifest-path crates/four-repo-demo/Cargo.toml):
* sum_shader_actor_running_sum ... ok
* operator_tree_has_three_nodes ... ok
* operator_tree_shape_correct ... ok
* operator_tree_total_cardinality ... ok
* 2 doc-tests pass
* All 6/6 tests pass

NOT demonstrated (and why, in the crate's lib.rs and README):
* Glue #1 surrealdb-ractor — needs a live SurrealDB
* Glue #2 lance-graph-tikv-provider — needs a TiKV cluster
* Glue #3 sea-orm-ractor — needs running Postgres + the derive

Workspace: added to `exclude` (heavy tokio + ractor + arrow deps).
.gitignore: `/crates/four-repo-demo/target/` to keep build artefacts
out of git.

Worker: W-INT-1. Wave-5 of the four-repo integration.
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