Rename Behaviors to Requirements - #2465
Open
harry-rhesis wants to merge 1 commit into
Open
Conversation
|
Looks good — this plan is detailed and pragmatic (esp. the silent-failure inventory + idempotent backfill + downgrade rehearsal). One concrete addition I’d suggest: include an explicit OpenAPI gate in “Verification gates” (e.g. assert generated |
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.
Purpose
Rename the Behavior domain entity to Requirement across the platform. This branch carries both the implementation plan and the work itself.
Replaces #2199, which held the original proposal and the review discussion that settled the strategy. Plan:
docs/proposals/rename-behaviors-to-requirements.md.The first commit is the plan alone. Implementation lands on top.
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 footprint
Verified against
mainatd5d4b11d0.behavio(excludingnode_modules, build output)Sharp edges the plan covers
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
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. This is the sharpest remaining path.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.Surfaces absent from the original 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." Plan recommends 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.tests/k6/common.jsload-tests/behaviors/, which would 404 after the cutover and read as a perf regression.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
701 files cannot be a 400-line PR. The plan proposes:
plan_dataround-trip before touching it.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
app/crud.pyis now the packageapp/crud/, and the explorer JSONB marker is already migrated totest_set.explorer_row(7dd69fe35db5), which removes what was the worst silent-failure risk.Still open
test-templates.ymlprompt English: change and regenerate, or leave?Testing
The plan's verification gates apply as implementation lands. Nothing to test in the plan commit itself.