feat(lists): creation options the API accepts (parentId, folderId, messageId, initialRows, metadata, source) + parent breadcrumb (#54) - #98
Merged
Conversation
POST /api/lists takes more than title/description/schema/isPublic.
CreateListRequest now carries parentId, folderId, messageId, initialRows,
metadata and source, each omitted from the body when null so existing
callers send exactly the request they always sent, and all of them are
plumbed through ListsRepository.createList. initialRows go out in the same
flat, column-keyed shape POST /api/lists/{id}/data uses; metadata stays a
JsonObject so arbitrary keys round-trip untouched; source is modelled as a
ListSource enum ("local"/"github") rather than a raw string.
parentId is reachable from the UI: the detail screen offers "New child list"
and renders a breadcrumb of the list's ancestors, resolved by walking the
parent chain — consuming the nested `parent` object when the server inlines
it, fetching the level otherwise, with cycle and depth guards. A level that
fails to load truncates the breadcrumb instead of failing the screen. Lists
now cache their parentId, so the feature's Room schema moves to v2, and the
nav host hands the detail route one onOpenList callback that both breadcrumb
hops and newly created child lists use.
messageId gets request-layer support plus a createListFromMessage repository
call only; the affordance on a message belongs to the cross-object work in
:feature:messages.
Closes #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #54. Part of epic #49. Groundwork for #8 (Powered Templates) and the #10 materialize epic.
What changed
Request layer.
CreateListRequestgainsparentId,folderId,messageId,initialRows,metadataandsource. All default tonulland, withencodeDefaults = false+explicitNulls = false, are omitted rather than sent as null — existing callers producebyte-identical request bodies.
One correction worth calling out:
schemawas typedString?. The help centre's Listsreference is explicit that
POST /api/liststakes the DSL as an object, "not acomma-separated string" — the string form belongs to
PUT /api/lists/{id}/schema, which isuntouched. It is now
JsonObject?. No caller ever set it, so nothing changes behaviourally.Repository.
createList(...)takes all six options.initialRowsgoes through the sametoJsonData()the row-write path uses, so a starter row serialises exactly likePOST /api/lists/{id}/data'sdata. AddscreateListFromMessage(...)andgetParentChain(...).parentIdis user-visible, not just wire support.ListDtomodelsparentId, the recursivenested
parent, andchildren;ListSummary/CachedListEntitycarryparentId(feature Room DB→ v2, destructive fallback already configured).
getParentChainwalks up, consuming the server'sinlined
parentwhen present and fetching the level otherwise, with cycle and depth-10 guards;a level that fails truncates the breadcrumb rather than failing the screen.
ListDetailScreenrenders a tappable root-first breadcrumb plus a "New child list" action.
messageIdgets request support and acreateListFromMessagemethod only — no entry point in:feature:messages, which #12/#13 own.sourceis aListSourceenum (local,github) rather than a raw string.Verification
./gradlew :app:assembleDebug testDebugUnitTest→ BUILD SUCCESSFUL, all modules green.:feature:lists131 tests, 0 failures (was 110): newCreateListRequestTest(5),DefaultListsRepositoryCreationTest(10), and 5ListDetailViewModelTestcases coveringbreadcrumb resolution, absence, failure and child creation. 3 Compose cases compile, not executed
(no emulator).
TDD note: the cycle-guard test genuinely failed first — 3 requests instead of 2, because the guard
ran after the fetch — which drove checking
visitedbefore spending a request.Open questions for the owner — please weigh in
spec has only
/api/documents/templates,/api/documents/templates/seed-defaultsand/api/documents/from-template; the help centre has no list-template page. Where do the web'slist templates come from?
initialRowsshape is unverified. The generated spec types it"type": "string", and thehuman-written reference never mentions it. Modelled as an array of flat column-keyed objects and
documented in KDoc. Worth confirming before AI: Powered Templates tab on list creation #8 relies on it.
folderIdis not a documented create field. It is a real list column, but appears onneither the OpenAPI
POST /api/listsschema nor the help reference's create body — folderplacement is documented on
PUT /api/lists/{id}(withnull= root). Included as the issueasked, with a KDoc note. No caller passes it today.
GET /api/listscarriesparent/children, but the test account has exactly one list, with no parent and no children,so whether
GET /api/lists/{id}nests more than one level is unobservable without creating dataon a live account. The walk handles both cases and is tested both ways, so this is safe
either way.
Reviewer notes
InterlinedListNavHost.ktwiringonOpenListonListDetailRoute. Without it the breadcrumb and child-list navigation are dead. The parameter hasa no-op default, so dropping the line still compiles.
PUT /api/lists/{id}also acceptsparentId, so re-parenting anexisting list is still unsupported.