Current Django AskLens surface

Status

This document maps the current Django implementation of the AskLens specification. It records exposure and evidence. The narrow 0.3.x compatibility boundary governs only the core rows explicitly marked governed below; every other surface remains provisional, optional, internal, or unsupported. This is an alpha line, not a 1.0 stability claim. Immutable public 0.3.2 is the current release. Public 0.3.1 is its immediate prior supported upgrade origin, 0.3.0 is an older checked origin, and version 0.2.0 is the immutable supported older 0.2.x upgrade origin.

PyPI 0.1.0a1 was a testing artifact only and is not a supported upgrade origin. These releases follow the support lifecycle.

Classification rules

Classification Meaning in this inventory
Governed Covered only by the exact 0.3.x boundary and change rules in compatibility.md; this is not broad or 1.0 stability.
Provisional Deliberately exposed current behavior outside that boundary. It may still change.
Optional Exposed only when an extra, adapter, or reference surface is selected. Optional does not mean stable.
Internal Package implementation or evidence surface, not a supported caller contract even when Python can technically import it.
Unsupported Deliberately excluded behavior or claim.

__all__, documentation, schema packaging, source/wheel parity, and passing tests are evidence of current exposure. Only the compatibility table accepts a 0.3.x scope; none independently accepts a deprecation window, wire compatibility, a 1.0 claim, or a stable support lifetime.

Python surfaces

Deliberate top-level and core imports

The package currently has 10 deliberate root exports:

CONTRACT_SCHEMA_NAMES
Metric
SemanticResource
__version__
build_capabilities
get_contract_schema
get_resource
list_contract_schemas
register
serialize_catalog

The registration/resource/metric imports among them are governed for 0.3.x; catalog/capability and contract-schema accessors remain provisional. Exposing an accessor does not make the returned schema governed or public specification material.

Other current import families are:

Import family Exact current exposure Classification and boundary
django_asklens.catalog CatalogRegistry, FieldSpec, Metric, SemanticResource, default_registry, register, get_resource, serialize_catalog, build_capabilities CatalogRegistry, Metric, SemanticResource, default_registry, register, and get_resource are governed for 0.3.x as documented; FieldSpec, serialization/capability helpers, broad constructors, and private attributes remain provisional. Public semantic keys remain separate from private Django bindings.
django_asklens.execution QueryResult, execute_plan Governed 0.3.x trusted execution surface within the exact documented boundary. execute_plan is the only public execution function; compilers, direct result construction, and private attributes are excluded.
django_asklens.observability ObservabilityEvent Governed 0.3.x immutable, content-free event type with four exact lifecycle outcomes and eight exact fields. Delivery helpers are private.
django_asklens.querying AskLensQueryResponse, execute_asklens_query_request Provisional shared question/help orchestration. Current response composition is explicitly alpha.
django_asklens.exceptions PublicAskLensError, public_error_payload, ten namespaced error categories Governed 0.3.x safe failure surface. Internal diagnostic exception classes, causes, and messages are not a caller compatibility promise.
django_asklens.access IsAuthenticated, can_access_asklens, and permission-gate resolution helpers Provisional access helpers. Hosts still own authentication and principal construction.
django_asklens.permissions RequestPermissionsGetter, default_request_permissions, get_request_permissions, resolve_request_permissions_getter Provisional host-integration helpers. Permission values remain server-owned.
django_asklens.contracts CONTRACT_SCHEMA_NAMES, ContractSchemaName, get_contract_schema, list_contract_schemas Provisional accessors over internal, unfrozen documents.
django_asklens.compiler.ResultColumn Importable compiler/result helper Internal for stable-surface decisions. Compilation and prepared/bound state are not public execution APIs.

Broad planning and result helper exposure

django_asklens.planning currently exports constants, Pydantic plan/provider models, parsing, validation, and planning helpers. The current names include:

SUPPORTED_DATE_TRUNCS
SUPPORTED_FILTER_OPERATORS
SUPPORTED_INTENTS
SUPPORTED_ORDER_DIRECTIONS
SUPPORTED_PRESENTATION_KINDS
AskLensProviderResponse
AskLensProviderResult
FilterSpec
GroupBySpec
MetricSpec
OrderBySpec
PlanLimits
PlannerProviderResponse
PlannerRequest
PlannerResult
PresentationSpec
QueryPlan
build_planner_request
get_asklens_provider_response_json_schema
get_query_plan_json_schema
parse_and_validate_query_plan
parse_asklens_provider_response
parse_planner_provider_response
parse_presentation
parse_query_plan
plan_asklens_response
plan_question
validate_query_plan

