Skip to content

add [properties] - add isCompleted flag for documents#748

Merged
danielkweon merged 39 commits intomainfrom
daniel/m-5453--add-properties-be-add-iscompleted-flag
Jan 9, 2026
Merged

add [properties] - add isCompleted flag for documents#748
danielkweon merged 39 commits intomainfrom
daniel/m-5453--add-properties-be-add-iscompleted-flag

Conversation

@danielkweon
Copy link
Copy Markdown
Contributor

add [properties] - add isCompleted flag

  • Added is_completed field to SoupDocument, BasicDocument, and DocumentPreviewData structs
  • SQL queries updated with LEFT JOIN to entity_properties to compute completed status for tasks
  • Document preview API now returns is_completed for task mentions in markdown files
  • Default is_completed: false added to activity feeds, project sub-items, and onboarding docs

@danielkweon danielkweon self-assigned this Dec 23, 2025
@danielkweon danielkweon requested review from a team as code owners December 23, 2025 16:13
@linear
Copy link
Copy Markdown

linear bot commented Dec 23, 2025

@danielkweon danielkweon marked this pull request as draft December 23, 2025 16:38
@danielkweon danielkweon marked this pull request as ready for review December 23, 2025 17:45
@danielkweon danielkweon force-pushed the daniel/m-5453--add-properties-be-add-iscompleted-flag branch 3 times, most recently from 94ed5e3 to c49c0a2 Compare December 30, 2025 15:41
@danielkweon danielkweon force-pushed the daniel/m-5453--add-properties-be-add-iscompleted-flag branch from c49c0a2 to 3d26677 Compare December 31, 2025 19:30
@danielkweon danielkweon changed the title add [properties] - add isCompleted flag add [properties] - add isCompleted flag for documents Dec 31, 2025
Copy link
Copy Markdown
Member

@whutchinson98 whutchinson98 left a comment

Choose a reason for hiding this comment

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

overall looks good, but I think we should avoid having a bunch of random uuids hard coded across lots of queries. I think this could get confusing and prone to error

instead, can you please inject as a parameter in the sql and use a const so it's more clear what these values are

Copy link
Copy Markdown
Contributor

@seanaye seanaye left a comment

Choose a reason for hiding this comment

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

This looks good but we should change the is_completed to exist inside the task subtype,

@danielkweon danielkweon force-pushed the daniel/m-5453--add-properties-be-add-iscompleted-flag branch from 3d26677 to 4b0d75f Compare January 8, 2026 15:36
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 8, 2026

@danielkweon danielkweon force-pushed the daniel/m-5453--add-properties-be-add-iscompleted-flag branch from 4b0d75f to 5e81df9 Compare January 8, 2026 18:09
…PreviewData

Add is_completed bool field to document response structs to indicate
whether a task's Status property is set to Completed.

This field will be populated by SQL queries in subsequent commits.
Add LEFT JOIN to entity_properties table to check Status property.
is_completed is true when:
- sub_type is 'task' AND
- Status property value contains Completed UUID

Updated files:
- unexpanded/by_cursor.rs (2 functions)
- unexpanded/by_ids.rs
- expanded/by_cursor.rs (2 functions)
- expanded/by_ids.rs
- expanded/dynamic.rs (static clauses and DocumentRow struct)
- pg_soup_repo.rs (map_soup_type! macro)
Add is_completed field to batch_get_document_preview_v2 query.
Uses same pattern as soup queries with task-only JOIN optimization.
Add is_completed: false to all places that construct BasicDocument
manually. These surfaces (activity feeds, project items, etc.) will
show tasks as incomplete by default. Can be enhanced later if needed.
Replace hardcoded UUIDs with SystemPropertyKey::STATUS_UUID and
StatusOption::COMPLETED_UUID to improve code clarity and reduce
error-prone magic values across queries.
- Remove @core/util/subType.ts utility file
- Add NamedSubType and SubType types to @macro-entity/types/entity
- Update all 18 files to use subType?.type directly instead of utility functions
- Replace isTaskSubType(x) with x?.type === 'task'
- Replace getSubTypeName(x) with x?.type
- Replace normalizeSubType(x) with direct object creation where needed
- Maintain type safety with NamedSubType for function parameters
- All API boundaries properly handle string-to-object conversion
@danielkweon danielkweon force-pushed the daniel/m-5453--add-properties-be-add-iscompleted-flag branch from 22f0ad9 to 25e3730 Compare January 8, 2026 21:39
Copy link
Copy Markdown
Member

@whutchinson98 whutchinson98 left a comment

Choose a reason for hiding this comment

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

overall lgtm


if (data.type === 'document') {
return fileTypeToBlockName(data.subType ?? data.fileType, true);
return fileTypeToBlockName(data.subType?.type ?? data.fileType, true);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I feel like we may want to refactor fileTypeToBlockName into something more generic like documentToBlockName and pass in more of the document object to determine the block name inside of that method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good idea - ill make a follow up task for this. this PR is already kinda big

Copy link
Copy Markdown
Contributor

@seanaye seanaye left a comment

Choose a reason for hiding this comment

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

awesome, this looks great

@danielkweon danielkweon merged commit d0140a9 into main Jan 9, 2026
58 of 65 checks passed
@danielkweon danielkweon deleted the daniel/m-5453--add-properties-be-add-iscompleted-flag branch January 9, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants