Skip to content

fix: schema compliance audit — fix field type, naming, and label violations across all packages#337

Merged
hotlong merged 7 commits intomainfrom
copilot/assess-objectstack-schema-compliance
Apr 14, 2026
Merged

fix: schema compliance audit — fix field type, naming, and label violations across all packages#337
hotlong merged 7 commits intomainfrom
copilot/assess-objectstack-schema-compliance

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 14, 2026

Description

Audited all 142 *.object.ts files across 14 packages against the ObjectStack schema specification. Fixed 120+ violations: wrong field types, non-snake_case names, uppercase option values, and inconsistent label capitalization.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • CI/CD update

Related Issues

Related to ObjectStack schema spec compliance

Changes Made

Field type corrections (27 fixes) — healthcare, education, financial-services

Field.text() replaced with semantic types where data semantics require it:

// Before
date_of_birth: Field.text({ label: 'Date of Birth' }),
email:         Field.text({ label: 'Email' }),
copay:         Field.number({ label: 'Copay Amount', min: 0 }),

// After
date_of_birth: Field.date({ label: 'Date of Birth' }),
email:         Field.email({ label: 'Email' }),
copay:         Field.currency({ label: 'Copay Amount' }),
Type change Count Packages
textdate/datetime 20 healthcare, education, financial-services
textemail 3 healthcare, education
textphone/url 2 healthcare
numbercurrency 2 healthcare, financial-services

Default value casing (5 fixes) — crm, marketing, finance, products

Option value and defaultValue must be lowercase per spec:

  • lead.object.ts: defaultValue: 'New''new'
  • campaign.object.ts: defaultValue: 'Planned''planned'
  • payment.object.ts: defaultValue: 'Planned''planned'
  • pricebook.object.ts: defaultValue: 'CNY'/'USD''cny'/'usd'

Field naming (3 fixes) — marketing

email_template.object.ts: openrateopen_rate, clickrateclick_rate, conversionrateconversion_rate

Label capitalization (80+ fixes) — support (20 files), products (7 files)

Standardized to Title Case: 'description''Description', 'origin Channel''Origin Channel', etc.

Packages with zero violations (no changes)

analytics, community, real-estate, integration, HR, core

Testing

  • Unit tests pass (npm test)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Manual testing completed
  • New tests added (if applicable)

Updated spec-compliance tests in healthcare, education, and financial-services to assert corrected field types. All 210 test files / 4104 tests pass.

Screenshots

N/A

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

CHANGELOG.md updated with full audit summary. The audit identified label capitalization as the most widespread category — a lint rule for Title Case labels would prevent recurrence.

Copilot AI and others added 7 commits April 14, 2026 10:45
…xt/number

- patient: date_of_birth→date, email→email, phone→phone
- appointment: scheduled_date→datetime, telehealth_link→url
- hipaa_audit: timestamp→datetime
- prescription: start_date/end_date→date
- insurance: coverage_start/end→date, copay/deductible→currency
- care_plan: start_date/review_date→date
- referral: referral_date→date

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
… education packages

- transaction_record: amount → Field.currency(), transaction_date → Field.date()
- kyc: verified_date, expiry_date → Field.date()
- student: graduation_date → Field.date()
- enrollment: enrollment_date → Field.date()
- alumni: email → Field.email()
- application_form: email → Field.email(), application_date/decision_date → Field.date()
- scholarship: application_deadline → Field.date()
- campus_event: event_date → Field.date()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…e casing

- marketing/email_template: fix non-snake_case option values (openrate → open_rate, clickrate → click_rate, conversionrate → conversion_rate)
- crm/lead: fix defaultValue 'New' → 'new' to match option value
- marketing/campaign: fix defaultValue 'Planned' → 'planned' to match option value
- finance/payment: fix defaultValue 'Planned' → 'planned' to match option value
- products/pricebook: fix defaultValue 'CNY' → 'cny' and 'USD' → 'usd' to match lowercase option values

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Fix label capitalization issues across all 20 object files in
packages/support/src/. Field labels now use proper Title Case
(e.g., 'Description' not 'description', 'Status' not 'status').

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…packages

