---
id: TASK-10.2
title: Add sandbox tests for schema validation and safety limits
status: Done
assignee:
  - '@codex'
created_date: '2026-02-04 11:47'
updated_date: '2026-02-04 11:53'
labels: []
dependencies: []
references:
  - spec/api_spec/sandbox_spec.lua
  - lua/zync/api/configurator/sandbox.lua
parent_task_id: TASK-10
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Expand sandbox specs to validate schema enforcement and sandbox safety limits without shallow line hits.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Tests cover schema type validation (e.g., wrong type for `profiles` or `board`) and assert specific error messages.
- [x] #2 Tests cover rejection of non-plain tables or metatables in the returned config (including nested metatable cases).
- [x] #3 Tests cover unknown-field handling (assert that it logs a warning) and at least one runtime limit/size limit error path (e.g., config too deep or too large).
- [x] #4 Tests remain meaningful and focused on behavior, not just coverage numbers.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1. Add sandbox tests for schema type validation (e.g., `profiles` or `board` wrong type) and assert error messages.
2. Add sandbox tests for non-plain tables/metatables (top-level and nested).
3. Add sandbox tests for unknown-field warnings (stub `print`) and one safety limit error (e.g., config too deep or too large).
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added sandbox specs for schema type validation, metatable rejection (top-level and nested), unknown-field warnings, and depth limit errors.

Ran `busted spec/api_spec/sandbox_spec.lua` (9/0/0/0).
<!-- SECTION:NOTES:END -->