django_asklens.results currently exports:

SUPPORTED_PRESENTATION_KINDS
NormalizedPresentation
SerializedColumn
SerializedResult
SerializedRowsPayload
normalize_presentation
serialize_query_result
serialize_rows

These are provisional helper/model surfaces, not one frozen unit. Structural parsing and preview validation never authorize execution.

Provider imports

django_asklens.llms exposes DummyProvider, LLMMessage, LLMProvider, OpenAICompatibleProvider, and get_llm_provider. They are provisional provider integration surfaces. The dummy provider remains the default; live-provider quality, credentials, network behavior, and service terms are not package compatibility guarantees.

Settings

Source currently defines 36 current DJANGO_ASKLENS keys. They are grouped below to make a later decision explicit rather than accidentally stabilizing the whole settings mapping.

Family Current keys Classification
Scope and structural budgets DEFAULT_SCOPE_MODE, MAX_ROWS, DEFAULT_LIMIT, MAX_PLAN_BYTES, MAX_FILTERS, MAX_SELECTED_FIELDS, MAX_ORDER_BY, MAX_JOINS, MAX_RELATIONSHIP_EDGES, MAX_IN_VALUES, MAX_FILTER_VALUES, MAX_METRICS, MAX_GROUP_BY Provisional core/security configuration. Enforcement is mandatory even though exact defaults are implementation settings.
Access and request permissions API_PERMISSION_CLASSES, REQUEST_PERMISSIONS_GETTER Provisional host integration; trusted values stay server-owned.
Audit AUDIT_MODE, AUDIT_SINK, AUDIT_INCLUDE_CONTENT, AUDIT_DATABASE_ALIAS Provisional security/operations configuration. Metadata-only remains the default.
Observability OBSERVABILITY_SINK Governed default-off 0.3.x host callback. Exact events are content-free and best-effort; observability is not audit.
Provider/planning LLM_BACKEND, LLM_MODEL, LLM_BASE_URL, LLM_API_KEY, LLM_TIMEOUT_SECONDS, LLM_TEMPERATURE, LOG_LLM_IO, PROMPT_RESOURCE_SHORTLIST_LIMIT, DUMMY_PLANS, DUMMY_DEFAULT_PLAN Provisional provider configuration; secrets and live behavior remain host-owned.
Frontend FRONTEND_PERMISSION_CHECK, FRONTEND_TITLE, FRONTEND_SUBTITLE, FRONTEND_STARTER_QUESTIONS Optional reference-frontend configuration.
MCP MCP_ALLOW_ROW_RETURN, MCP_MAX_RETURNED_ROWS Optional adapter configuration; row return stays host-and-request gated.

Unknown settings behavior, default-value compatibility, and import-string handling are current implementation details except for the exact documented OBSERVABILITY_SINK=None behavior. This inventory does not freeze the remaining settings.

Commands and database-owned surface

Current operator commands are:

  • check_asklens — prints aggregate process-local registry counts and optionally fails on an empty registry with --fail-on-empty; it does not query application data or invoke scope providers.
  • redact_asklens_audit — preview by default; explicit --execute redacts eligible built-in audit content in bounded batches.
  • purge_asklens_audit — preview by default; explicit --execute irreversibly deletes eligible built-in audit rows with documented Django collector/signal effects and partial-progress limits.

They are provisional alpha operational commands with installed-core-wheel, SQLite, and representative PostgreSQL evidence. Their names, flags, output, exit behavior, and lifecycle guarantees are not accepted stable by this map. Custom sinks, backups, replicas, legal retention, scheduling, external signal effects, and complete user/tenant workflows remain host-owned.

The package owns SemanticQueryRun, the AskLensQuery admin proxy, and migrations 0001_initial and 0002_add_admin_query_proxy. These are current first-install artifacts. 0.1.0a1 was a testing artifact only and is not a supported upgrade origin. Do not record or handle previous-version schema changes. The packaged audit admin is an optional view-only operations surface, not a universal host authorization or storage boundary.

Optional HTTP surface

Installing the api extra exposes five view classes—AskLensAPIView, CatalogView, CapabilitiesView, QueryView, and QueryRunDetailView—and four routes:

