Attribute template-import commits to a System author#2393
Conversation
A scoped CommitMetadataInterceptor stamps only the template-import commits as the System author (and flags them Template); later user edits keep their real author. The activity view shows System and stops pinning special authors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Folds the runtime-composed "New Project" + "(Local only)" label (HomeView) into one translatable msgid across all locales. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds ChangesBackend: Template commit metadata stamping
Frontend: System author UI and locale updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/FwLite/LcmCrdt/CommitMetadataInterceptor.cs`:
- Around line 12-21: The current CommitMetadataInterceptor stores the override
in the scoped _interceptor field, so concurrent commits can leak one operation’s
metadata into another. Update CommitMetadataInterceptor.Intercept and Apply to
bind the override to the async execution context instead of the shared instance
state, using a per-flow storage mechanism so each commit only sees its own
CommitMetadata interceptor. Keep the IDisposable restore behavior tied to that
same flow-specific override rather than the singleton field.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d1ca1a31-9156-4393-aae3-3f585bf91cf7
📒 Files selected for processing (18)
backend/FwLite/LcmCrdt.Tests/OpenProjectTests.csbackend/FwLite/LcmCrdt/CommitMetadataInterceptor.csbackend/FwLite/LcmCrdt/CrdtMiniLcmApi.csbackend/FwLite/LcmCrdt/CrdtProjectsService.csbackend/FwLite/LcmCrdt/LcmCrdtKernel.csbackend/FwLite/LcmCrdt/Utils/CommitHelpers.csfrontend/viewer/src/home/CreateProjectDialog.sveltefrontend/viewer/src/home/HomeView.sveltefrontend/viewer/src/lib/activity/ActivityFilter.sveltefrontend/viewer/src/lib/activity/utils.tsfrontend/viewer/src/locales/en.pofrontend/viewer/src/locales/es.pofrontend/viewer/src/locales/fr.pofrontend/viewer/src/locales/id.pofrontend/viewer/src/locales/ko.pofrontend/viewer/src/locales/ms.pofrontend/viewer/src/locales/sw.pofrontend/viewer/src/locales/vi.po
💤 Files with no reviewable changes (1)
- frontend/viewer/src/home/CreateProjectDialog.svelte
hahn-kev
left a comment
There was a problem hiding this comment.
I'd like to use an AsyncLocal in the interceptor
Store the interceptor in an AsyncLocal instead of a shared field so a template-import override can't leak into a concurrent commit made through the same DI-scoped CrdtMiniLcmApi. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The Select.Item label prop fell back to "Unknown" for the System author (authorName is null by design), so typeahead couldn't jump to it. Use authorKeyToLabel(key), which resolves the System/Unknown display names. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ActivityView and ActivityItem rendered author from the raw authorName, which is null for template (System) commits, so they showed "Unknown". Resolve the well-known label from authorId (as the filter already does) before falling back to authorName, then "Unknown". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Extract the author name + well-known icon (FieldWorks logo, System cog) into a single AuthorLabel component and use it in the filter dropdown/trigger and the activity list and detail views, so the icons show everywhere a well-known author is displayed — not just in the filter. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Default the icon to size-4 (matches the text-sm activity list and detail views) and have the author filter opt into size-5 explicitly, restoring the filter's original icon size. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The FieldWorks logo reads best at size-5 and the System cog at size-4 in every context, so hardcode each and drop the iconClass prop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Builds on #2281 (template-based project creation, already merged). A scoped
CommitMetadataInterceptorstamps only the template-import commits as a well-known System author (and flags themTemplate); later user edits keep their real author. The activity view shows "System" and stops pinning special authors.Drive-by fixes found while polishing #2281:
New Project+(Local only)label into one translatable msgid (re-extracted catalogs).codeinCreateProjectDialog.openDialog.Test plan
LcmCrdt.TestsOpenProjectTests— 17 pass, incl. System-author stamping, interceptor scope/restore, and template identity.pnpm --filter viewer run check— 0 errors.