Repository navigation
feat: report project size with project:project_view - #240
Merged
Merged
Conversation
Rename project:project_load to project:project_view and send it whenever a project finishes loading: the initial project at activation and when the user switches project. It was only sent from the project tree, so the normal activation path reported nothing. The event now carries message_count (bundles, counted by the database without loading them) and language_count (locales in the project settings), like Fink and Parrot, next to error_count and in_workspace_recommendation. Fire and forget, errors are swallowed, and no queries run unless usage telemetry is enabled. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The id of a project that is loaded from a directory is new on every load (@inlang/sdk: "Unpacked projects loaded into a fresh Lix receive a new id on each load"). Hashing it made every activation, project switch and reload after a file change a new project_id, so a dashboard that takes the latest message_count per project_id would count one project many times. project_id is now a salted hash of the project path and the machine id. The path itself is never sent. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
- Document that in_workspace_recommendation is Sherlock.shouldRecommend: true when Sherlock is not in the workspace recommendations yet (unchanged value). - Count no languages instead of dropping the event for settings without locales. - Say in capture that the state read must stay synchronous. - Tests: Windows path spellings and machine id of project_id, the project switching while counting, failures that must not reach capture, getProjectSize. - Changeset: a project counts once per machine and location. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Sherlock never showed up in the shared PostHog dashboard "inlang apps: usage, project size, interest" (insight "Project size: messages per project", and the languages-per-project view). Those read
project:project_viewevents (message_count,language_countperproject_id, split byapp), which Fink and Parrot send. Sherlock only sentproject:project_load(a few days old), and only when a project was clicked in the project tree. The project that opens at activation sent no project event at all.What changes
project:project_loadis renamed toproject:project_view.error_countandin_workspace_recommendationstay.activateInitialProjectSession(afterreplaceProjectcommitted) and when the user switches project in the project tree. Not on message edits, not for the reloads that follow changes of the message files on disk (those are internal reconciliations, notreplaceProjectcalls of the user).message_count: the number of bundles, as Fink counts messages. It is aSELECT count(*) FROM inlang_bundle(src/utilities/project/projectSize.ts), so no bundle or message content is loaded.language_count:settings.locales.length.collaborator_countis skipped (no cheap source in the extension).captureProjectView(src/utilities/project/projectViewTelemetry.ts) is fire and forget (void, never awaited by activation or the tree click), catches everything, and does nothing at all (no queries, no file reads) unlesslogger.isUsageEnabled. It runs its queries as a task of the project session (so the project is not closed under it) and sends nothing if the project was replaced meanwhile. The replacing project reports itself.project:project_viewmessage_count,language_count,error_count,in_workspace_recommendation(+project_id,app,app_version,vscode_version,editor,platformon every event)Second commit:
project_idwas not stablecapturehashedproject.id. For a project loaded from a directory the SDK creates a new id on every load (@inlang/sdkInlangProject.id: "Unpacked projects loaded into a fresh Lix receive a new id on each load"; I checked it by loading the same directory twice). Sherlock loads from directories, so every activation, project switch and reload after a file change would have been a newproject_id, and "latestmessage_countperproject_id" would have counted one project many times (and changedproject_idof all other Sherlock events too).project_idis now a salted hash of the project path and the machine id (hashProjectPath). The path is never sent, and the machine id in the input keeps the hash from being guessed from a path. This is a separate commit, so it can be dropped on its own if you prefer a different identity.Not changed
Sherlock: Reload projectcommand does not send the event (same project, same size).Tests
pnpm exec tsc --noEmit,pnpm run buildandpnpm testpass (the repo has no lint script,prettier --checkis clean for the changed source files). New or changed tests:projectViewTelemetry.test.ts: properties, only numbers and booleans, nothing runs with usage telemetry off, nothing is sent without a project or for a replaced project, never throws.sdk4DataIntegrity.test.ts:getProjectSizeagainst a real SDK 4 project (7 messages, 2 languages, and 8 after creating a message).main.test.ts,project.test.ts: reported once after a committed load at activation and on tree selection, not for failed or superseded loads, and activation / the tree click do not wait for it.telemetry.test.ts:isUsageEnabled, the relay payload ofproject:project_view,project_idstable across loads and not derived from the path in the clear.A patch changeset is included.
Note on
in_workspace_recommendationIts value is
Sherlock.shouldRecommend(...), sotruemeans Sherlock is not in the workspace's recommended extensions yet (the name is from the earlierproject_loadevent and the value is unchanged, so the series stays comparable).Known limit
If a reload after a file change replaces the project in the few milliseconds the counts are read, that load does not report. The next load does.
🤖 Generated with Claude Code