Route Current relationship Classification
GET /asklens/catalog/ Exact current permission-scoped catalog document Optional alpha adapter surface
GET /asklens/capabilities/ Exact current machine-capabilities document Optional alpha adapter surface
POST /asklens/query/ Shared orchestration wrapper containing exact current plan/result or catalog/capabilities/error children where applicable Optional alpha adapter surface
GET /asklens/runs/<int:pk>/ Policy-filtered audit representation, not a query/result/error document Optional alpha operations surface

Current statuses, headers, strict request keys, error envelopes, member/run opacity, audit effects, and source/wheel parity are characterized in the HTTP/internal-envelope crosswalk. That current evidence does not accept route, method, status, envelope, serializer, or view-class compatibility for a stable release.

DRF remains absent from core imports. Optional installation must not weaken the trusted execution facade, current request authorization/scope, structural budgets, audit privacy, or zero-application-data-SQL rejection.

Optional MCP surface

django_asklens.mcp currently exposes:

DEFAULT_MCP_PLAN_QUESTION
MCP_ROW_RETURN_POLICY
AskLensMCPToolSet
RequestFactory
apply_mcp_row_policy
asklens_capabilities
asklens_describe_resource
asklens_execute_plan
asklens_query
asklens_query_plan_schema
asklens_validate_plan
create_fastmcp_server
mcp_max_returned_rows
mcp_row_return_allowed

These are optional alpha surfaces. The framework-neutral helpers/wrapper and the FastMCP bridge may receive different stability decisions; importability from one module does not require one compatibility tier. asklens_execute_plan and asklens_query converge on trusted execution. Validation is not authorization, client policy selectors remain excluded, and rows remain omitted unless both host policy and the tool request allow them.

The MCP extra and current source/wheel checks are evidence of optional packaging and behavior, not production authentication, transport security, independent client compatibility, or a stable wire protocol.

Serialized documents

The package contains five current JSON documents and Draft 2020-12 schemas:

  • catalog
  • query-plan
  • capabilities
  • result
  • error

They remain internal, draft, unfrozen, and unversioned. They are the machine-readable AskLens specification documents. Do not add document versions, revisions, or extension negotiation. A schema-valid plan remains untrusted and must enter execute_plan().

HTTP and MCP wrappers are not automatically identical to these documents. Run detail is an audit representation. Help, routing, presentation, row-omission, and audit-reference members remain adapter concerns.

Internal and unsupported surfaces

Internal surfaces include:

  • prepared/bound execution state and execution-context identity/revision;
  • compiler functions, ORM aliases, Django bindings, expressions, QuerySets, model labels, scope providers, and diagnostic causes;
  • private orchestration, adapter, audit, schema-generation, and serialization helpers whose names begin with _;
  • conformance harness setup, trusted clocks, synthetic scenario mappings, and test-project implementation details; and
  • local .agents planning/evidence files.

Unsupported behavior and claims include:

  • LLM-generated or caller-supplied raw SQL;
  • mutations, arbitrary joins/expressions, cross-resource plans, and automatic model/field exposure;
  • client-controlled identity, permissions, tenant IDs, scope, clock, audit routing, or prepared state;
  • treating preview validation as an execution token;
  • backend-neutral, NDC, Drizzle, generated-SDK, public-specification, production-certification, or independent-security-review claims; and
  • treating SQLite or representative PostgreSQL tuples as every-database or Cartesian production evidence.

Current posture

The exact registration, execution, public-error, and observability rows named in the 0.3.x compatibility boundary are governed only for that line. HTTP, MCP, admin, frontend, provider, document, broad helper, and adapter surfaces remain provisional, optional, or internal. Current posture:

  • this is a narrow alpha compatibility policy, not a 1.0 stability claim;
  • immutable public 0.3.2 is the current alpha, public 0.3.1 is its immediate prior supported upgrade origin, and 0.2.0 remains the first supported alpha and supported older 0.2.x origin;
  • 0.1.0a1 was a testing artifact only; it is not a supported upgrade origin;
  • the five serialized documents stay internal, unversioned, and without extension negotiation; do not add document versions;
  • do not record or handle schema changes or previous document shapes;
  • persisted and previously validated plans remain untrusted and require current execute_plan() revalidation;
  • there is no fixed deprecation window or compatibility promise beyond 0.3.x;
  • host-owned responsibilities remain outside the package guarantee; and
  • raw SQL remains unsupported.

See the AskLens specification.