Port of #120 to release/0.1: the same two commits on top of release/0.1 (the commit tagged v0.1.0-RC.33), and nothing else.
What was wrong
A budget could not be edited on its record screen. The screen saves through the UI API's table update route (PATCH /qqq/v1/table/{tableName}/{primaryKey}): only the fields that were changed, as a multipart body, with the version that was read as expectedVersion. The server answered 400 and stored nothing:
Error updating Budgets: Invalid scopeType., Invalid period., Invalid metric., and Scope value must be empty for INSTANCE and present for every other scope.
Why
The record's primary key comes from the request's path, so it reaches a table customizer as text. AssistantBudgetCustomizer paired the record with its stored row itself (oldRecordListToMap("id", ...).get(record.getValue("id"))): the text "1" against the stored Integer 1. It did not find the row, and judged the one changed field as if it were a whole new budget.
The same pairing was in every settings customizer:
Table
Before
assistant_budget, assistant_budget_override
400, nothing stored
assistant_data_access
400 ("Name the table or process.")
assistant_provider
400 ("Provider type null is not installed")
assistant_rag_source
400
assistant_scheduled_task
400
assistant_profile
stored, with the defaults of a new row written over what the save did not send: a profile that was switched off was switched on, and its routing mode set to OFF
assistant_skill
stored, and a skill that was switched off was switched on
AssistantConversationCustomizer was already right (it reads both keys as integers).
The fix
One class, StoredRecords, pairs a record with its stored row for all of them:
the key of the record being saved and the key of each stored row are both read as the type of the table's key field before they are compared, so the pairing holds whether the key arrives as text or as a number (on any QQQ version);
the values being saved are laid over the stored row, each read as the type of its field; that merged record is what the rules are judged on;
a change is found by comparing values of the same type (a scheduled task keeps the approval of its writes when a save sends enabled=true as text; a knowledge source keeps its vectors when a save sends the chunk size it already has);
a value that cannot be read as the type of its field is refused with 400 and a message that names the field and does not repeat the value.
No customizer compares a key or a value of a record being saved with a stored one as they come any more, and ArchitectureTest refuses a call of oldRecordListToMap anywhere in the assistant.
The rules hold for a partial save as for a whole one
Judged on the record as it will be stored: the host's ceiling on a cost limit (withBudgetCostLimitCeilingUsd; a save that only turns a token limit into a cost limit is over the ceiling with the limit already stored), required fields, the allowed periods, scopes, metrics and actions, scope values, the downgrade model, the thresholds, and an override's rules. A refusal has the same words for a partial save as for a whole one. The key in the path is the record that is saved whatever the body says; who granted an override and the approval of a scheduled task's writes are not taken from a save. Field-by-field audit (where a host turns it on for budgets) records the one field that was saved, with its old and new value.
Tests
All through the real route against the fixture application (RecordScreen sends what the screen sends):
BudgetEditOverHttpTest (9): each of six fields saved alone with every other field kept; a second save from the stale version is 409 and stores nothing; the ceiling for a partial save, a whole save, a metric-only save and a new budget; twenty refusals of a partial save, each storing nothing; a blanked setting gets its default; what the server decides; an override; the audit; a person without assistant.admin.
RecordEditsOverHttpTest (4): profile, default profile, skill, data access.
one test each in AssistantSettingsTest (provider and model), RagTest (knowledge source), ScheduledTasksTest (scheduled task).
Fourteen of the sixteen fail without the fix (the two that pass: the permission refusal and the default-profile switch).
StoredRecordsTest (6) pairs a record with its stored row for an integer, a long and a text key, with the key as text and as a number, and covers the merged record, refusals and comparisons.
QQQ core hands a record that came from a request to table customizers as the request carried it (a key from the path is text), where the same write made in Java carries the type of the key field. That is fixed in core (QRun-IO/qqq#1378 for develop, QRun-IO/qqq#1379 for release/4.1): with it, the customizers of this QBit as they were before this change pass all sixteen of the route tests above. This change makes the QBit right on any QQQ version, with or without that fix: the tests above pass against the QQQ version this QBit builds with (4.1.0-RC.32), and against a build of the 4.1 line with the core fix.
For a host
Nothing to change. No schema, configuration or API change.
Port of #120 to `release/0.1`: the same two commits on top of `release/0.1` (the commit tagged `v0.1.0-RC.33`), and nothing else.
## What was wrong
A budget could not be edited on its record screen. The screen saves through the UI API's table update route (`PATCH /qqq/v1/table/{tableName}/{primaryKey}`): only the fields that were changed, as a multipart body, with the version that was read as `expectedVersion`. The server answered 400 and stored nothing:
```
Error updating Budgets: Invalid scopeType., Invalid period., Invalid metric., and Scope value must be empty for INSTANCE and present for every other scope.
```
## Why
The record's primary key comes from the request's path, so it reaches a table customizer as text. `AssistantBudgetCustomizer` paired the record with its stored row itself (`oldRecordListToMap("id", ...).get(record.getValue("id"))`): the text `"1"` against the stored `Integer 1`. It did not find the row, and judged the one changed field as if it were a whole new budget.
The same pairing was in every settings customizer:
| Table | Before |
|---|---|
| `assistant_budget`, `assistant_budget_override` | 400, nothing stored |
| `assistant_data_access` | 400 ("Name the table or process.") |
| `assistant_provider` | 400 ("Provider type null is not installed") |
| `assistant_rag_source` | 400 |
| `assistant_scheduled_task` | 400 |
| `assistant_profile` | stored, with the defaults of a new row written over what the save did not send: a profile that was switched off was switched on, and its routing mode set to OFF |
| `assistant_skill` | stored, and a skill that was switched off was switched on |
`AssistantConversationCustomizer` was already right (it reads both keys as integers).
## The fix
One class, `StoredRecords`, pairs a record with its stored row for all of them:
- the key of the record being saved and the key of each stored row are both read as the type of the table's key field before they are compared, so the pairing holds whether the key arrives as text or as a number (on any QQQ version);
- the values being saved are laid over the stored row, each read as the type of its field; that merged record is what the rules are judged on;
- a change is found by comparing values of the same type (a scheduled task keeps the approval of its writes when a save sends `enabled=true` as text; a knowledge source keeps its vectors when a save sends the chunk size it already has);
- a value that cannot be read as the type of its field is refused with 400 and a message that names the field and does not repeat the value.
No customizer compares a key or a value of a record being saved with a stored one as they come any more, and `ArchitectureTest` refuses a call of `oldRecordListToMap` anywhere in the assistant.
## The rules hold for a partial save as for a whole one
Judged on the record as it will be stored: the host's ceiling on a cost limit (`withBudgetCostLimitCeilingUsd`; a save that only turns a token limit into a cost limit is over the ceiling with the limit already stored), required fields, the allowed periods, scopes, metrics and actions, scope values, the downgrade model, the thresholds, and an override's rules. A refusal has the same words for a partial save as for a whole one. The key in the path is the record that is saved whatever the body says; who granted an override and the approval of a scheduled task's writes are not taken from a save. Field-by-field audit (where a host turns it on for budgets) records the one field that was saved, with its old and new value.
## Tests
All through the real route against the fixture application (`RecordScreen` sends what the screen sends):
- `BudgetEditOverHttpTest` (9): each of six fields saved alone with every other field kept; a second save from the stale version is 409 and stores nothing; the ceiling for a partial save, a whole save, a metric-only save and a new budget; twenty refusals of a partial save, each storing nothing; a blanked setting gets its default; what the server decides; an override; the audit; a person without `assistant.admin`.
- `RecordEditsOverHttpTest` (4): profile, default profile, skill, data access.
- one test each in `AssistantSettingsTest` (provider and model), `RagTest` (knowledge source), `ScheduledTasksTest` (scheduled task).
Fourteen of the sixteen fail without the fix (the two that pass: the permission refusal and the default-profile switch).
`StoredRecordsTest` (6) pairs a record with its stored row for an integer, a long and a text key, with the key as text and as a number, and covers the merged record, refusals and comparisons.
`./mvnw verify`: BUILD SUCCESS, 691 tests in `qbit-assistant`, coverage checks met.
## Where the fault is
QQQ core hands a record that came from a request to table customizers as the request carried it (a key from the path is text), where the same write made in Java carries the type of the key field. That is fixed in core (QRun-IO/qqq#1378 for `develop`, QRun-IO/qqq#1379 for `release/4.1`): with it, the customizers of this QBit as they were before this change pass all sixteen of the route tests above. This change makes the QBit right on any QQQ version, with or without that fix: the tests above pass against the QQQ version this QBit builds with (4.1.0-RC.32), and against a build of the 4.1 line with the core fix.
## For a host
Nothing to change. No schema, configuration or API change.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
A record screen saves through the UI API's table update route: only the
fields that were changed, with the version that was read. The record's key
comes from the request's path, so it reaches a table customizer as text.
AssistantBudgetCustomizer paired the record with its stored row by comparing
that text with the stored integer key, did not find the row, and judged the
one changed field as if it were a whole new budget: 400, nothing stored. The
same pairing was in every settings customizer: budget overrides, data access
rows, providers, knowledge sources and scheduled tasks were refused the same
way; a profile and a skill were stored with the defaults of a new row written
over what the save had not sent.
StoredRecords now does the pairing for all of them: the key of the record
and of each stored row are read as the type of the table's key field before
they are compared, the values being saved are laid over the stored row each
as the type of its field, and a change is found by comparing values of the
same type. A value that cannot be read as the type of its field is refused.
The rules (the host's ceiling on a cost limit, required fields, allowed
periods and scopes, an override's rules) are judged on the record as it will
be stored, for a save of one field exactly as for a save of all of them.
Tests go through the real route against the fixture application; fourteen of
the sixteen fail without the fix.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ArchitectureTest refuses a call of oldRecordListToMap anywhere in the
assistant: the map is keyed by the stored key, and the key of a record saved
from a screen is text. StoredRecordsTest pairs a record with its stored row
for an integer, a long and a text key, with the key as text and as a number,
and covers the merged record, refusals and comparisons.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Port of #120 to
release/0.1: the same two commits on top ofrelease/0.1(the commit taggedv0.1.0-RC.33), and nothing else.What was wrong
A budget could not be edited on its record screen. The screen saves through the UI API's table update route (
PATCH /qqq/v1/table/{tableName}/{primaryKey}): only the fields that were changed, as a multipart body, with the version that was read asexpectedVersion. The server answered 400 and stored nothing:Why
The record's primary key comes from the request's path, so it reaches a table customizer as text.
AssistantBudgetCustomizerpaired the record with its stored row itself (oldRecordListToMap("id", ...).get(record.getValue("id"))): the text"1"against the storedInteger 1. It did not find the row, and judged the one changed field as if it were a whole new budget.The same pairing was in every settings customizer:
assistant_budget,assistant_budget_overrideassistant_data_accessassistant_providerassistant_rag_sourceassistant_scheduled_taskassistant_profileassistant_skillAssistantConversationCustomizerwas already right (it reads both keys as integers).The fix
One class,
StoredRecords, pairs a record with its stored row for all of them:enabled=trueas text; a knowledge source keeps its vectors when a save sends the chunk size it already has);No customizer compares a key or a value of a record being saved with a stored one as they come any more, and
ArchitectureTestrefuses a call ofoldRecordListToMapanywhere in the assistant.The rules hold for a partial save as for a whole one
Judged on the record as it will be stored: the host's ceiling on a cost limit (
withBudgetCostLimitCeilingUsd; a save that only turns a token limit into a cost limit is over the ceiling with the limit already stored), required fields, the allowed periods, scopes, metrics and actions, scope values, the downgrade model, the thresholds, and an override's rules. A refusal has the same words for a partial save as for a whole one. The key in the path is the record that is saved whatever the body says; who granted an override and the approval of a scheduled task's writes are not taken from a save. Field-by-field audit (where a host turns it on for budgets) records the one field that was saved, with its old and new value.Tests
All through the real route against the fixture application (
RecordScreensends what the screen sends):BudgetEditOverHttpTest(9): each of six fields saved alone with every other field kept; a second save from the stale version is 409 and stores nothing; the ceiling for a partial save, a whole save, a metric-only save and a new budget; twenty refusals of a partial save, each storing nothing; a blanked setting gets its default; what the server decides; an override; the audit; a person withoutassistant.admin.RecordEditsOverHttpTest(4): profile, default profile, skill, data access.AssistantSettingsTest(provider and model),RagTest(knowledge source),ScheduledTasksTest(scheduled task).Fourteen of the sixteen fail without the fix (the two that pass: the permission refusal and the default-profile switch).
StoredRecordsTest(6) pairs a record with its stored row for an integer, a long and a text key, with the key as text and as a number, and covers the merged record, refusals and comparisons../mvnw verify: BUILD SUCCESS, 691 tests inqbit-assistant, coverage checks met.Where the fault is
QQQ core hands a record that came from a request to table customizers as the request carried it (a key from the path is text), where the same write made in Java carries the type of the key field. That is fixed in core (QRun-IO/qqq#1378 for
develop, QRun-IO/qqq#1379 forrelease/4.1): with it, the customizers of this QBit as they were before this change pass all sixteen of the route tests above. This change makes the QBit right on any QQQ version, with or without that fix: the tests above pass against the QQQ version this QBit builds with (4.1.0-RC.32), and against a build of the 4.1 line with the core fix.For a host
Nothing to change. No schema, configuration or API change.
🤖 Generated with Claude Code