You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Work logs: add a real team_id instead of encoding [team:slug] in the description #425
Today, team association on a work log is encoded as a [team:slug] prefix jammed into the free-text description (a documented workaround in the dogfood script), rather than a real column. That makes team reporting/filtering unreliable — it depends on nobody editing the description and can't be indexed or joined cleanly.
Add a team_id (or join table) to core.work_logs, backfill existing rows by parsing the [team:slug] prefix, and add a real team selector/filter to the Logs UI. This is called out directly in the Phase 3 backlog and blocks accurate per-team reporting.
Done in 2f975434a (migration 339), deployed to production.
Column:core.work_logs.team_id, nullable FK to core.teams with ON DELETE SET NULL so removing a team can't destroy work history, plus a partial index on (team_id, log_date DESC) — the query the prefix could never serve.
Backfill resolves each encoded slug within the log's own organization, which needed two things worth recording:
work_logs.project_id references core.construction_projects, not core.projects, despite the column name. Joining the obvious table returned zero matches.
Team slugs are org-namespaced, so the short frontend in a description maps to unicorn-frontend. Deriving the prefix from the organization rather than hardcoding unicorn- keeps it correct for any org.
Verified before writing: all 54 prefixed rows in local resolve to a team, none orphan. Production work_logs is empty, so nothing to backfill there. The prefix is only stripped from rows where a team was actually captured — an unresolvable one stays visible rather than being silently discarded, since it's the only remaining record of intent.
teamId flows through create, update, and a list filter. Placing that filter surfaced a latent bug: the org-admin branch rebuilds the query with the service client, discarding anything applied earlier. projectId was applied early, so it was silently ignored whenever organizationId was also supplied. Both now sit in the block already labelled "common filters (apply to both user-scope and org-scope queries)".
Verified end to end against the local API:
log written by dogfood-log.ts -> team_id = unicorn-infra, description clean
?teamId=unicorn-infra -> 10 logs distinct team_id: 1 ✓
no filter -> 28 logs distinct team_id: 4
Callers updated.dogfood-log.ts resolves the team by slug instead of prepending. phase2-seed.ts drops the team prefix but keeps [phase2:key=…] — that's its idempotency marker, matched with a %…% wildcard so position doesn't matter — and resolves team ids by slug rather than hardcoding, since seed team ids are random per reset unlike the project ids.
One piece needs a separate PR: the SDK gained teamId on create/update/list params and team_id on the returned row. It's a git submodule, so that half needs its own PR in Scaffald/sdk plus a pointer bump here. The dist is rebuilt locally so this repo type-checks and runs today.
DOGFOODING.md's Phase 3 backlog entry is struck through.
Activity
feat(work-logs): give logs a real team_id and retire the [team:slug] …
thinkclay commentedon Jul 30, 2026
Done in
2f975434a(migration 339), deployed to production.Column:
core.work_logs.team_id, nullable FK tocore.teamswithON DELETE SET NULLso removing a team can't destroy work history, plus a partial index on(team_id, log_date DESC)— the query the prefix could never serve.Backfill resolves each encoded slug within the log's own organization, which needed two things worth recording:
work_logs.project_idreferencescore.construction_projects, notcore.projects, despite the column name. Joining the obvious table returned zero matches.frontendin a description maps tounicorn-frontend. Deriving the prefix from the organization rather than hardcodingunicorn-keeps it correct for any org.Verified before writing: all 54 prefixed rows in local resolve to a team, none orphan. Production
work_logsis empty, so nothing to backfill there. The prefix is only stripped from rows where a team was actually captured — an unresolvable one stays visible rather than being silently discarded, since it's the only remaining record of intent.teamIdflows through create, update, and a list filter. Placing that filter surfaced a latent bug: the org-admin branch rebuilds the query with the service client, discarding anything applied earlier.projectIdwas applied early, so it was silently ignored wheneverorganizationIdwas also supplied. Both now sit in the block already labelled "common filters (apply to both user-scope and org-scope queries)".Verified end to end against the local API:
Callers updated.
dogfood-log.tsresolves the team by slug instead of prepending.phase2-seed.tsdrops the team prefix but keeps[phase2:key=…]— that's its idempotency marker, matched with a%…%wildcard so position doesn't matter — and resolves team ids by slug rather than hardcoding, since seed team ids are random per reset unlike the project ids.One piece needs a separate PR: the SDK gained
teamIdon create/update/list params andteam_idon the returned row. It's a git submodule, so that half needs its own PR inScaffald/sdkplus a pointer bump here. Thedistis rebuilt locally so this repo type-checks and runs today.DOGFOODING.md's Phase 3 backlog entry is struck through.feat(work-logs): expose team_id / teamId (#10)
chore(sdk): bump submodule to pick up work-log teamId
docs: log 2026-07-27 feature-idea routine run (#426)