Skip to content

Break out vla-manager-api from dva-api - #74

Open
MYRhouma wants to merge 2 commits into
Prometheus-X-association:yassine-refactorfrom
MYRhouma:feat/vla-manager-api
Open

Break out vla-manager-api from dva-api#74
MYRhouma wants to merge 2 commits into
Prometheus-X-association:yassine-refactorfrom
MYRhouma:feat/vla-manager-api

Conversation

@MYRhouma

Copy link
Copy Markdown
Contributor

Adds the VLA Manager FastAPI service that owns VLA and quality-template persistence, replacing the removed dva-api VLA/template routes.

  • POST /vla, GET /vla[/{id}], DELETE /vla/{id}
  • POST /vla/from-templates renders Handlebars templates against the supplied model and appends the rendered quality implementations to the persisted ODCS document
  • FakeVLARepo / FakeTemplateRepo use caller-supplied ids to keep tests deterministic
  • VLANewFromTemplates.model_dump is JSON-serialized and the qualityTemplates field is stripped before persistence so UUIDs in nested DTOs do not break json.dumps
  • 10 unit tests covering CRUD + from-templates (pytest tests/ -> 10 passed)

Depends on: none

@bzp99

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new vla-manager-api FastAPI service responsible for persisting Veracity Level Agreements (VLAs) and quality templates, including a “create VLA from templates” endpoint and a hand-written OpenAPI spec served via /swagger.

Changes:

  • Introduces VLA CRUD endpoints plus POST /vla/from-templates that renders stored templates and merges rendered quality into the persisted ODCS document.
  • Adds template CRUD + render endpoints (/template*) backed by in-memory fakes and asyncpg PostgreSQL repos.
  • Adds initial unit tests for VLA CRUD and from-templates flows, plus Docker/uv packaging and an OpenAPI YAML spec.

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
vla-manager-api/uv.lock Locks Python dependencies for the new service.
vla-manager-api/tests/test_vla_crud.py Unit tests for VLA CRUD and /vla/from-templates.
vla-manager-api/tests/init.py Marks test package.
vla-manager-api/src/vla_manager_api/template_routes.py FastAPI routes for template CRUD + render.
vla-manager-api/src/vla_manager_api/routes.py FastAPI routes for VLA CRUD + from-templates.
vla-manager-api/src/vla_manager_api/repo.py Repo interfaces + Fake/Pg implementations; template rendering helper.
vla-manager-api/src/vla_manager_api/models.py Pydantic DTOs for VLA + templates.
vla-manager-api/src/vla_manager_api/main.py App factory + Swagger UI/spec serving; production repo builders.
vla-manager-api/src/vla_manager_api/dependencies.py Lazy DI providers for VLA + template repos.
vla-manager-api/src/vla_manager_api/config.py Environment-driven runtime configuration + logging setup.
vla-manager-api/src/vla_manager_api/auth.py Bearer API-key guard for destructive endpoints.
vla-manager-api/src/vla_manager_api/init.py Package metadata/docs.
vla-manager-api/README.md Service overview and local run instructions.
vla-manager-api/pyproject.toml Project metadata and dependencies.
vla-manager-api/Dockerfile Container build/run setup including embedded OpenAPI YAML.
docs/spec/vla-manager-api.yaml Hand-written OpenAPI 3.1 spec for the service.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +336 to +338
application/json:
schema:
$ref: '#/components/schemas/IDDTO'
Comment on lines +72 to +74
quality_templates: list[TemplateInstantiation] = Field(
alias="qualityTemplates", default_factory=list
)
Comment on lines +106 to +110
@router.delete("/vla", status_code=status.HTTP_204_NO_CONTENT)
async def delete_all_vlas(
_: None = Depends(require_api_key), repo: VLARepo = Depends(get_repo)
) -> None:
await repo.remove_all()
Comment thread vla-manager-api/README.md
| `GET /vla` | VLA Manager UI, admin | List all VLAs |
| `GET /vla/{id}` | DVA API, UI | Retrieve a VLA by its UUID — used during VLA resolution in the synchronous attestation flow |
| `POST /vla` | VLA Manager UI | Create a VLA from a partial ODCS payload |
| `POST /vla/from-templates` | VLA Manager UI | *Reserved (501)* — implemented in a later refactor step |
Comment thread vla-manager-api/README.md
## Run locally (dev)

```bash
cd data-veracity-main/vla-manager-api
Comment on lines +88 to +92
)

pool = await asyncpg.create_pool(dsn=cfg.postgres_dsn, min_size=1, max_size=4)
repo = PgTemplateRepo(pool)
await repo._ensure_schema()
Comment on lines +62 to +66
async def add(self, vla: dict[str, Any]) -> Optional[UUID]:
id = uuid4()
# Strip any caller-supplied "id" before persisting — persistence
# owns the id, not the caller.
vla = {k: v for k, v in vla.items() if k != "id"}
Comment on lines +39 to +41
@router.get("/template", response_model=list[Template])
async def list_templates(repo: TemplateRepo = Depends(get_template_repo)) -> list[dict[str, Any]]:
return await repo.all()
Comment on lines +47 to +50
vla = await repo.by_id(id)
if vla is None:
raise HTTPException(status.HTTP_404_NOT_FOUND)
return vla
@bzp99 bzp99 self-assigned this Jul 29, 2026
@bzp99 bzp99 changed the title feat: add vla-manager-api with template CRUD and /vla/from-templates Break out vla-manager-api from dva-api Jul 29, 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.

3 participants