Fix inconsistent label capitalization across 7 object files:
- price_rule.object.ts: Industry, Competitor Name, Approval Status
- product_bundle.object.ts: Bundle Name, Description, Status
- quote_line_item.object.ts: Description, Quantity, Subtotal, Margin, Margin %, AI Optimal Quantity
- approval_request.object.ts: Request Name, Description, Status, Competitor Name
- quote.object.ts: Quote Name, Status, Subtotal, Approval Status, Description
- discount_schedule.object.ts: Schedule Name, Description, Status, Industry, Priority
- campaign_member.object.ts: Notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Align test assertions with schema changes where generic text/number
fields were replaced with semantic ObjectStack field types:
- date_of_birth, coverage_start/end, referral_date, etc. → 'date'
- scheduled_date, timestamp → 'datetime'
- email fields → 'email'
- phone → 'phone'
- telehealth_link → 'url'
- copay, deductible, amount → 'currency'

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hotcrm-demo Ready Ready Preview, Comment Apr 14, 2026 11:32am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hotcrm Ignored Ignored Apr 14, 2026 11:32am

Request Review

@hotlong hotlong marked this pull request as ready for review April 14, 2026 11:32
Copilot AI review requested due to automatic review settings April 14, 2026 11:32
@hotlong hotlong merged commit aa3c881 into main Apr 14, 2026
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Repository-wide ObjectStack schema compliance audit that aligns object metadata across business packages with spec requirements (semantic field types, snake_case tokens, consistent select defaults, and standardized labeling).

Changes:

  • Corrected field types to semantic equivalents (e.g., textdate/datetime/email/phone/url, numbercurrency) and updated spec-compliance tests accordingly.
  • Standardized select defaultValue casing to match lowercase option values where required.
  • Normalized naming/casing in metadata (Title Case labels; select option token snake_case updates in marketing email templates) and documented the audit in CHANGELOG.md.

