Skip to content

Implement Workspace Lineage Ledger and Studio Audit Portal#1790

Closed
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
jules/workspace-lineage-audit-portal-js1-41b4e3d9-26a5-43bd-9585-092d08d48a41
Closed

Implement Workspace Lineage Ledger and Studio Audit Portal#1790
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
jules/workspace-lineage-audit-portal-js1-41b4e3d9-26a5-43bd-9585-092d08d48a41

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

Context & Rationale

Clinical research deployments require strict adherence to FDA compliance regulations (such as 21 CFR Part 11), which mandate tamper-evident audit logging and execution lineage mapping. Previously, clinical clients had to construct custom wrappers around our execution engine to achieve this compliance, creating friction and blocking seamless deployments.

To resolve this, we have introduced a centralized, local Workspace Lineage Ledger coupled with an interactive Studio Audit Portal. This provides built-in, cryptographically verifiable runtime audit logging and compliant electronic signature workflows directly within our UI, removing the need for third-party wrappers while guaranteeing absolute data localization.


Key Decisions & Technical Implementation

1. Core Runtime Capture & Context Isolation

  • What: Added runtime interceptors to /app/promptops/promptops/engine.py (specifically within the workflow execution loops and prompt simulations).
  • Why: To capture deep execution metadata (safety evaluations, validation results, PII redactions, and inputs) reliably in multi-threaded environments, we utilized a thread-safe, isolated execution context using python's threading.local(). This ensures that concurrent runs never leak or corrupt each other's audit trails.

2. Local, Tamper-Evident Ledger File

  • What: Created /app/promptops/promptops/ledger.py which manages /app/workspace_ledger.json.
  • Why: To respect strict client data localization constraints, the ledger is stored entirely locally. Each ledger entry contains a cryptographic SHA-256 signature calculated from the preceding entry's signature combined with the current state. This establishes a secure, tamper-evident hash chain where any unauthorized manual modification or deletion of past entries is immediately detectable.

3. Interactive Studio Audit Portal & Electronic Signatures

  • What: Implemented a Streamlit-based UI at /app/studio/studio/pages/5_🔍_Audit_Portal.py.
  • Why:
    • Timeline & Filtering: Displays a reverse-chronological timeline of execution history with instant filtering (by status, success, and signed state) so compliance auditors can easily inspect historical data.
    • Compliant Electronic Signatures: To satisfy FDA regulations, the system never auto-signs executions. We implemented an interactive, authenticated form requiring clinical operators to manually enter credentials and validation comments. Signing a run commits the signature and safely recalculates the downstream cryptographic ledger chain.

4. Automated Tamper Detection

  • What: Integrated automatic chain verification using validate_ledger_integrity on portal load.
  • Why: If a manual database or file edit breaks the ledger's integrity chain, the UI immediately displays a highly visible warning banner (🛑 INTEGRITY VIOLATION DETECTED) detailing the broken index, preventing unauthorized alterations from going unnoticed.

Verification & Testing

  • Unit & Integration Tests: Developed an extensive test suite at /app/tests/test_ledger.py covering:
    • Successful runtime capture and metadata output.
    • Tamper detection and chain validation failures.
    • Multi-operator electronic signature applications.
  • UI Testing: Added Streamlit integration tests to /app/tests/test_studio.py to verify error-free page rendering.
  • Results: All 72 tests passed successfully in under 3 seconds.

@google-labs-jules
google-labs-jules Bot requested a review from fderuiter as a code owner July 23, 2026 14:35
@fderuiter fderuiter closed this Jul 23, 2026
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.

1 participant