Repository navigation
Rewrite stale example provenance on pre-#400 duplicates - #445
Merged
Merged
Conversation
Before #400, duplicating a project copied the original's source, so copies of example projects kept reporting the original's exampleId to metrics on every run. When a library project is opened, detect such a copy (example source and a "(copy)" display name or a -copy / -copy-N dirName) and rewrite its source to { type: "duplicate" } once. Quick projects and genuine example projects, renamed or not, are left alone. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HB39E3Y4jpon2ijSXT7emN
andeplane
marked this pull request as ready for review
October 16, 2026 06:45
Brings the #403 stale-duplicate migration up to date with main, which split src/store/projects.ts into src/store/projects/ (#462). Conflict resolution (src/store/projects.ts modify/delete): took main's deletion and ported the PR's change onto the new modules: - isStaleExampleCopy (+ COPY_DIR_NAME) moved to src/store/projects/helpers.ts, next to isScriptFile. - The one-time source rewrite in openProject moved to src/store/projects/library.ts. - src/store/projects.test.ts moved to src/store/projects/helpers.test.ts, importing from ./helpers. src/store/projects.integration.test.ts auto-merged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HB39E3Y4jpon2ijSXT7emN
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HB39E3Y4jpon2ijSXT7emN
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.
Requested by Anders Hafreager · project thread
Before: projects duplicated before #400 still have
source: { type: "example", exampleId }in their project.json, so every run of them reports the original example's id to Mixpanel (Run.Start,Run.Finish,Simulation.Start) and inflates that example's numbers.After: opening such a project rewrites its source to
{ type: "duplicate" }on disk, once, and its runs report as a normal project. Genuine example projects, renamed or not, and quick projects are left alone.How:
openProjectchecks a newisStaleExampleCopy(meta): an example source whose display name ends in "(copy)" or whose dirName ends in-copy/-copy-N, which is howduplicateProjectnames copies. Comparing dirName withexampleIddoesn't work, because example projects getdirName = slug(displayName). Unit tests cover the check, and integration tests cover the on-disk rewrite, the metrics payload afterwards, and the untouched cases.Closes #403
🤖 Generated with Claude Code
https://claude.ai/code/session_01HB39E3Y4jpon2ijSXT7emN
Generated by Claude Code