Reviewed changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/support/src/web_to_case.object.ts Title Case label standardization for support object fields.
packages/support/src/social_media_case.object.ts Title Case labels for configuration and platform fields.
packages/support/src/sla_template.object.ts Title Case label normalization.
packages/support/src/sla_policy.object.ts Title Case label normalization across multiple SLA policy fields.
packages/support/src/sla_milestone.object.ts Title Case label normalization for milestone name/description/status.
packages/support/src/skill.object.ts Title Case label normalization (including certification fields).
packages/support/src/routing_rule.object.ts Title Case label normalization for rule fields.
packages/support/src/queue_member.object.ts Title Case label normalization for status/notes/schedule fields.
packages/support/src/queue.object.ts Title Case label normalization for queue fields.
packages/support/src/portal_user.object.ts Title Case label normalization for user profile/notification fields.
packages/support/src/knowledge_article.object.ts Title Case label normalization across article and AI-assisted fields.
packages/support/src/holiday_calendar.object.ts Title Case label normalization for calendar/country/year/region fields.
packages/support/src/holiday.object.ts Title Case label normalization for holiday fields.
packages/support/src/forum_topic.object.ts Title Case label normalization for forum topic fields.
packages/support/src/forum_post.object.ts Title Case label normalization for post content field.
packages/support/src/escalation_rule.object.ts Title Case label normalization for escalation rule fields.
packages/support/src/email_to_case.object.ts Title Case label normalization for configuration and username fields.
packages/support/src/case.object.ts Title Case label normalization for core case fields.
packages/support/src/business_hours.object.ts Title Case label normalization for business hours fields.
packages/support/src/agent_skill.object.ts Title Case label normalization for notes field.
packages/products/src/quote_line_item.object.ts Title Case label normalization for quote line item fields.
packages/products/src/quote.object.ts Title Case label normalization for quote fields including approval status.
packages/products/src/product_bundle.object.ts Title Case label normalization for bundle fields.
packages/products/src/pricebook.object.ts Lowercased currency defaults to match lowercase currency tokens.
packages/products/src/price_rule.object.ts Title Case label normalization in pricing rule metadata.
packages/products/src/discount_schedule.object.ts Title Case label normalization for schedule fields and criteria labels.
packages/products/src/approval_request.object.ts Title Case label normalization for approval request fields.
packages/marketing/src/email_template.object.ts Snake_case option token updates for A/B test “winning metric” selector.
packages/marketing/src/campaign_member.object.ts Title Case label normalization for notes field.
packages/marketing/src/campaign.object.ts Lowercased campaign status default to match option values.
packages/healthcare/src/referral.object.ts Corrected referral date field type (textdate).
packages/healthcare/src/prescription.object.ts Corrected prescription start/end dates (textdate).
packages/healthcare/src/patient.object.ts Corrected DOB/email/phone field types to semantic types.
packages/healthcare/src/insurance.object.ts Corrected coverage dates and monetary amounts to date/currency.
packages/healthcare/src/hipaa_audit.object.ts Corrected timestamp type (textdatetime).
packages/healthcare/src/care_plan.object.ts Corrected care plan dates (textdate).
packages/healthcare/src/appointment.object.ts Corrected scheduled datetime and telehealth link (textdatetime/url).
packages/healthcare/tests/unit/objects/spec-compliance.test.ts Updated assertions for corrected healthcare field types.
packages/financial-services/src/transaction_record.object.ts Corrected transaction amount/date to currency/date.
packages/financial-services/src/kyc.object.ts Corrected verified/expiry dates (textdate).
packages/financial-services/tests/unit/objects/spec-compliance.test.ts Updated assertions for corrected financial-services field types.
packages/finance/src/payment.object.ts Lowercased payment status default to match option values.
packages/education/src/student.object.ts Corrected graduation date (textdate).
packages/education/src/scholarship.object.ts Corrected application deadline (textdate).
packages/education/src/enrollment.object.ts Corrected enrollment date (textdate).
packages/education/src/campus_event.object.ts Corrected event date (textdate).
packages/education/src/application_form.object.ts Corrected email/date fields to semantic types.
packages/education/src/alumni.object.ts Corrected alumni email (textemail).
packages/education/tests/unit/objects/spec-compliance.test.ts Updated assertions for corrected education field types.
packages/crm/src/lead.object.ts Lowercased lead status default to match option values.
CHANGELOG.md Documented the audit scope and summarized the compliance fixes.

Comment on lines 186 to 200
a_b_test_winner_metric: Field.select({
label: 'A/B Test Winning Metric',
options: [
{
"label": "Open Rate",
"value": "openrate"
"value": "open_rate"
},
{
"label": "Click Rate",
"value": "clickrate"
"value": "click_rate"
},
{
"label": "Conversion Rate",
"value": "conversionrate"
"value": "conversion_rate"
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the stored select option values for a_b_test_winner_metric (e.g., openrateopen_rate) can break existing records that already have the old values saved, causing invalid/unknown select values at runtime. Consider keeping the old values as deprecated aliases in options (same labels) for backward compatibility, or provide a data migration to rewrite existing records to the new snake_case values before removing the old ones.

Copilot uses AI. Check for mistakes.
Comment on lines 29 to +31
description: Field.textarea({ label: 'Description' }),
supported_currencies: Field.text({ label: 'Supported Currencies', maxLength: 500, description: 'Comma-separated currency codes (e.g., USD,EUR,GBP)' }),
default_currency: Field.text({ label: 'Default Currency', maxLength: 3, defaultValue: 'USD' }),
default_currency: Field.text({ label: 'Default Currency', maxLength: 3, defaultValue: 'usd' }),
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Pricebook, currency option values and default_currency are now lowercase (e.g. usd), but the supported_currencies field description still suggests uppercase codes (e.g., USD,EUR,GBP). To avoid confusion and inconsistent data entry, update the description/example (and/or add validation/normalization) to match the expected casing.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants