Title: fix(file-search): store workspace file revisions at millisecond precision by waleedlatif1 · Pull Request #7941 · simstudioai/sim · GitHub
Open Graph Title: fix(file-search): store workspace file revisions at millisecond precision by waleedlatif1 · Pull Request #7941 · simstudioai/sim
X Title: fix(file-search): store workspace file revisions at millisecond precision by waleedlatif1 · Pull Request #7941 · simstudioai/sim
Description: Summary workspace_files.content_updated_at is a revision identity that round-trips through JavaScript Date and JSON (both millisecond), while now() stores microseconds. A sub-millisecond revision stops comparing equal to its own round-trip, so every SQL equality keyed on it matches zero rows — the file is never claimed, never indexed, and never cleaned up, because the only cleanup path (markTerminal) is itself gated behind being dispatched. Migration 0357 truncates the column default and adds a BEFORE INSERT OR UPDATE trigger for the writers a default cannot reach: explicit CURRENT_TIMESTAMP expressions, raw SQL inserts, and any UPDATE. It is DDL-only, so it stays idempotent under the autocommit path a fresh install takes after 0355's embedded COMMIT, and holds its lock for DDL rather than for a data rewrite. Script migration 0018 retires the rows minted before the invariant existed, keyset-paginated and batched. Each batch is one transaction so the secret_provenance_version that workspace_files_secret_provenance_demote nulls is restored with its sidecar, instead of being lost if a run dies midway. Scoped to context = 'workspace', live and soft-deleted: those are the rows the search index keys on, and a soft-deleted row is restored by paths that do not rewrite the column. Other contexts are never search-indexed and only compare this column in JavaScript, where both sides are already millisecond; the trigger normalizes them on their next content write. The trigger name sorts before workspace_files_secret_provenance_demote, so that trigger's WHEN clause compares the normalized value and a write that does not change the millisecond revision no longer demotes provenance. There is a test for both directions. No application code changes. Complements #7940, which bounds the claim query: that made the dispatcher cheap, this makes the rows claimable. Type of Change Bug fix Testing 10 PostgreSQL 17 tests covering the invariant (default expression, explicit microsecond write, CURRENT_TIMESTAMP restore write, trigger ordering vs provenance demotion in both directions) and the repair (scoping, sidecar realignment, orphaned index/segment rows, replay no-op, keyset progress). Wired into the existing packages/db CI step. Verified the repair against a seeded 5.6M-row workspace_files: 94,196 rows repaired in 2.4s, replay a 0.5s no-op, other contexts untouched, tracked provenance versions and sidecars preserved. Verified 0357 applies and replays cleanly both in autocommit and inside a transaction. bun run lint, all 46 audits, docs-manifest:check, check:migrations origin/staging, and type-check pass. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
Open Graph Description: Summary workspace_files.content_updated_at is a revision identity that round-trips through JavaScript Date and JSON (both millisecond), while now() stores microseconds. A sub-millisecond revision ...
X Description: Summary workspace_files.content_updated_at is a revision identity that round-trips through JavaScript Date and JSON (both millisecond), while now() stores microseconds. A sub-millisecond revision ...
Opengraph URL: https://github.com/simstudioai/sim/pull/7941
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:554b82a3-f489-e8e7-bdf7-a68ca3140768 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8ADE:19FA2E:BEAFB6:10D96EF:6AFB5C7B |
| html-safe-nonce | 861b58518a21e8def5ae49dd491fa33cd738fc500c9d8624cb59a55a271da435 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QURFOjE5RkEyRTpCRUFGQjY6MTBEOTZFRjo2QUZCNUM3QiIsInZpc2l0b3JfaWQiOiI0MjQ0NDM3ODgyNzA0NjAwMjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 53a2d2f739edb85f496e953e73e7c7b6c658efd752fc00ccc811dfd2b68225fe |
| hovercard-subject-tag | pull_request:4562788192 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/7941/files |
| twitter:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40672544?s=400&v=4 |
| og:image:alt | Summary workspace_files.content_updated_at is a revision identity that round-trips through JavaScript Date and JSON (both millisecond), while now() stores microseconds. A sub-millisecond revision ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ea33d13c96d0ff66bd8fa906b193d2213536b78cb06b0c50a4632c58b1418f94 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/simstudioai/sim git https://github.com/simstudioai/sim.git |
| octolytics-dimension-user_id | 199344406 |
| octolytics-dimension-user_login | simstudioai |
| octolytics-dimension-repository_id | 912559512 |
| octolytics-dimension-repository_nwo | simstudioai/sim |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 912559512 |
| octolytics-dimension-repository_network_root_nwo | simstudioai/sim |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 59ef97164c52cf59bd10558ddec9c4f482763988 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width