ops(registry): convert stale-type backfill from script to migration#3797
Closed
EmmaLouise2018 wants to merge 2 commits into
Closed
ops(registry): convert stale-type backfill from script to migration#3797EmmaLouise2018 wants to merge 2 commits into
EmmaLouise2018 wants to merge 2 commits into
Conversation
Migration 463 replaces server/scripts/backfill-member-agent-types.ts. The TS script lived under server/scripts/ (outside server/src/), so tsc skipped it and the file never shipped to the production container — running it required a fly ssh dance that failed with ERR_MODULE_NOT_FOUND. The migration applies the same resolveAgentTypes() logic in SQL, runs automatically on the next deploy in every env, and writes its audit trail to type_reclassification_log with run_id='migration-463' in one transaction.
Changesets are append-only history. The previous commit on this branch deleted this file when removing the script — that's wrong. The original changeset describes what landed in #3541 and stays as historical record; the new migration changeset (backfill-member-agent-types-migration.md) describes the follow-up.
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.
Summary
server/scripts/backfill-member-agent-types.ts(ops(registry): backfill stale member_profiles.agents types + crawler reclassify-on-disagreement #3541) with migration463_backfill_member_agent_types_from_snapshot.sql.server/scripts/— outsideserver/src/— sotscskipped it and it never shipped to the production container. Running it viafly ssh consolefailed withERR_MODULE_NOT_FOUND.resolveAgentTypes()logic in SQL, runs automatically on the next deploy in every env, and writes its audit trail totype_reclassification_logwithrun_id='migration-463'in one transaction with the data update.What it does
For every row in
member_profiles.agentswhose URL has a row inagent_capabilities_snapshot:inferred_typeis valid → set agent'stypeto itinferred_typeis null/invalid → set'unknown'(anti type-smuggling, matchesresolveAgentTypes)Audit query post-deploy:
Test plan
npm run typecheckcleannpm run buildcleannpm run test:migrationsclean (filename pattern, no duplicate version, no gap)run_id='migration-463'rows match the JSONB diffRefs #3538, #3541, #3550.