Use one field name, type, and null rule for every payload
Shared fields appear in request validation, list pagination, payload performance, the saved answers device store, weekly quality events, health checks, and dashboard SQL with different names, casing, types, and null rules. This page lists each inconsistency, states one canonical rule, and gives a serialization patch to ship in the app slice. It adds no sign-in path, no role, no permission, and no tenancy change. Every server query keeps tenant_id from the signed-in session only.
Field by field inconsistency list
Read the found column as current pack wording. Read the canonical column as the rule to ship in one release, in code and in every guide that names the field.
| Shared field | Found as | Variants in this pack | Unified canonical |
|---|---|---|---|
| tenant_id, workspace, college workspace | tenant_id in SQL and follow records, workspace as display name 120 chars, college name in prose | tenant_id is a server identifier, workspace is a display string, college is prose. Public request body must never carry tenant_id. | Server JSON: tenant_id, string, session bound only, never in a public body. Display: workspace, string or null, 120 max. Never mix the two in one payload. |
| org | org in request JSON, label College or system office, config lists college | Field name org, label wording differs, manifest wording differs. | JSON name org, string required 1 to 200 after trim, single line. Label stays College or system office. Do not rename to college in JSON in this release. |
| role | 9 values in request validation, 7 values in one inline validator, lower case canonical forms in prose | Case sensitive phrases with spaces in JSON, lower case forms in guide prose, 7 versus 9 enum mismatch. | JSON enum, exact 9 values from request validation, case sensitive. Prose canonical forms are display only and are never sent as role. Both validators must check select option and 9 value enum. |
| kind, page, website, X-Request-Id | kind demo or question, page as pathname or allowlisted path, website honeypot, X-Request-Id header | page has no documented allowlist or length in one guide and an allowlist in another. website has no stated length. Header uses kebab case. | kind enum demo, question. page string required, allowlisted public path or other, query and hash stripped, max 200 in patch. website string, must be empty for a person. X-Request-Id string header only, reused on retry with same fields, never in body. |
| q, limit, offset, page, pageSize | q, limit default 50 max 200, offset default 0 in pagination. page 1 based and pageSize 5, 10, 20 max 100 in weekly quality demo. | Same concept, two names, two bases, two defaults. A client cannot tell which pair a list uses. | Server lists use limit and offset only. Weekly demo page and pageSize are mapped at the boundary: limit equals pageSize, offset equals (page minus 1) times limit. Do not add page to server lists. |
| sort, order | sort as updated_desc in pagination, sort as week in weekly table, order as desc or asc, My Answers sorts as relevant, recent, newest, title | One concept in four forms. Default sort differs by endpoint with no shared tie break in some places. | Server sort is one string field_direction, snake case, for example updated_desc, with id ascending as tie break. order is a demo only alias for the direction part. Device sorts stay device only. |
| List response items, total, limit, offset, sort, filters, hasMore | data.items, data.total, data.limit, data.offset, data.sort, data.filters, data.hasMore in pagination. Weekly table uses total and shown in prose. | hasMore is camelCase. All other fields are lower or snake. Empty list and zero total rules are stated in payload performance but not in the response table. | Canonical server: data.items array never null, data.total integer, data.limit integer, data.offset integer, data.sort string, data.filters object, data.has_more boolean. Map hasMore to has_more at the boundary until the server release ships, then remove the alias. |
| Identifiers id, follow_id, question_id, user_id | follow_id, tenant_id, question_id, follower_user_id snake in follow spec. id, createdAt camel in device store. study_set.id and tenant_id snake in study sets. | Same identifier concept, snake in server spec, camel in device store, no shared format rule. | Server: string identifier, passed back unchanged, no arithmetic, UUID when generated. Device: id string, mapped to the server name at export. Never use a numeric id in JSON. |
| title, question, answer | title 200, question 2000, answer 4000 in saved answers. question_text and answer_text in study sets. Question or answer title as a label in one panel. | Label wording differs for the same title value. Study set adds _text suffix. | Server and device record: title, question, answer, string with stated max. Study set snapshot keeps question and answer, no _text suffix in JSON. Label is Answer title on every form. |
| source_title, source_link, last_checked | sourceTitle, sourceLink, lastChecked camel in My Answers. source title, source link, last checked date in prose. As shown on the answer as a display sentence. | Camel versus snake, and a display sentence used where a date is expected. | Server: source_title string or null, source_link string or null starting with http or https, last_checked string or null as YYYY-MM-DD when a date is known. Device camel names map to these at the boundary. Descriptive text is never stored as a date. |
| collection, collectionId, folder | collection string in share text, collectionId in My Answers store, folder name in My Library, collection in save bundle prose | Three names for one concept. Share uses a name, store uses an id, library uses a folder label. | Server and store: collection_id string id, collection is a display name derived from the id and is never stored as the key. Share text that shows a name labels it Collection name and maps it to an id on import. Folder is display only. |
| created_at, updated_at, last_opened_at, saved_date, first_answer_at | createdAt, updatedAt, lastOpenedAt camel on device. created_at, first_answer_at snake in SQL. savedDate in share link. College local time as a label in prose. | Camel versus snake, savedDate versus createdAt for the same moment, local time mixed with UTC storage. | Server timestamps are ISO 8601 UTC with Z, snake names created_at, updated_at, last_opened_at, first_answer_at. Date only fields are YYYY-MM-DD. College local time is a separate display label, never the stored value. saved_date is removed, use created_at. |
| status, state, outcome, rating | status draft, in review, approved, suspended, retired with a space. state active or off. outcome not_answered, handed_off. rating helpful, not_helpful versus helpful, not helpful in prose. | Space form breaks enum matching. State and status are used for different concepts with overlapping names. | Enums are lower snake with no spaces: status draft, in_review, approved, suspended, retired. state active, off. outcome answered, not_answered, handed_off, unavailable. rating helpful, not_helpful. Prose may use spaces, JSON never does. |
| week, week_starting_monday_utc, checked, checked_at | week as YYYY-MM-DD filter, week_starting_monday_utc in events and CSV, checked in health example, checked_at in liveness response | Same Monday bucket in three names. Health checked without _at versus checked_at. | Server and events: week_starting_monday_utc, YYYY-MM-DD, Monday UTC on public demo, converted to college local time in the signed-in app with the basis stated. Health: checked_at ISO 8601 UTC. checked is deprecated, map it at the boundary. |
| workspace, assistant, channel in events | workspace, assistant, channel as null on public demo, filled from record in signed-in app, omitted in earlier demo code | Null versus omitted is the difference between a strict collector accepting the payload and rejecting it. | Always present in event payloads, string or null, never omitted. Null on public demo because there is no signed-in workspace, assistant, or channel. |
| event names and payload fields value, rating, outcome, result_bucket, ts | campus_feedback_given, campus_answer_shown, campus_guide_search_performed canonical. Earlier demo used value for all three, surface weekly-quality-rate-guide outside the enum, and added ts. | One field name value cannot tell rating from outcome from result bucket. ts is not in the spec. | Use rating for feedback, outcome for answer shown, result_bucket for search, surface guides on the demo and guides, terminology, or workspace in the app. Remove ts. Retired names are never emitted. |
| has_citation, is_test, turn_index, role at time of question | has_citation 1 or 0 in SQL, is_test 0 or 1, turn_index integer, role stored at question time versus current Team role | SQL uses 1 and 0, JSON uses boolean. Role at time versus current role are not distinguished in field name. | JSON: has_citation boolean, is_test boolean, turn_index integer starting at 1. SQL maps boolean to 1 or 0 at the query boundary only. Role field is role_at_question in JSON when it is the role at question time, and current role is never used for trend or retention. |
| pinned, followed, paused, digest_on, intention flags | pinned boolean, followed boolean, paused boolean, digestOn boolean on device, state active or off on server follow record | Boolean flags on device, state string on server, for the same follow concept. | Server follow record uses state active or off. Device may keep followed boolean, mapped to state at export. paused and digest_on are boolean in JSON, never state. |
| Error envelope ok, data, error, code, fields and health flat response | List and validation use ok true with data, or ok false with error, code, fields. Health liveness uses ok, status, service, checked_at flat. Readiness probe uses ok false, error Not found. | Two envelope shapes with the same ok name. Health cannot be wrapped in data without breaking a monitor. | Keep health flat as a documented exception, with checked_at unified. All other server responses use ok true with data, or ok false with error, code, and fields on a 400. Never return data on error and never return 200 with ok false. |
| Unknown fields, duplicate fields, control characters | Request validation rejects unknown fields with a 400 naming the field. Form field standard notes a client that filters payload to allowed keys before fetch. Duplicate field names are reported in one validator and skipped in another. | Reject versus strip, and duplicate handling differs, so a hidden field can be silently dropped on one path and rejected on another. | Reject unknown JSON keys with a 400 naming the key, reject duplicate form field names with the same message in both validators, and reject control characters as stated in the patch. Do not strip silently in server code. |
| Missing value, empty list, zero count | Missing value is null, empty list is an empty array, zero count is 0 in payload performance. Device load uses empty string and Not recorded for missing workspace, assistant, and dates. lastOpenedAt is empty string in examples. | Null versus empty string for the same missing value. A client that expects null will read empty string as a real value. | Server JSON: missing optional value is null, empty list is an empty array, zero is 0. Device empty string and Not recorded are display only and are converted to null at the boundary. Never store Not recorded or As shown on the answer as a field value. |
Unified rules to ship
Apply every rule in one release, in code and in the guides that name the field. A guide that still names a deprecated form is corrected in the same release.
Name once, in snake case on the server
Server JSON uses lower snake case for multiword fields and lower case for single word fields. The only kebab case name is the X-Request-Id header. Device localStorage keeps its camelCase keys for stored items and maps them at save, load, export, and import. No payload mixes camelCase and snake case.
Type once, with no coercion
String stays string, integer stays integer, boolean stays boolean, array stays array, object stays object, and null stays null. A number, object, array, or boolean sent for a string field is a 400 for that field, never coerced to text. An integer field accepts a JSON number only, never a string parsed in silence.
Null once, with empty list and zero kept apart
Required fields are non-null and, where a length is stated, non-empty after trim. Optional fields are null when missing, never empty string and never Not recorded. An empty list is an empty array, never null. A zero count is 0, never null and never empty string.
Enum once, in lower snake case
Outcome, rating, status, state, kind, result bucket, and sort direction use the lower snake values in the table above. A differently cased or spaced value is a 400 for that field. Role is the one exception, with 9 exact case sensitive phrases from request validation.
Date and identifier once
Timestamps are ISO 8601 UTC with Z. Date only values are YYYY-MM-DD. Identifiers are strings passed back unchanged, with no arithmetic and no empty string. College local time may be shown as a label beside a UTC value and is never stored in the UTC field.
Envelope once, with health as the named exception
Success is ok true with data. Error is ok false with error, code, and fields on a 400, returning every failing field. Health liveness keeps its flat ok, status, service, and checked_at shape as a documented exception for monitors, with checked_at as the only time field name.
Tenant once, from the session only
tenant_id is never in a public request body. Signed-in routes take tenant_id only from the session, and every SQL statement filters by that tenant_id. A workspace display name is not a tenant_id and never grants workspace access.
Unified serialization patch
Ship this patch in the app slice, in the same release as the guide corrections. It adds no auth, role, permission, deploy, migration, or caching change.
Patch A, canonical registry for the public request
// Canonical server form for POST /api/public/request
// Required string fields, trimmed. Optional fields use null.
var FIELDS = {
name: { type: 'string', required: true, max: 120, line: true },
email: { type: 'string', required: true, max: 254, line: true },
org: { type: 'string', required: true, max: 200, line: true },
role: { type: 'string', required: true, enum: ROLES },
message: { type: 'string', required: true, max: 4000 },
kind: { type: 'string', required: true, enum: ['demo', 'question'] },
page: { type: 'string', required: true, max: 200 }
};
// Reject unknown keys, duplicate form names, wrong types, and
// control characters with a 400 fields object. Never strip silently.
// Trim, then store the trimmed value. Email is stored as given.
Patch B, list and detail envelope with device mapping
function listEnvelope(items, total, limit, offset, sort, filters) {
return { ok: true, data: {
items: items || [], total: total || 0,
limit: limit, offset: offset, sort: sort,
filters: filters || {}, has_more: (offset + items.length) < total
}};
}
function detailFromDevice(rec) {
// Device camelCase to server snake_case, at the boundary only
return {
id: rec.id, title: rec.title, question: rec.question || null,
answer: rec.answer || null,
source_title: rec.sourceTitle || null,
source_link: rec.sourceLink || null,
last_checked: rec.lastChecked || null,
collection_id: rec.collectionId || null,
workspace: rec.workspace || null,
assistant: rec.assistant || null,
created_at: rec.createdAt || null,
updated_at: rec.updatedAt || null
};
}
// hasMore, collection, savedDate, checked, and value are read and
// mapped here, then removed from new server responses.
Patch C, event payload with no omitted field
// campus_feedback_given: rating helpful or not_helpful
// campus_answer_shown: outcome not_answered
// campus_guide_search_performed: surface, result_bucket
// Every event: id string, event name, workspace string or null,
// assistant string or null, channel string or null,
// week_starting_monday_utc YYYY-MM-DD. No ts field.Try the checker on this page
Example only. Nothing entered here is sent to a server and nothing is saved. The checker applies Patch A and shows the exact fields object a 400 would return, or the canonical data a 200 would return.
Checks before you ship this patch
Run each check in a test college workspace. If a check fails, fix it before a live send.
- Send each field with a wrong type, an empty value, an over limit value, and an out of enum value, and confirm a 400 with that field in fields and no save or send
- Send an unknown field, a tenant_id in a public body, and a duplicate form field name, and confirm a 400 naming that field and no workspace access
- Request a list with limit, offset, and sort, and confirm items is an array, total is an integer, has_more is boolean, and an offset at or past total returns an empty array with total unchanged
- Save a device item, export it, and confirm camelCase device keys become snake_case server keys, empty strings become null, and collection_id is an id not a name
- Record each weekly quality event and confirm rating, outcome, and result_bucket are present, workspace, assistant, and channel are present as null on the public demo, and no ts field is present
- Call the health endpoint and confirm checked_at is the only time field name, with ok, status, and service unchanged for monitors
- Confirm every guide that names a changed field uses the canonical name in the same release, and confirm no auth, role, tenancy, deploy, or migration file changed in this release
Next guide
Keep validation, list shape, and payload size in step with this registry.