Files
ss-tools/docs/adr/ADR-0001-module-layout.md
busya 731aaaa8df feat(mcp): 050 unified MCP interface — parity tools, durable gates, authoring E2E, assistant decommission
044 provider runtime completion (pre-staged workstream): capacity/operator
stores, provider ops/protocol/reconciler/dispatch revalidation, exploration
sandbox runtime, alembic 0014-0016, live canary evidence (browser provider
6/6 against the live stand).

050 Phases 0-2: RBAC FastMCP server with a 45-tool explicit catalog,
OAuth/DCR transport guards with bounded bodies, per-call provenance
(McpToolInvocationRecord), durable ActionApprovalGate + CAS decide +
leased/fenced poller, authoring workspace ops, bounded-response discipline,
hidden-vs-gated matrices.

Parity domains (T012-T014): gated git/deploy/migration/backup/llm tools with
reviewed dispatch adapters in explicit poll chains; Superset reads/writes with
a dedicated plugin:superset_sql risk class (terminal PROD denial via the
canonical execution-policy criterion, hardened danger-SQL guard covering
INTO/CALL/SET/REFRESH/file primitives/multi-statement); baseline 037 tools
over the shared REST-surface services.

Evidence (T016/T023/T028): REST-vs-MCP field parity on shared 037 fixtures;
vertical E2E from tools/list through registry revision activation with real
scenario:EDIT RBAC; sandbox-to-revision promotion E2E with unsafe-payload and
caller-digest rejection; dispatcher soak (three poll cycles, exactly-once).

Orthogonal QA+security audit hardening: enforced response_limit fail-closed
envelope, poisoned-exploration fail-closed (EXPLORATION_TARGET_UNRESOLVED),
sha256 exploration evidence digests, actor-UUID task ownership, is_active
guard on baseline consume, 038 resolver description=None selector fix.

Phase 3/4 decommission: HandoffSurface behind the MCP_DECOMMISSION flag,
then unconditional removal — agent/ service tree, chat components/models/
stores/types, gradio proxies (vite + nginx), agent service in run.sh,
docker-compose profiles, build.sh bundles; /agent renders the handoff only.
Docs: AGENTS.md/INSTALL.md two-service rewrite; 036-047 drift amendments
marked done; WORKSTATE checkpoints with all evidence.

Suites: backend 11199 passed / 240 skipped / 1 xpassed; frontend 3454 passed
(197 files), lint 0 errors, build OK; browser E2E login+handoff 6/6 twice on
the isolated compose stack (no 7860); ruff/compileall clean.

Misc: gitignore hardening (tmp/, tool model cache); E2E selector repairs
(nav strict-mode, invalid-credentials passthrough detail).
2026-09-03 07:37:14 +03:00

6.6 KiB
Raw Blame History

