Repository navigation
Closed
Labels
Description
Overview
update_schema does not enforce that a built-in type's declared fields are fixed, and the check for what names a field before a rename or removal lives only in the local agent's tool path. Both belong in core's write.
Problem Statement
- ADR-086 says a built-in type is closed, and ADR-100 §5 says its declared fields cannot be changed or removed; a user adds a prefixed field of their own, or a value to a list that accepts them.
- Core's
update_schemarefuses a rename or removal only for a field whose protection iscoreorsystem(packages/core/src/schema/mod.rs, Phase 0, viacan_delete_field/can_modify_field). A declared field of a built-in type withuserprotection, such astask.priority, can be removed, or renamed to a prefixed name, through the CLI or any other caller. - The chat bound to a type says such a field cannot be changed, so what the chat says and what core enforces differ.
- The saved queries, plays and title templates that name a field are looked up and held for the user's agreement only in the local agent's
update_schematool (field_change_refusal). CLI and other callers get no warning, and core's own play-impact check is the only one they meet.
Proposed Solution
- In
update_schema, refuse a removal or rename of a field a built-in schema declares, whatever its protection level, with the reason and what is allowed (a prefixed field, an added value). Decide whether this reads the schema'sis_coreor setsprotection: coreon every field a core schema seeds. - Move the what-names-it check (
schema::field_references::find_field_references) into the write, besidecheck_schema_change_impact, with one agreement parameter for the whole set (plays, saved queries, title templates) rather than the tool'sconfirmedand core'sforcebeing two. Remove the guard from the tool. - The tool keeps telling the model what to do after a refusal, from core's message.
Documentation
- ADR-086 - built-in types are closed
- ADR-100 §5 - the schema case
- ADR-063 and ADR-076 - what a user may add
- node-type-sequence.md - this changes a structural rule, so it follows the sequence
Acceptance Criteria
- Removing or renaming a declared field of a built-in type through
update_schemais refused with the reason, for any protection level; a prefixed field and an added value still work - A rename or removal that a saved query, play or title template names is refused by core until agreed, with the list, for the CLI and the agent alike
- The local agent tool no longer carries its own copy of the check; its refusal text comes from core
- A test per refusal in
schema_test.rs, and the agent tool test updated -
bun run test:changedpasses
Technical Specifications
Reference Files
packages/core/src/schema/mod.rs-update_schemaPhase 0,check_schema_change_impactcallpackages/core/src/schema/field_references.rs- the lookuppackages/agent/src/local_agent/tools.rs-field_change_refusal,def_update_schemapackages/core/src/models/core_schemas.rs- seeded protection levels
Implementation Details
- A field name is also a user-visible key; a core field's rename must stay refused even when the new name is prefixed.
- Seeded core schemas already declare
protectionper field; check whether setting it there is simpler than readingis_corein the write.
Non-Goals
- Changing what a user may add to a built-in type
- A visual schema editor
Activity
[-]Core's update_schema refuses a built-in type's declared fields and holds a change something names[/-][+]Core's update_schema holds a field change that saved queries or plays name, not only the agent's tool[/+]Hold a field change that a saved query or play names in core's update…
Hold a field change that a saved query or play names in core's update…