Skip to main content

Integral backend

The backend provides the domain-neutral graph substrate, access model, schema and App lifecycle, resident perimeter, and public API. It uses jvspatial with FastAPI; routes, validation schemas, services, Nodes, and Edges follow the repository's object-spatial conventions.

Local launcher

An installed wheel with the built UI supports integral up, status, logs, stop, backup, restore and upgrade. The launcher runs PostgreSQL in an isolated Python 3.12 helper environment and serves the workspace with real auth on loopback. integral up --profile desktop_single_user selects the persisted profile for a new managed installation; existing installations remain on their recorded profile and require a reviewed migration to change. See local installation. The Integral One desktop host owns Electron and its installers; Core contains no Electron or commercial App imports.

Develop

uv sync --frozen --extra dev --extra test
.venv/bin/python -m app.main

Run from this directory with private development settings configured. Python 3.11.5 or later is required (the patched Soup Sieve HTML selector dependency requires this minimum). The source API uses port 4000. The frozen lock is authoritative; do not substitute requirements.txt or unrestricted package-index resolution.

Navigate

api/ handles transport, schemas/ holds typed input/output, models/ declares graph participants and edges, services/ owns canonical mutations and lifecycle, and agentive/ supplies harness bindings, MCP, skills, staging, and work. Domain packages remain behind public facade contracts.

The agentive layer always loads. Default resident binding is Integral AI through Pydantic AI; Integral AI is the only resident harness. Core-only filtering removes domain packages from catalog admission, not the resident layer.

Use the backend reference, architecture, invariants, and deployment guide.

Search and indexing

PostgreSQL uses durable indexing jobs and local text-only ONNX/pgvector passages. Canonical writes enqueue work; readiness includes the actual encoder, store and current-source coverage. EMBEDDING_STORE_DRIVER=null selects graph-only reads. See declarative indexing and retrieval for deployment settings, rebuilds, API scope and real-database qualification. The legacy backfill_embeddings.py script fills the older single-vector adapter and does not populate the passage index.

Request liveness

Keep file I/O, package validation, schema compilation and document/image processing off the API event loop. Only pure work belongs in worker threads; graph operations and transactions remain in their owning task. Reuse one validated source snapshot per operation, coalesce concurrent reads, and retain fresh authorization checks. See I-RUNTIME-01.

Package imports read manifests without unpacking arbitrary ZIP contents. Limits are 50 MiB uploaded/expanded, 4096 ZIP members, 128 packages and 10 MiB per manifest. Deep or expanded YAML alias structures are rejected before compiler hashing. These parsing limits do not grant package publication authority.

jvspatial security compatibility

Metadata pins jvspatial 0.2.10 and pydantic-ai-harness 0.59.0. Runtime dependencies resolve from PyPI. Production OAuth requires its encryption key, and production auth rate limits stay active. Repair duplicate model credentials before creating their unique index and test actual PostgreSQL duplicates.

PostgreSQL account creation and admin/profile/workspace bootstrap serialize across serving processes and commit together. Ambiguous legacy account emails or bootstrap profiles require an explicit, data-preserving operator review; startup never selects or deletes a duplicate. See the concurrent-bootstrap recovery procedure.

PostgreSQL token validation coalesces the advisory last_accessed timestamp within one minute. It still locks and checks the current identity row on every validation, rereads current account authority and checks token revocation. A pending account disable retains its existing lock fence. Credential/role writes, explicit saves, expiry and refresh semantics are unchanged. The focused gate is tests/contract/test_authentication_current_state_postgres.py; this optimization does not cache an authentication or authorization decision.

PostgreSQL token validation coalesces the advisory last_accessed timestamp within one minute. It still locks and checks the current identity row on every validation, rereads current account authority and checks token revocation. A pending account disable retains its existing lock fence. Credential/role writes, explicit saves, expiry and refresh semantics are unchanged. The focused gate is tests/contract/test_authentication_current_state_postgres.py; this optimization does not cache an authentication or authorization decision.

make verify from the repository root is the broad local gate. PR smoke CI is narrower and runs without a developer .env. Database contracts and packaged-wheel checks provide separate evidence.

The broad gate runs the complete default backend suite once under CI conditions (TESTING=1, DEBUG=false, no dotenv), including its smoke tests. It uses at most four xdist workers, grouped by file, and preserves per-test database isolation. make verify-ci runs the smoke subset separately for a shorter feedback loop; make verify-pr also retains the independent contract and PostgreSQL lanes. Plain pytest remains serial.

Use make test-backend PYTEST_WORKERS=0 for serial debugging. Override PYTEST_MAX_WORKERS to tune the cap after measurement. The root backend and smoke targets print the slowest 25 test phases and save JUnit timings in backend/.pytest_cache/verification/{backend,smoke}.xml (ignored). These reports include setup and teardown time; compare identical selections and environments, and distinguish summed test time from elapsed parallel run time. Do not reduce coverage or replace real database tests to meet a timing target.

The contract lane uses two workers with per-test work stealing, so a large App contract file can be shared instead of becoming a serial tail. Set CONTRACT_TEST_WORKERS=0 for its serial baseline. make test-postgres-ci is also the CI graph/transaction command: it uses two independent worker databases, prime/log pools of one to three connections each, and separate JUnit reports for spikes, contracts, App jobs and authority. Set POSTGRES_TEST_WORKERS=0 for serial comparison. Run separate PostgreSQL invocations sequentially on a shared local service: the fixture recreates its fixed per-worker test databases. The real encoder/pgvector lane stays serial and separate from these graph tests.

Frontend tests cap workers at the smaller of four and the runner's available CPUs; the Vitest --maxWorkers option supports controlled comparisons. CI runs npm run lint:types once, then npm run build:assets. Standalone npm run build continues to check types and build assets together. make test-frontend is shared with CI and writes JUnit timings to ignored frontend/node_modules/.cache/verification/frontend.xml. CI retains that report alongside the contract and PostgreSQL artifacts and prints the available CPU/worker budget.

Successful database operations, including slow calls, do not emit log records. Metrics and slow-call counters remain available; failed operations emit structured ERROR records from jvspatial.

Managed desktop owner profile

integral up --profile desktop_single_user creates a new installation for one OS user. Profile changes require a reviewed migration; use a fresh home for a new desktop installation. The runtime passes the installation identity, controller secret and exact web origin as controlled startup settings. They must never come from request headers, package manifests or browser detection.

Core atomically creates the owner AuthUser, rooted User and private workspace on PostgreSQL at startup and refuses incompatible stores. Electron main obtains signed owner sessions through the possession-protected /api/auth/local-session endpoint. Browser Origin/fetch headers are refused on that endpoint; ordinary signup/password login and additional users are closed in this profile. /api/meta/deployment publishes read-only feature capabilities. HTTP/WS Host and Origin checks, canonical policy and grant services enforce the same restrictions on collaboration/public links/ownership transfer. Server defaults are retained.

The private integral-apps/ directory is discoverable independently of the single-owner restriction. Commercial entitlements, approval requirements, package trust and App data export retain their existing generic contracts. See docs/INVARIANTS.md I-DESKTOP-01 and the desktop engineering evidence under tasks/phase-one/evidence/ in the repository root. Licensing clearance and native installer release qualification are separate gates.

Desktop runtime qualification

Prepare portable resident assets with .ci/bundle_resident_harness.sh from the repository root before building the Core wheel, following RELEASING.md. The desktop bundler requires desktop_assets_available and desktop contract version

  1. Its ready probe waits for completed startup and registered audit storage; root /health alone does not qualify a desktop runtime.

Governed-read performance qualification

The scale fixture in tests/test_scale_query_benchmark.py uses an isolated PostgreSQL test database, independent 50,000/100,000 Entry populations with containment edges, and a known record oracle. Run it separately from competing test suites with INTEGRAL_TEST_DB=postgres, INTEGRAL_TEST_POSTGRES_DSN pointing to a disposable service, and INTEGRAL_RUN_SLOW_TESTS=1. Select it explicitly with pytest tests/test_scale_query_benchmark.py -m slow -s; the default marker selection excludes slow tests. It fingerprints the runtime sources, configuration and fixture so edits during a run invalidate its evidence. Selective lookup, record pages, governed pages, counts and digests collect 20 samples per cell; keyword lookup collects five. These are regression signals, not hosted release p95 qualification. A mathematically impossible passing cell fails early without presenting partial observations as a passing percentile. The 50K budgets remain fixed; 100K uses separate linear-work diagnostic ceilings. Mixed-permission checks cover exclusions, direct Entry grants, cross-workspace denial and live revocation through services, governed queries, SDK, MCP, HTTP and resident result projection. They do not qualify a hosted model conversation. The optional disabled-pushdown comparator runs independently and cannot alter the native cells. Missing request measurements fail the query-budget test.

