feat(tree): add type-aware field creation in Tree view - #21
Closed
EMTumariscal wants to merge 6 commits into
Closed
EMTumariscal wants to merge 6 commits into
EMTumariscal wants to merge 6 commits into
Conversation
10 tasks
Contributor
Author
|
Superseded by #22 — consolidated PR from EMTumariscal:develop to master bundling this change with its original description preserved. Closing per maintainer request. |
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.
Description
Adds intuitive field creation to the Tree view. Hovering a document or a nested Map row reveals an Add (+) button that opens a type-aware Add Field dialog (name + type + value input adapted to the type). On save, the field is written via the existing
updateDocumentflow and the tree refreshes. Scope is documents plus nested Maps; Array indices are excluded, consistent with the existing field-deletion rule.Why: adding fields through the JSON view is possible but not intuitive, and the Table view only edits top-level fields. The Tree already models every field (including nested ones) as a node with a
docId.field.nestedpath, so it is the natural place for this.Type of Change
AI Code Generation
AI-assisted implementation (OpenCode with Muse Spark, orchestrated ODD workflow: delegated writer sub-agent for TD-1/TD-2, human-reviewed). All commits verified with typecheck, tests, scoped lint/format. Native receipt-driven review ran on the slice (medium risk): reviewer raised 3 findings (1 BLOCKER timestamp NaN guard, 2 CRITICAL parent-path fallback and JSON-clone lossiness); the bounded correction fixed 2, the validator rejected it over the remaining BLOCKER, and the BLOCKER was then fixed as ordinary follow-up work. Review ended escalated (terminal stop) — outcome is informational only.
Related Issue
No related issue exists in the tracker; this addresses the maintainer request for intuitive field creation in Tree view.
Technical Context
getValueType/getTypeColorinsrc/features/collectionsshared utils (String, Integer, Number, Boolean, Null, Timestamp, GeoPoint, Array, Map, Reference).AddDocumentDialog/EditDialog(Ctrl+Enter, monospace inputs, Type badge);datetime-localinput likeTreeNodeRow/DatePopover.documentService.prepareAddData(dot-path set, duplicate/empty/dots/Array rejection, structuredClone with JSON fallback) ->TreeContext.onAddField->CollectionTab->updateDocumentthunk.TreeNodeRow, invalid-date guard inAddFieldDialog.odd/tasks/tree-add-fields.md(shipped in this PR as the feature record).Test Environment
pnpm run lint(only 1 pre-existing warning in untouchedelectron/controllers/firebaseController.js),pnpm run format:checkclean,pnpm run typecheckclean,pnpm run test89/89 passing across 12 filesEvidence
pnpm run test: Test Files 12 passed, Tests 89 passedpnpm run typecheck: clean (tsc --noEmit)3623546AddFieldDialog,a22afacadd plumbing,faac5e2review-correction hardening,0207f8btimestamp guard, plus docs commitsChecklist
size:exception(single cohesive feature; splitting dialog vs plumbing would not leave independently shippable slices)Size
~596 insertions / 1 deletion across 7 files (188 lines are the ODD feature record). Requesting
size:exceptionfor a single PR.