AGENTS.md instructions for /home/clive/PycharmProjects/Orac <INSTRUCTIONS> Python Follow…
- User
AGENTS.md instructions for /home/clive/PycharmProjects/Orac
Follow standard Python conventions unless otherwise specified.
-
Module structure:
-
A module docstring MUST appear at the very top of the file describing its purpose.
-
Immediately following the module docstring, include comment-based metadata headers:
Author: Clive Bostock
Date:
Description:
-
-
Command-line scripts:
- Use argparse for command-line parameters.
-
Code quality:
- Include Google-style docstrings for all new public modules, classes, and functions.
- When modifying existing public code, add missing docstrings where it is reasonable to do so within the scope of the change.
- Use type hints where appropriate.
- Favour readable, production-usable code with sensible error handling.
-
General:
- Prefer clarity over cleverness.
- Avoid unnecessary complexity.
-
For any created programs / executable scripts include provenance. If pre-existing code does not already have these, ask for confirmation before adding. Template:
Author: Clive Bostock Date: DD-Mon-YYYY Purpose: Usage:
--- project-doc ---
Orac Agent Instructions
Before making changes, read this file first.
Do not read every guardrail document automatically. Select the relevant guardrails based on the files being changed and the nature of the task.
If the task crosses multiple areas, read all relevant guardrails.
If unsure, read the stricter or more relevant document rather than guessing.
Always read
- docs/agent-guardrails/00-project-principles.md
- docs/agent-guardrails/10-architecture-boundaries.md
Guardrail drift check
Run the lightweight guardrail structure and reference checks with:
bashpoetry run python scripts/check_guardrails.py poetry run pytest tests/test_check_guardrails.pyDatabase, DDL, SQL, install scripts, grants, schemas
When changing files under
resources/db/schema, read:- resources/db/schema/AGENTS.md
Also read the adjacent database context file when it exists:
-
- User
<environment_context> /home/clive/PycharmProjects/Orac bash <current_date>2026-05-25</current_date> Europe/London </environment_context>
- User
<image name=[Image #1]>
- User
- User
The recent updates to the app and database (probably the ones to accomodate the capture of voice options) has possibly caused this issue: [Image #1]. Please investigate and fix.
- Assistant
I’ll inspect the database guardrails first, then trace the
USER_PREF_CK1constraint and the User Maintenance DML path so the fix lands at the right layer. - Assistant
The worktree already has unrelated edits, including the recent voice-related database files. I’ll leave those intact and focus on the constraint failure path.
- Assistant
I’ve read the database guardrails and will use the Oracle SQLcl workflow for live verification. Next I’m locating the exact check constraint and the APEX/API write path that is firing it.
- Assistant
The failure is in preference seeding during user creation, not in the basic user row. The new
tts_voicepreference is declared asvalue_type = 'string', but its seeded default currently looks like a JSON array, which violates the coreuser_pref_ck1type check. - Assistant
The seed package bypasses the stricter
orac_code.user_preferences_apivalidation and inserts defaults directly through the API TAPI, so the core constraint is the first place the bad default is caught. I’m checking the live database now to confirm deployed metadata matches the files before patching. - Assistant
Live metadata confirms
tts_voiceis stored as a JSON empty string. Oracle’sjson_value(... returning varchar2)treats that as SQLNULL, souser_pref_ck1rejects it even though the preference is optional. I’m checking whether there is a better non-empty default voice available before deciding between a metadata fix and relaxing null handling. - Assistant
The least invasive fix is to keep the optional
tts_voiceempty-string preference, but make the core type constraint check JSON scalar type instead ofjson_value(...) is not null. That preserves the soft-reference fallback behaviour and still rejects arrays/objects for string preferences. - Assistant
I’ve updated the schema file. I’m adding a small static regression test so this exact empty-string JSON issue does not come back with future preference changes.
- Assistant
The repo fix is in place. I’m applying the same constraint change to the local Oracle dev database, then I’ll exercise the failing user-seed path directly.
- Assistant
The direct seed probe succeeded: a temporary user received all 19 preferences including
tts_voice = ""without the ORA-02290 error. The SQLcl MCP dropped after cleanup while issuingcommit, so I’m reconnecting to confirm the probe rows are gone and the constraint is in place. - Assistant
Host SQLcl verification shows the live
USER_PREF_CK1now uses JSON type checks, and the temporary probe user/preferences are gone. I’m running the focused regression test and the project’s guardrail checks next. - Assistant
The focused regression test passes, and the guardrail unit tests pass. The standalone guardrail scanner still fails on a pre-existing
docs/agent-guardrails/Untitled Documentfile, unrelated to this change. - Assistant
There is one more related edge: the business validation package still treats an empty JSON string as “not text” because
json_valuereturns SQLNULL. I’m tightening that too, so both the core constraint and the edit API agree. - Assistant
I updated the business API package as well. Since the SQLcl MCP transport is still closed, I’m using host SQLcl for package deployment and verification.
- Assistant
The package compiled cleanly, empty
tts_voicenow validates with no error, and the user-seed probe succeeds end to end. I’m rerunning the tests after the package change. - Assistant
Fixed.
The issue was caused by optional
tts_voicebeing stored as a JSON empty string. Oraclejson_value(... returning varchar2)maps that to SQLNULL, soUSER_PREF_CK1rejected it during preference seeding after user creation.Changed:
- user_pref_ck1.sql: uses JSON scalar type checks via
json_exists(... type()), so empty string is valid text while arrays/objects still fail. - user_preferences_api.sql: business validation now also recognises empty JSON strings as valid string scalars.
- test_tts_voice_catalog.py: added regression checks.
- user_pref_ck1.sql: uses JSON scalar type checks via
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.