Counts use fresh authority metadata rather than presentation payloads. Keyword candidates can be narrowed before hydration; the canonical matcher and graph admission still decide results. The bounded Unicode candidate derivation is coalesced and offloaded from asynchronous request handling. It introduces no embedding dependency and does not replace ranked hybrid search.

Direct Entry grants participate in workspace-wide reads and rollups even when the parent Track is unreadable. Those rollups use a neutral source label and omit Track navigation, keeping private parent names out of the result.

Core's session-mode PostgreSQL graph connections use the standard startup option plan_cache_mode=force_custom_plan to avoid repeated parameterized-read latency cliffs across uneven populations. This trades planning CPU for stable execution latency; qualify it on the deployment workload. Set INTEGRAL_POSTGRES_PLAN_CACHE_MODE=auto to restore PostgreSQL's adaptive choice. Explicit DSN options or plan_cache_mode take precedence, including options unrelated to planning. Transaction-pooler mode keeps its existing driver behavior and receives no additional session startup option.

Event worker

Run integral worker events beside the API to deliver durable audit facts and committed chat-message invalidations to each API process. See the worker contract for configuration, recovery and performance qualification.

The authenticated link-preview endpoint follows at most five redirects. Each HTTP or HTTPS connection resolves and validates all destination addresses, then connects directly to a validated numeric address. Private, loopback, link-local, mixed public/private, empty and malformed answers are refused. HTTPS keeps the original hostname for SNI and certificate verification. Link previews do not modify the process-wide DNS resolver or use environment HTTP proxies; deployments that require an outbound proxy must leave previews unavailable until a proxy with an equivalent destination-validation contract is supported. Operator-trusted internal MCP/model hosts do not grant link-preview access to private addresses. This change requires no stored-data migration.

Saved signature recovery

Core's personal signature vault stores and roots a replacement before retiring its previous attachment. PostgreSQL serializes replacements/deletes for one profile and commits the graph swap and file-cleanup intent together; an aborted transaction retains the original signature. Local development stores serialize writes but do not claim PostgreSQL rollback or distributed ordering.

integral worker events retries retired signature-file cleanup after commit. A live or restored attachment prevents deletion; provider failures retain pending intent. Cleanup has a bounded pass budget and never removes the replacement's file. Keep the worker running, preserve backups and reconcile stale cleanup facts before an operator restores a retired attachment. Conflicting current signature edges require review; Core does not arbitrarily delete or merge them. Additive cleanup-status indexing participates in the existing reviewed storage-upgrade plan; follow the offline migration and recovery guide for managed stores rather than resetting data. An uncommitted new binary can remain after an outer caller aborts; reconcile unreferenced uploads from a backup copy rather than deleting files by filename alone.

Metadata

Release files for integral-core 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for integral-core 0.1.1
File Size Uploaded Provenance Actions
integral_core-0.1.1.tar.gz 7.4 MB With provenance Details for integral_core-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for integral-core 0.1.1
File Interpreter ABI Platform Actions
integral_core-0.1.1-py3-none-any.whl Python 3 none any Details for integral_core-0.1.1-py3-none-any.whl

Total release size: 13.8 MB

Release files / integral_core-0.1.1.tar.gz

Download URL integral_core-0.1.1.tar.gz
Size 7.4 MB
Tags Source
SHA-256 checksum
How to use checksums
91637d1e5747321416bba27f60f50a9b81efccd938a7872191aec4c91ef830d6
BLAKE2b-256 checksum
How to use checksums
8597670b4813dceeca4c311decbc900f047cc190314d03000d44f0a711a772e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / integral_core-0.1.1-py3-none-any.whl

Download URL integral_core-0.1.1-py3-none-any.whl
Size 6.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
cda9e0dbac9353c0d314328a91e2af73e6357017ad667ae82e892270e2ca2e58
BLAKE2b-256 checksum
How to use checksums
1f90160dba0aa1a08cd60727e1fdd54175e8ffde55ea282b8d43e9865163ec4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for integral-core 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for integral_core-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page