Skip to content

Make FieldValue lists homogeneous via Arity (#481) - #484

Merged
leogdion merged 4 commits into
v1.0.0-beta.6from
481-fieldvalue-homogeneous-list
Sep 9, 2026
Merged

leogdion merged 4 commits into
v1.0.0-beta.6from
481-fieldvalue-homogeneous-list

Conversation

@leogdion

@leogdion leogdion commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Models each FieldValue kind as Arity (.value / .list) so mixed and nested lists are unrepresentable by construction
  • Updates OpenAPI/FieldValueResponse to accept live *_LIST tags (e.g. STRING_LIST), including empty lists; tags list writes on the request path
  • Adds MistDemo StringListRoundTripPhase (Note.tags) and migrates Examples/tests; deprecated scalar factories cover .string("x")-style call sites

Test plan

  • ./Scripts/lint.sh (0 findings)
  • swift test (681 tests passed)
  • swift run mistdemo test-public — Phase 8 string list tags round-trip verified (populated + empty)
  • swift run mistdemo test-private (optional follow-up)

Closes #481

Made with Cursor

leogdion and others added 2 commits September 9, 2026 10:36
Issue #481 (homogeneous FieldValue.list) hinges on one design question that
changes the shape of the public type: how to represent an empty list.

The response `type` enum carries a flat `LIST` (openapi.yaml:1573), not the
granular `*_LIST` family requests use (openapi.yaml:1546). A non-empty list
recovers its element type from the first element, but an empty `[]` supplies
no hint at all — so whether `case empty` is required or merely defensive
depends on how CloudKit actually round-trips an empty list field.

Two live runs against the MistDemo dev container both failed BAD_REQUEST, but
the populated list failed identically to the empty one ("Field X not found in
Note") — the container does not auto-create schema fields, so the runs say
nothing about empty lists. The question is unresolved, not answered; resolving
it needs a LIST field added to `Note` via `cktool import-schema`, which
requires a management token and modifies a shared container.

Saved so this is resumable:
- .claude/probes/481-empty-list/probe.swift — compiles against this branch,
  reads credentials from MistDemo.env
- .claude/probes/481-empty-list/README.md — what was and was not established,
  step-by-step resume instructions, and what each possible outcome implies
- memory: the no-schema-auto-create fact, which is what made the first reading
  of these failures misleading

No production code changed yet. `case empty` remains the intended design since
it is correct under every outcome.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Model each FieldValue kind as value-or-list so mixed/nested lists are
unrepresentable, accept live *_LIST response tags, and cover empty+populated
string lists in MistDemo test-public.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: aa7eabfa-6539-4f06-91a0-8dc93dfca4d5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.90741% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.53%. Comparing base (ff88880) to head (57a407a).
⚠️ Report is 3 commits behind head on v1.0.0-beta.6.

Files with missing lines Patch % Lines
...it/Models/FieldValues/FieldValue+Convenience.swift 86.84% 5 Missing ⚠️
...mponents/Components.Schemas.ListValuePayload.swift 64.28% 5 Missing ⚠️
...odels/FieldValues/FieldValue+Components+List.swift 98.17% 3 Missing ⚠️
...els/FieldValues/FieldValue+Components+Scalar.swift 85.00% 3 Missing ⚠️
...istKit/Models/FieldValues/FieldValue+Codable.swift 95.74% 2 Missing ⚠️
...Kit/Models/FieldValues/FieldValue+Components.swift 90.47% 2 Missing ⚠️
...t/Models/Queries/FilterBuilder/FilterBuilder.swift 81.81% 2 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           v1.0.0-beta.6     #484      +/-   ##
=================================================
+ Coverage          86.90%   87.53%   +0.63%     
=================================================
  Files                199      201       +2     
  Lines               4857     5111     +254     
=================================================
+ Hits                4221     4474     +253     
- Misses               636      637       +1     
Flag Coverage Δ
mistdemo-spm-macos 11.01% <16.20%> (-0.17%) ⬇️
mistdemo-swift-6.4-jammy 11.01% <16.20%> (-0.17%) ⬇️
mistdemo-swift-6.4-noble 11.01% <16.20%> (-0.17%) ⬇️
spm 85.97% <91.20%> (+0.46%) ⬆️
swift-6.1-jammy 85.90% <91.20%> (+0.42%) ⬆️
swift-6.1-noble 86.00% <91.20%> (+0.58%) ⬆️
swift-6.2-jammy 85.98% <91.20%> (+0.34%) ⬆️
swift-6.2-noble 85.90% <91.20%> (+0.48%) ⬆️
swift-6.3-jammy 85.89% <91.20%> (+0.26%) ⬆️
swift-6.3-noble 85.90% <91.20%> (+0.38%) ⬆️
swift-6.4-jammy 86.22% <91.20%> (+0.49%) ⬆️
swift-6.4-noble 86.20% <91.20%> (+0.72%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leogdion
leogdion changed the base branch from main to v1.0.0-beta.6 September 9, 2026 18:49
leogdion and others added 2 commits September 9, 2026 19:57
Expand list request/response/accessor tests so Codecov patch/project clear
the #481 rewrite, and omit those bodies on Windows × Swift 6.2 to stay
under the MistKitTests emit abort.

Co-authored-by: Cursor <cursoragent@cursor.com>
String variables do not satisfy Issue.record's Comment parameter on
Windows Swift 6.2; also silence function/closure body length on the
expanded list conversion suite.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leogdion
leogdion merged commit 95ffea0 into v1.0.0-beta.6 Sep 9, 2026
69 checks passed
@leogdion
leogdion deleted the 481-fieldvalue-homogeneous-list branch September 9, 2026 20:22
leogdion added a commit that referenced this pull request Sep 9, 2026
String variables fail Issue.record's Comment parameter on Windows Swift
6.2 (#484 tip-over stubs).

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Make FieldValue.list homogeneous by construction

1 participant