Skip to content

D-TEH-1: move bridge_gate to lance-graph-contract; callcenter drops its thinking-engine dependency - #1139

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/medcare-rs-continue-6nhbxn
Sep 2, 2026
Merged

D-TEH-1: move bridge_gate to lance-graph-contract; callcenter drops its thinking-engine dependency#1139
AdaWorldAPI merged 1 commit into
mainfrom
claude/medcare-rs-continue-6nhbxn

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Sep 2, 2026

Copy link
Copy Markdown
Owner

First code wave of thinking-engine-harvest-closure-v1 (W1), after #1138. One commit (ec62e98). Cuts the one REQUIRED dependency around the ALU artery without touching the artery.

What moved

thinking_engine::bridge_gatelance_graph_contract::bridge_gate, as one module with identical shapes, all seven public items together: CognitiveOpKind, CognitiveAuthResult (+ is_allowed / is_denied), CognitiveBridgeError, auth_to_result, the CognitiveBridgeGate: Send + Sync trait, PassthroughGate, DenyAllGate. Zero-dep (std only). Its 9 unit tests moved with it. thinking_engine::bridge_gate is now a pub use shim so every old path still resolves; the engine-side pure_ops_dont_touch_gate test stays there, next to the lens modules it calls.

Consumer rewrite

  • lance-graph-callcenter/src/cognitive_bridge_gate.rs: both import sites → lance_graph_contract::bridge_gate.
  • pure_ops_emit_zero_audit_events: the four thinking-engine lens lookups are replaced by the crate's own gate-free helpers (prefetch_from_u8 over every depth, auth_to_result over every verdict, the verdict predicates); the real RecordingSink and the Chinese-wall counter are still asserted at zero, so the test measures a real sink, not the absence of a gate. The doc comment names where the engine-side half of the claim now lives.
  • lance-graph-callcenter/Cargo.toml: the thinking-engine path dependency removed; three doc comments updated.

Falsifier (run before the rewrite)

With ONLY the dependency line removed, cargo check -p lance-graph-callcenter --all-targets fails with exactly six E0433 at the six crossing sites (2 imports, 4 lens calls). After the move it builds and passes.

Measured dependency edge

before after
cargo metadata callcenter deps containing thinking ['thinking-engine'] []
crossing sites 6 (3 symbols at 2 production imports; 4 test-only lens calls) 0
remaining workspace consumer of thinking-engine callcenter (required) + driver (with-engine, optional) driver with-engine only (the ALU's engine hook)

Verification

  • contract: 1303/1303 (bridge_gate module 9/9)
  • callcenter: 156/156, pure_ops_emit_zero_audit_events green
  • cargo clippy -p lance-graph-contract -p lance-graph-callcenter --all-targets -- -D warnings clean; cargo fmt clean
  • cognitive-shader-driver: default build green; --features with-engine build green
  • thinking-engine (excluded; --manifest-path): lib builds; shim test 1/1
  • ALU artery untouched, by empty git diff on thinking-engine/src/dto.rs, cognitive-shader-driver/src/engine_bridge.rs, contract/src/cognitive_shader.rs, mailbox_soa.rs, and the driver manifest. StreamDto / PerturbationDto / BusDto / ThoughtStruct and the engine_bridge mappings are byte-identical.
  • grep census: no thinking_engine:: reference remains in callcenter source (comments only); every bridge_gate:: importer resolves to the contract.

Stop condition honoured

Step 6 (re-point the driver's with-engine edge) is NOT done: D-TTV-1 is Queued and the engine hook still lives in thinking-engine, so there is nothing to re-point it at. No D-TEH-2..5, D-HOUSE-1, D-ARW, ghost harvest, calibration migration, M8 or crate retirement started.

Board

LATEST_STATE contract-inventory delta; PR_ARC entry; STATUS_BOARD D-TEH-1 → Shipped with the before/after edge; closure plan W1 + D-TEH-1 rows; SUPERSESSION-INDEX regenerated last. An unrelated crates/thinking-engine/Cargo.lock churn produced by the standalone build was reverted, not committed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added a shared cognitive authorization contract supporting operation classification, allow/deny/escalate outcomes, authorization errors, and configurable gate behavior.
    • Added standalone allow-all and deny-all gate options for authorization flows.
  • Compatibility

    • Existing authorization paths remain supported while using the shared contract implementation.
  • Bug Fixes

    • Updated bridge authorization flows to consistently use the shared contract behavior.
  • Tests

    • Expanded coverage for authorization decisions, error handling, predicates, formatting, trait usage, and gated flows.

…ts thinking-engine dependency

First code wave of thinking-engine-harvest-closure-v1 (W1). The
zero-dep cross-tenant authorization contract — CognitiveOpKind,
CognitiveAuthResult, CognitiveBridgeError, auth_to_result, the
CognitiveBridgeGate trait, PassthroughGate, DenyAllGate — moves from
thinking_engine::bridge_gate to lance_graph_contract::bridge_gate as one
module with identical shapes and its 9 unit tests. thinking-engine keeps
a pub-use shim so every old path resolves, and keeps the engine-side
pure_ops_dont_touch_gate test next to the lens modules it calls.

lance-graph-callcenter re-imports from the contract at both sites and
its pure_ops_emit_zero_audit_events test now exercises the crate's own
gate-free helpers (prefetch_from_u8 over every depth, auth_to_result over
every verdict, the verdict predicates) with the real sink and counter
still asserted at zero; the four thinking-engine lens lookups are gone.
The path dependency is removed.

Falsifier: with the dependency line removed and nothing else changed,
callcenter fails at exactly the six crossing sites (E0433 x6). After the
move it builds and passes 156/156.

Verified: contract 1303/1303; callcenter 156/156 (named test green);
clippy -D warnings clean on both crates; fmt clean; cognitive-shader-
driver builds default and with-engine; thinking-engine lib builds and the
shim test passes; cargo metadata shows no thinking-engine dependency for
callcenter; git diff is empty on dto.rs, engine_bridge.rs,
cognitive_shader.rs, mailbox_soa.rs and the driver manifest (the ALU
artery is untouched).

Not done by stop condition: re-pointing the driver's with-engine edge
waits on D-TTV-1 (Queued); the engine hook still lives in thinking-engine.

Board: LATEST_STATE inventory delta, PR_ARC entry, STATUS_BOARD D-TEH-1
Shipped, closure plan W1 + D-TEH-1 rows, SUPERSESSION-INDEX regenerated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_054892f7-0771-4a9f-abf2-e967de4929ad)

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: e648177f-afd2-47e2-91ed-2d82e3767d66

📥 Commits

Reviewing files that changed from the base of the PR and between 1a4360d and ec62e98.

📒 Files selected for processing (10)
  • .claude/board/LATEST_STATE.md
  • .claude/board/PR_ARC_INVENTORY.md
  • .claude/board/STATUS_BOARD.md
  • .claude/plans/thinking-engine-harvest-closure-v1.md
  • crates/lance-graph-callcenter/Cargo.toml
  • crates/lance-graph-callcenter/src/cognitive_bridge_gate.rs
  • crates/lance-graph-callcenter/src/lib.rs
  • crates/lance-graph-contract/src/bridge_gate.rs
  • crates/lance-graph-contract/src/lib.rs
  • crates/thinking-engine/src/bridge_gate.rs

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The bridge gate contract moved from thinking-engine to lance-graph-contract. The former path now re-exports the API. Callcenter imports the contract directly and removes its engine dependency. Tests and project records were updated.

Changes

Bridge gate migration

Layer / File(s) Summary
Contract API and implementations
crates/lance-graph-contract/src/bridge_gate.rs, crates/lance-graph-contract/src/lib.rs
Added authorization types, the CognitiveBridgeGate trait, default gate implementations, conversion helpers, and tests.
Compatibility and consumer migration
crates/thinking-engine/src/bridge_gate.rs, crates/lance-graph-callcenter/..., .claude/board/..., .claude/plans/...
Re-exported the contract API from thinking-engine, updated callcenter imports and tests, removed the direct engine dependency, and recorded the shipped migration with deferred driver work.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to ec62e

The change relocates the bridge-gate contract while preserving compatibility and removes the callcenter's engine dependency; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: claude

Poem

A rabbit hops where bridge gates stand,
New contracts bloom across the land.
Old paths point to places new,
Tests thump softly, green and true.
The callcenter sheds its engine chain.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the bridge_gate migration and the removal of the callcenter's thinking-engine dependency. It accurately summarizes the main changes.
Docstring Coverage ✅ Passed Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (5 skipped: 5 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 90.91% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 5 files. (5 skipped: 5 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

@AdaWorldAPI
AdaWorldAPI merged commit 4bbaa79 into main Sep 2, 2026
9 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Sep 2, 2026
GitHub reported #1140 in conflict after main moved 7 commits (#1138/#1139).
The local three-way merge is CLEAN — GitHub's detector is more conservative
than git's on two-sided prepends to the same append-only board file.

Verified on the merged tree rather than assumed:
- EPIPHANIES.md: 25344 lines >= both parents (25319 / 25291); my entry present
  exactly once; main's three newest headings present exactly once each;
  newest-first order preserved.
- main touched none of the files this branch changes (jc/, sigker/, .cargo/,
  TECH_DEBT.md); its ec62e98 moves bridge_gate into lance-graph-contract.
- Supersession index regenerated on the MERGED board: byte-identical, current.
- jc release: 127 + 13 tests green. lance-graph-contract release: 1302 green.

Merge, not rebase: the branch's five commits are under review and the
operator ruled no force-push on it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCGhDYoQBXs3poaR7sFuqp
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