@{ Doc.Adr.ADR0001 [C:1] [TYPE ADR]

@STATUS PARTIALLY IMPLEMENTED

@BRIEF Define the canonical project directory layout, module boundaries, and naming conventions for the superset-tools repository. This ADR is the root structural authority — all other ADRs and feature plans derive their file placement from it.

@RELATION CALLS -> [Doc.Adr.ADR0002]

@RELATION CALLS -> [Doc.Adr.ADR0003]

@RELATION CALLS -> [Doc.Adr.ADR0016]

@RELATION CALLS -> [Doc.Adr.ADR0005]

@RELATION CALLS -> [Doc.Adr.ADR0006]

@RATIONALE A single authoritative layout prevents module sprawl, cyclic dependencies, and agent confusion during long‑horizon speckit workflows. Without this, every feature spec must re‑debate where to place files, leading to inconsistent structures and broken tooling assumptions.

@REJECTED Monorepo with per‑feature packages (e.g. packages/llm‑plugin/) — rejected because the repository has two top‑level runtime targets (Python backend, Svelte frontend) with shared Docker/configuration infrastructure. Package‑style nesting would double the directory depth without adding isolation value.

@REJECTED Flat src/ root — rejected because Python and JavaScript toolchains have incompatible project roots (pyproject.toml vs package.json), and mixing them in one top‑level src/ would force cross‑toolchain contamination.

Decision

The repository uses a two‑platform, top‑level separation:

superset-tools/                          # Repository root
├── backend/                       # Python 3.13+ / FastAPI application
│   ├── src/
│   │   ├── api/                   # FastAPI route modules (one file per route group)
│   │   ├── core/                  # Core services: task_manager, auth, migration, plugin_loader
│   │   ├── models/                # SQLAlchemy ORM models (one file per entity group)
│   │   ├── services/              # Business logic (orchestration, validators, transformers)
│   │   ├── schemas/               # Pydantic request/response schemas
│   │   └── app.py                 # FastAPI application factory
│   ├── tests/                     # pytest test suite (mirrors src/ structure)
│   ├── pyproject.toml             # Build & tool configuration
│   └── requirements.txt           # Production dependencies
├── frontend/                      # SvelteKit application
│   ├── src/
│   │   ├── routes/                # SvelteKit page routes (file‑based routing)
│   │   ├── lib/
│   │   │   ├── components/        # Reusable Svelte 5 components
│   │   │   ├── stores/            # Svelte 5 rune stores ($state)
│   │   │   └── api/               # API client modules (typed fetch wrappers)
│   │   └── i18n/                  # Internationalization dictionaries
│   ├── tests/                     # vitest test suite
│   ├── package.json               # Runtime + dev dependencies
│   ├── svelte.config.js           # SvelteKit configuration
│   └── vite.config.ts             # Vite build configuration
├── docker/                        # Dockerfiles for backend, frontend, nginx
├── docker-compose.yml             # Development Docker Compose
├── docs/
│   ├── adr/                       # Architecture Decision Records (this file)
│   ├── design/                    # Detailed design documents
│   └── ...                        # Operational docs (installation, settings, etc.)
├── specs/                         # Feature specifications (speckit artifacts)
│   └── NNN‑feature‑name/
│       ├── spec.md
│       ├── plan.md
│       ├── research.md
│       ├── data-model.md
│       ├── quickstart.md
│       ├── contracts/
│       │   └── modules.md
│       └── tasks.md
├── scripts/                       # Shell utility scripts
├── .specify/                      # Speckit workflow framework
│   ├── memory/constitution.md     # Repository constitution
│   ├── templates/                 # Speckit artifact templates
│   └── scripts/bash/              # Speckit helper scripts
├── .opencode/                     # OpenCode AI agent configuration
│   ├── command/                   # Speckit command definitions
│   ├── skills/                    # GRACE semantic protocol skills
│   └── agents/                    # Specialized agent definitions
└── .github/                       # GitHub Actions workflows

Module Boundary Rules

  1. backend/src/api/ — route handlers only. Must not contain business logic, ORM queries, or schema definitions. Each file = one FastAPI APIRouter group.
  2. backend/src/core/ — singleton services with application‑scoped lifetime (auth manager, task scheduler, plugin loader, migration engine). Must not import from api/.
  3. backend/src/services/ — stateless or request‑scoped business logic. May depend on models/, schemas/, and core/. Must not depend on api/.
  4. backend/src/models/ — SQLAlchemy ORM declarations only. No business logic, no API dependencies.
  5. backend/src/schemas/ — Pydantic models for validation/serialization. No ORM dependencies, no business logic.
  6. frontend/src/routes/ — SvelteKit pages. Import components from lib/components/, state from lib/stores/, API clients from lib/api/.
  7. frontend/src/lib/components/ — reusable components. Must not import from routes/ (prevents circular dependencies).
  8. frontend/src/lib/stores/ — Svelte 5 $state rune stores. Must not import from routes/ or components/.

File Naming Conventions

  • Python modules: snake_case.py (e.g., task_manager.py, auth_provider.py)
  • Svelte components: PascalCase.svelte (e.g., DashboardGrid.svelte, MappingTable.svelte)
  • Test files: test_<module_name>.py or <ComponentName>.test.ts
  • ADR files: ADR-NNNN-short-description.md (zero‑padded, 4 digits, kebab‑case)

Enforcement

  • Speckit /speckit.plan command reads this ADR to validate proposed module placement.
  • Speckit /speckit.implement rejects files written outside canonical boundaries unless justified in feature‑local research.md.
  • Направление импортов проверяется в code review; отдельный статический verifier не является частью текущего репозитория.

@} Doc.Adr.ADR0001