Skip to content

refactor: restore git skill worked examples, type-tighten TableHelper.observe()#1538

Merged
braden-w merged 3 commits intomainfrom
revert-git-skill-compression
Mar 18, 2026
Merged

refactor: restore git skill worked examples, type-tighten TableHelper.observe()#1538
braden-w merged 3 commits intomainfrom
revert-git-skill-compression

Conversation

@braden-w
Copy link
Member

Two independent housekeeping items that don't warrant separate PRs given their small scope.

Git skill restoration

The compression in commits 4ca8844–0dadacd removed worked diagram examples, the 9-section PR structure, and contextual guidance from the git skill. In practice, the verbose version produces measurably better PR descriptions because the worked examples use our actual vocabulary (YKeyValue, TableHelper, composition trees with O(n) annotations) to set a quality bar that generic principles can't match.

This restores the full version, then makes two targeted cuts that are genuine redundancies:

  • Duplicate changelog section (lines 439–464 were an exact copy of rules already at 107–134)
  • "When to Use Diagrams" summary list (each diagram subsection header already states when to use it)

Net result: 595 lines, down from the original 631 but with all worked examples intact.

Type-tighten TableHelper.observe()

observe() previously passed Set<string> for changed IDs, forcing consumers with branded ID types to cast at every usage:

// Before — identity casts everywhere
tabs.observe((changedIds) => {
  for (const id of changedIds) {
    const parsed = parseTabId(id as TabCompositeId);  // unnecessary
  }
});
// After — branded types flow through
tabs.observe((changedIds) => {
  for (const id of changedIds) {
    const parsed = parseTabId(id);  // id is already TabCompositeId
  }
});

Changed the callback signature to ReadonlySet<TRow['id']>. One cast in infrastructure (table-helper.ts) replaces 3+ casts at consumer sites. ReadonlySet is covariant (no .add()), so ReadonlySet<TabCompositeId> remains assignable to ReadonlySet<string> for any consumer that doesn't use branded types.

Two clean cuts:

- Duplicate changelog section (lines 439-464): exact copy of the
  changelog rules already defined at lines 107-134
- "When to Use Diagrams" consolidated list (lines 366-374): each
  diagram subsection header already states when to use that type,
  making the summary redundant

All worked examples, the interleaving prose/visuals tutorial, and
the 9-section PR structure are preserved. 631 → 595 lines.
…t<TRow['id']>

Derive observer ID type from the row's id field so branded types
(TabCompositeId, WindowCompositeId, etc.) flow through without casts
at every consumer site.

- types.ts: Set<string> → ReadonlySet<TRow['id']> in observe signature
- table-helper.ts: single infrastructure cast bridges CRDT string keys
  to domain-level branded types
- browser-state.svelte.ts: remove 3 now-redundant as-casts
- table-helper.test.ts: Set<string>[] → ReadonlySet<string>[] for
  direct changedIds push
…-actions

Tab rows from findDuplicateGroups/groupTabsByDomain already carry
TabCompositeId on t.id — the as-casts were identity casts.
@braden-w braden-w merged commit 9486f4c into main Mar 18, 2026
1 of 10 checks passed
@braden-w braden-w deleted the revert-git-skill-compression branch March 18, 2026 01:44
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.

1 participant