Add implementation plan for Behaviors to Requirements rename - #2199
Add implementation plan for Behaviors to Requirements rename#2199nicolai-rhesis wants to merge 3 commits into
Conversation
Add a draft proposal for feedback covering inventory, phased migration, compatibility strategy, and open decisions before any code changes.
|
Thanks @nicolai-rhesis, this is a thorough proposal. The inventory and phase breakdown made it easy to audit for gaps, and the compatibility matrix is a genuinely useful reference regardless of which rollout approach we pick. On phased vs. big bang I'd like to make the case for doing this as a single PR (DB, backend, frontend, SDK together) rather than the phased, compatibility-first rollout in Phases 1-7. The core issue is that Behavior isn't an isolated entity. It's woven through a chain: org bootstrap seed data defines the default behavior names, the Garak security-probe taxonomy hardcodes those same names on both the backend and the SDK, the MCP tool contract exposes them as tool names to external agents, and stats/insights read them back out. A phased rollout means holding two vocabularies in sync across that entire chain for months; every new org seeded during the deprecation window, every Garak probe mapping, every stats view has to agree on which name is authoritative at that moment. That's a lot of surface area for the old and new names to quietly drift out of sync, and the failure mode is subtle (wrong label somewhere, not a crash) so it can sit unnoticed for a while. There's also a cost multiplier: Phase 2 stands up dual API paths and dual-read, and Phase 7 tears them back out. That's building the compatibility layer once and then unbuilding it later, for the same end state we'd reach directly with one migration. Given this is an internal product entity with no existing external announcement or SLA around Concretely I'd propose: rename tables, columns, routes, permission strings, MCP tool names, enums, and stored-value writers all in the same PR (DB Option B folded into the main change, not deferred), with no aliases or dual-read. It's a bigger single PR, but it's one atomic, testable change instead of two. Blind spots found while auditing against the inventory I went through the codebase looking for anywhere Behavior shows up that isn't in the current inventory. Flagging these so the plan accounts for them regardless of which rollout approach we go with: Backend / data pipeline
Frontend
Docs
Tests / tooling
Happy to help turn this into the single-PR plan if that direction makes sense to the team. |
|
Closing in favour of #2465, which carries the plan and the implementation on The strategy discussion in this thread is what settled the approach, so it stays here as the record: phased/compatibility-first was rejected in favour of a single atomic cutover with the DB rename folded in and no aliases. Two corrections came out of re-verifying the inventory against current
Footprint re-measured at 701 files / ~6,540 lines. |
Purpose
Lock the decisions for renaming the Behavior domain entity to Requirement, and replace the original phased proposal with an implementation plan we can execute against.
This PR is still docs-only. No product code is renamed. Full plan:
docs/proposals/rename-behaviors-to-requirements.md.What Changed
Decisions locked
Requirementonto tablebehaviorindefinitely, and every raw-SQL site keeps the old name. Two migrations for one end state./behaviorshas no external announcement or SLA. Building a compatibility layer in one release and tearing it out in another is cost with no consumer./behaviorskeeps a permanent redirectReliability,Robustness,Complianceare referenced by name frominitial_data.json,garak/taxonomy.py, andgarak/detectors.yaml. The entity is renamed; its instances are not.Measured size
behavio(excludingnode_modules, build output)Gaps found in the second audit
Database objects a table rename does not follow
Postgres does not rewrite function bodies, policy names, index names, or view output aliases.
alembic/delete_user_and_organization_data.sqlis a PL/pgSQL function with a hardcoded table-name array andDELETE FROM behavior. After a rename it references a table that no longer exists, and it fails only at org-deletion time. NeedsCREATE OR REPLACE FUNCTION.b.name AS behavior_name. That alias is baked into the view definition, so the views need DROP and CREATE, not a rename.app/services/annotations.pyruns raw SQL joiningbehaviorwithbehavior_id/behavior_namealiases. No ORM rename touches it.behavior, the auto-RLS trigger table list, and the reference copy inalembic/row_level_security.sql.Stored data that breaks silently
test_set.attributes['metadata']['behaviors']is a JSONB key read by the filter atcrud.py:587that excludes explorer test sets from the main test-sets list. Rename the key without a backfill and every historical explorer test set reappears in that list. Silent and user-visible.architect_session.plan_datapersists the Architect plan with keysbehaviors,behavior_metric_mappings,behavior. Renaming the Pydantic fields insdk/.../architect/plan.pywithout backfilling breaks deserialization of every saved session.behavior_metric_coverage,MetricsSource.BEHAVIOR, stats modebehaviorand metric keybehavior_pass_rates,type_lookuprowBehavior,PlanCategory.BEHAVIOR.role_permissionrows keyed onpermission.id, so the migration mustUPDATE permission SET namein place. Delete-and-insert orphans every custom grant.Areas absent from the first inventory
skills/rhesis/(21 files, ~200 refs). Published and installed by users vianpx skills add rhesis-ai/rhesis.references/tool-catalog.mdmirrors the MCP tool names and must move withmcp_tools.yaml.penelope/(19 files), a separate package with prompt templates and 9 examples.skills/rhesis/references/requirements-workflow.mdanddocs/content/docs/agent-skill/requirements.mdxalready use "Requirements" to mean the input PRD, with behaviors as the derived entity. After the rename that reads as "build requirements from your requirements." Recommend renaming the input concept to "spec".docs/sphinx/source/rhesis.entities.rsthas.. autoclass:: rhesis.sdk.entities.Behavior, which breaks the SDK API docs build if missed.docs/content/glossary/glossary-terms.jsonl(35 lines of structured data, separate from the glossary MDX pages), anddocs/src/public/diagrams/user-journey.excalidraw, which needs re-export rather than a text edit.docs/content/contribute/backend/odata-guide.mdx(39 refs). OData navigation property names come from ORM relationship names, so$filter=behavior/nameis a user-facing contract that changes._BEHAVIOR_TOOLSinagents/architect/agent.pyhardcodes MCP tool names, so it must land in the same commit asmcp_tools.yamlor Architect silently stops recognizing entity tool calls.apps/frontend/src/config/test-templates.generated.tsmust be regenerated viascripts/generate-templates.js, not hand-edited.NEXT_PUBLIC_BEHAVIORS_EMPTY_STATE_VIDEO_URLand..._ARTICLE_URLSare set in the deploy environment, outside any diff.Execution shape
668 files cannot be a 400-line PR. The plan proposes:
Plus a release checklist for the deploy-environment env vars, the migrate-before-deploy ordering, and the SDK major bump.
Verification gates
Line-by-line review cannot carry a 6,000-line diff, so the plan leans on mechanical checks: a source sweep against an explicit allowlist of things we deliberately do not rename, eight Postgres catalog queries (including
pg_proc.prosrc, which is what catches the delete-org function), row-level assertions against a restored production snapshot, behavioral checks for the silent-failure paths, and a testedalembic downgraderehearsal.Additional Context
Still open
test-templates.ymlprompt English: change and regenerate, or leave?Testing
N/A. Documentation only. The plan's own verification gates apply to the implementation PRs that follow.