Extend an existing boundary¶
Choose the owning subsystem in the code map, read its tests, then change the smallest shared layer that gives UI, CLI and MCP the same result. The Python interfaces here are internal; check the baseline source when changing signatures.
Extend a parser¶
The existing signatures are:
parse_sql(content: str, dialect: str | sqlglot.Dialect = '') -> ParseResult
parse_sas(content: str, library_mappings: dict[str, str] | None = None,
macros: dict[str, str] | None = None, sql_dialect: str = '') -> ParseResult
parse_csv(content: str, path: str, sample_size: int = 25) -> ParseResult
- Add the smallest positive source fixture and an ambiguous/unsupported negative case in the appropriate SQL, SAS or transformation test module.
- Return
Operation/AssetReffacts with exact original code and inclusive line coordinates. Put direct references inUsage; put value/role derivations in the established derivation shape. UseDiagnosticfor uncertainty instead of inventing a dependency. - Keep catalog/job/cross-file resolution in asset_identity.py and services.py. A parser must not open a Store, contact a provider or execute imported text.
- If a new format is necessary, extend admission/extension choices in
ingestion.py,
_parse_inventoryin services, source-selection UI and CLI options. A new parser file alone does not make the format reachable. - Bump
PARSER_VERSIONin services when extraction semantics or cached result shape changes. VerifyParseResult.to_dict/from_dict, warm-cache behavior, source-version evidence and persisted publication, not only the parser's return value.
For CREATE TABLE mart.x AS SELECT id FROM raw.y;, the expected relationship is raw.y → mart.x
with the exact statement as evidence. If the table name comes from an unknown runtime
expression, the expected output is an explicit gap/diagnostic, not a guessed table. See
static-wrapper regressions and
schema regressions for literal versus dynamic boundaries.
Extend dbt support¶
Treat a dbt input as a project with resource identities, packages, versions and source origins, not just SQL files. Add fixture cases before extending supported artifact versions.
| Change | Owning modules | Required counterexample |
|---|---|---|
| Import a new resource location | dbt/imports.py, yaml.py, discovery.py |
outside-root, symlink, excluded profile/secret and bounded-input cases |
| Recognize a resource/ref/config | resources.py, templates.py, resolution.py |
conditional/dynamic/package/version ambiguity remains candidate or unresolved |
| Accept artifact structure | artifacts.py, evidence.py, models.py |
unsupported schema version and mismatched original/generated evidence |
| Publish or report new facts | analysis.py, persistence.py, service.py, shared services |
atomic publication, unchanged source hash, cross-interface access |
| Supply AI context | ai_context.py, shared AI planner |
context-only evidence cannot masquerade as authoritative execution or parser answers |
Static ref/source evidence and generated SQL evidence retain different origins. Never run
dbt, import resource Python, render imported Jinja or open profiles.yml to resolve a gap.
Read dbt support, resource tests,
artifact tests, store tests and
AI context tests.
Extend a provider protocol¶
llm.py owns PROVIDERS, validated Profile, Adapter request/response
branches and model discovery. Existing completion interfaces include:
Adapter.completion_request(p, system, user, *, stream_analysis=False)
Adapter.complete(self, system: str, user: str, *, prepared_request=None) -> tuple[str, dict]
Adapter.models(self) -> list[str]
Adapter.model_catalog(self) -> list[ModelDescriptor]
Adapter.model_details(self, model: str) -> ModelDescriptor
Add a protocol identity/default endpoint only when an existing compatible protocol cannot
express it. Cover endpoint URL, request body, authentication headers, discovery, normal/error/
stream responses, timeout/cancellation and redaction with HTTPX MockTransport. Return the
same content/usage contract and sanitized ProviderError behavior. Remote HTTP, embedded URL
credentials and query/fragment parameters are rejected by Profile; local HTTP is allowed
only for loopback. A key field is a reference name, never a persisted secret value.
Update model_capabilities.py for capacity provenance, provider_service.py for validated routing/policy and connections.py only if the new protocol genuinely needs a new credential binding. Complete request-envelope counting must still agree between preview, dispatch and resume. Keep offline protocol tests distinct from live-provider qualification. Read LLM tests, transport tests, provider parity and capacity tests.
Change AI extraction or recovery¶
Read the current protocol flow before editing the coordinator. Add a saved-run/resume regression when changing source units, prompts, schemas, model allocation, context restoration, request attempts, consolidation membership or linking. The analysis coordinator pins these contracts; a model schema field alone does not make a legacy option supported.
Current validate_extraction checks source-reference identity/hash/bounds, own-source
operation evidence, schema and internal consistency before results can be composed. It does
not use the static parser to approve the model's meaning; AI semantics remain inferred.
Preserve semantic_coverage_not_proven and complete=False in AI reports. Keep legacy
ai_semantic/validate_project_response and focused-assistance guards distinct from this path.
Durable request attempts and checked file results are reusable
checkpoints; they are not the published workspace graph. A failed/cancelled network attempt
must not publish partial unvalidated facts. Preserve explicit coverage for unresolved work
when a valid partial graph is committed. Retrying unresolved work should reuse successful
checkpoints and cumulative spending while enforcing freshness and current authorization.
Useful tests: independent extraction, resumable files, replay, consolidation, partial recovery, saved publication.
Add a service operation and transport¶
AgentService.call(action, workspace_id='', options=None, **arguments) is the shared action
boundary. Add the handler to its existing subsystem mixin when appropriate rather than
putting a second implementation in each transport.
- Define input validation and result shape, then register its read/write classification.
- Apply workspace scope and access revocation. Source-bearing output needs source permission; mutation needs both launch and workspace write grants. Configuration/network/application/ admin effects have additional independent grants.
- Bound serialized output and pagination. Reuse
QueryOptionsand revision/query-bound cursors. Reject invalid/oversized input with stableAgentErrorcodes; never return broken JSON fragments. - Wire the Typer adapter in
cli.pyoragent/cli_*.pyand typed tool inagent/mcp_server.py. Keep local-admin destructive maintenance out of MCP. - Update capability/parity inventories and the command/tool reference tables. Verify service, CLI and MCP all give the same facts with both allowed and denied policies.
For a read that returns source excerpts, a denied source policy should fail before content is loaded or serialized. For a report without source, summary output should remain bounded and should not acquire source text merely because a neighboring service can access it. See access tests, MCP tests, parity contracts, documentation tests.
Add an exporter or report¶
Use committed facts and retained source versions. exports.py serializes graphs/reports/source bundles; excel_exports.py formats path reports; graph_image_service.py snapshots image inputs; artifacts.py owns managed artifacts.
Define the input report, returned bytes/text plus metadata, traversal/input/output/time bounds, source-disclosure choice and failure cleanup before adding a format. Preserve all evidence for collapsed temporary paths and surface incomplete coverage. HTML/SVG/JS must escape or safely serialize imported values; XLSX must write literal text rather than inferred formulas. A formatter must never trigger analysis or network calls. Test hostile labels, missing nodes, parallel evidence, cycles/limits, stale analysis and interruption cleanup. Use export tests, Excel tests, image tests and artifact tests.
Add a setting, migration or UI page¶
Settings belong in the existing validated section model and revision-checked service;
portable workspace preferences, runtime secrets, launch grants and app-wide configuration
are different scopes. Update transfer/schema/permission tests with the form or CLI adapter.
For schema changes add a numbered transactional migration in Store and synchronize table
ownership with backup/restore, cleanup, integrity and history protections. Test upgrade from
an older home plus backup/restore; never reset an existing user database as a migration.
For a page, register st.Page in app.py, reuse ui.common selectors/source views and keep
service calls independent of Streamlit. Verify AppTest and browser JS separately. In session
state retain controls and durable IDs rather than copied raw source or provider responses.
Relevant suites: workspace settings,
Store, maintenance,
UI, navigation.