You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The semantic model is **auto-generated** from DSL models using:
214
+
```bash
215
+
uv run qtype generate semantic-model
216
+
```
217
+
218
+
**Why this matters:**
219
+
-`semantic/model.py` must stay in sync with `dsl/model.py`
220
+
- Manual edits will break `test_generate_semantic_model_matches_existing`
221
+
- Changes to semantic models should be made in DSL first, then regenerated
222
+
223
+
**If you need to add new semantic models:**
224
+
1. Add the model to `qtype/dsl/model.py` first
225
+
2. Run `uv run qtype generate semantic-model` to regenerate
226
+
3. Verify with `uv run pytest tests/semantic/test_semantic_generator.py`
227
+
228
+
**Exception:** Simple immutable wrappers and helper classes can be added manually, but discriminated union types and core models MUST be auto-generated.
229
+
230
+
### Span Injection and Tracing
231
+
232
+
When adding tracing/observability features:
233
+
234
+
**Prefer abstraction over direct modification:**
235
+
- Add span creation and metadata injection at the appropriate abstraction level
236
+
- For output-level spans, consider using the base executor pattern rather than modifying `flow.py` directly
237
+
- Think about where the feature belongs architecturally, not just what file is easiest to modify
238
+
239
+
**Best practices:**
240
+
- Create child spans for logical units of work
241
+
- Inject metadata (span_id, trace_id) into FlowMessage.metadata
242
+
- Set span attributes that are useful for debugging
243
+
- Handle cases where telemetry is not configured
244
+
245
+
### Testing Requirements
246
+
247
+
When implementing new features:
248
+
249
+
**Always run the full test suite before considering a feature "done":**
250
+
```bash
251
+
uv run pytest # Run ALL tests, not just the ones you created
252
+
```
253
+
254
+
**Pay special attention to:**
255
+
- Integration tests that verify end-to-end behavior
256
+
- Tests that validate architectural patterns, not just functionality
257
+
258
+
**Test coverage should include:**
259
+
- Unit tests for new models and functions
260
+
- Integration tests for cross-layer functionality
261
+
- Negative tests for error conditions
262
+
- Mock-based tests for external integrations (Phoenix, LLM APIs, etc.)
263
+
207
264
## Python Code Guidelines
208
265
209
266
All Python code in this repository must follow strict guidelines defined in `.github/copilot-instructions.md`:
0 commit comments