plan repository-wide behavior ownership catalogue - #290
Conversation
📝 WalkthroughWalkthroughWS-QUAL-002 adds planning documents and chunk contracts for a versioned behavior ownership catalogue. The documents define ownership population, validation, protected-base custody, changed-line mutation selection, rollout boundaries, risks, and human approvals. ChangesBehavior ownership catalogue
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
0a9bae6 to
20f173b
Compare
There was a problem hiding this comment.
Actionable comments posted: 9
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-01-catalogue-foundation.md:
- Around line 57-60: The catalogue foundation must define and protect one
canonical, versioned machine-readable partition artifact, including its path,
schema version, and custody rules. Update the acceptance criteria and related
`WS-QUAL-002-03A` through `WS-QUAL-002-03D` work so every branch consumes that
immutable artifact, while validation rejects missing, relocated, branch-local,
or modified copies.
- Around line 31-41: Restrict each chunk’s Allowed files section so chunks
cannot modify parent or sibling contracts: in
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-01-catalogue-foundation.md
(lines 31-41), permit only foundation outputs plus explicitly approved
status/evidence files; apply the corresponding context-evidence restrictions in
WS-QUAL-002-02-context-evidence.md (lines 17-25), and limit
WS-QUAL-002-03A-auth-ownership.md (lines 17-21),
WS-QUAL-002-03B-artifact-ownership.md (lines 17-21), and
WS-QUAL-002-03C-lifecycle-ownership.md (lines 17-21) to their respective
ownership outputs and approved status/evidence files.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-02-context-evidence.md:
- Around line 31-37: Update the artifact whitelist acceptance criterion to
preserve exact test-run custody: include lane identity, collection and
completion status, skip/deselect status, and an artifact digest or immutable
manifest reference, matching the contract in
WS-CI-001-02B-exact-custody-semantic-test-lanes.md. Keep the prohibition on
secrets and sensitive runtime data, and ensure stale, partial, skipped, or
overwritten coverage cannot be treated as valid candidate evidence.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03B-artifact-ownership.md:
- Around line 30-34: Update the acceptance criteria in
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03B-artifact-ownership.md
lines 30-34 to require applicable filesystem, S3/MinIO, archive, and
external-adapter boundary evidence, not mocked-only tests. Update the acceptance
criteria in
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03C-lifecycle-ownership.md
lines 30-34 to require applicable database and outbox evidence for transaction,
idempotency, revision, and concurrency behavior.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03D-shared-ownership.md:
- Around line 31-34: Define a machine-readable structural_only status and
required reason in the ownership record contract used by _read_claim; reject
callable and test fields for that status while preserving callable/test
requirements for executable records. Update --run-owned-tests and the validator
to exclude structural_only records, and add a completeness test covering the
no-executable-callable case documented in DISCOVERY.md.
- Around line 20-25: Update the validator’s partition-loading logic for the
shared ownership targets defined by WS-QUAL-002-01 to read only from the
protected base or an approved foundation commit, never the population PR’s
working tree. Detect changes to that machine-readable partition in population
PRs and fail closed before validation, preserving the fixed no-overlap scope.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-05-mutation-reactivation.md:
- Around line 35-38: Extend the selection contract around changed_callables() in
backend/scripts/mutation_policy.py to include each changed executable line or
span alongside its containing callable. Update the mutation runner to consume
these changed-line spans when constructing its final mutation input, rather than
selecting whole callables. Revise the negative test to inspect and reject the
runner’s final mutation input when unchanged executable sibling lines are
included.
In @.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md:
- Around line 61-70: Update the rollout-boundary plan to require a blocking
pre-reactivation check that scans workflows, scripts, and configuration for
references to the retired callable-wide workflow and its selectors, rejecting
any matches. Keep 05M retired until this validation passes alongside the
existing hosted-evidence requirements.
- Around line 37-40: Update the behavior-ownership plan to define remap
resolution before protected-base selection: specify stable callable identity,
how a PR-head remap supersedes the old protected-base record without narrowing
ownership, and validation that produces exactly one effective owner for every
changed line. Preserve additive PR-head semantics and the exact Git delta as the
changed-callable source.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 95a25798-e577-47ef-8e95-4b4365a26b0e
📒 Files selected for processing (15)
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/CHUNK_MAP.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/DECISIONS.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/DISCOVERY.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/INTENT.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/RISKS.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/STATUS.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-01-catalogue-foundation.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-02-context-evidence.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03A-auth-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03B-artifact-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03C-lifecycle-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03D-shared-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-05-mutation-reactivation.md
| - [ ] Every target assigned to `shared` by the foundation partition is reviewed or structural-only; no other target is changed. | ||
| - [ ] Composition, DB, lock, async-execution, and script boundaries are explicit. | ||
| - [ ] No target appears in multiple groups. | ||
| - [ ] The validator collects and runs every exact pytest node referenced by changed records. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Define a machine-readable structural_only record.
Line 31 permits structural-only targets, but the supplied _read_claim contract in backend/scripts/mutation_policy.py Lines 297-387 requires every claim to contain at least one callable and one test. This chunk does not define how a structural-only target is stored or how --run-owned-tests handles it.
Add an explicit status and reason for structural-only records. Reject callable and test fields for that status. Exclude those records from owned-test execution. Add a completeness test for the no-executable-callable case identified in DISCOVERY.md Lines 66-67.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03D-shared-ownership.md
around lines 31 - 34, Define a machine-readable structural_only status and
required reason in the ownership record contract used by _read_claim; reject
callable and test fields for that status while preserving callable/test
requirements for executable records. Update --run-owned-tests and the validator
to exclude structural_only records, and add a completeness test covering the
no-executable-callable case documented in DISCOVERY.md.
| - [ ] Existing callables resolve from the catalogue physically loaded from the exact protected base SHA, never from PR head, without manual claims. | ||
| - [ ] Selection contains only changed executable lines and their exact containing callables; unchanged executable lines fail closed if selected. | ||
| - [ ] Negative tests prove that a one-line executable change selects only that line, never unchanged executable sibling lines in the same callable. | ||
| - [ ] Negative tests reject unchanged executable lines, callable-wide/full-callable selectors, and any new workflow reference to the retired `mutation-pilot.yml`. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Pass changed executable lines to the mutation engine.
Lines 36-38 require line-level selection, but the supplied changed_callables() contract in backend/scripts/mutation_policy.py Lines 271-294 returns callable names only. A selector that passes only those names can still mutate every executable line in a callable.
Add an explicit changed-line or span field to the selection contract. Require the mutation runner to consume that field. Make the negative test assert the runner’s final mutation input, not only the derived callable set.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-05-mutation-reactivation.md
around lines 35 - 38, Extend the selection contract around changed_callables()
in backend/scripts/mutation_policy.py to include each changed executable line or
span alongside its containing callable. Update the mutation runner to consume
these changed-line spans when constructing its final mutation input, rather than
selecting whole callables. Revise the negative test to inspect and reject the
runner’s final mutation input when unchanged executable sibling lines are
included.
| ## Rollout boundary | ||
|
|
||
| The 05M workflow remains retired. Mutation enforcement may return only through | ||
| the final human-approved changed-line-aware reactivation chunk after hosted | ||
| evidence proves the catalogue path and excludes unchanged lines. Population work | ||
| may proceed concurrently only after both the schema/generator foundation with | ||
| its target partition (`01`) and observational context evidence (`02`) merge. | ||
| The observational context prototype is local/manual and adds no workflow; | ||
| chunk `05` is the first chunk allowed to add a new workflow or reactivate | ||
| mutation enforcement. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Add a blocking check for retired workflow references.
The rollout boundary states that 05M remains retired. It does not require rejection of references to the callable-wide workflow or its selectors. Before reactivation, validate that workflows, scripts, and configuration contain no retired-workflow references.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md
around lines 61 - 70, Update the rollout-boundary plan to require a blocking
pre-reactivation check that scans workflows, scripts, and configuration for
references to the retired callable-wide workflow and its selectors, rejecting
any matches. Keep 05M retired until this validation passes alongside the
existing hosted-evidence requirements.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md:
- Around line 25-27: Remove the chunk’s own contract file from the
allowed-files/write-set list in the WS-QUAL-002-04 scope, while retaining
STATUS.md and the review files. Ensure changes to the chunk contract require
parent-level approval rather than being authorized by the chunk itself.
In @.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md:
- Around line 42-50: Update the behavior catalogue schema and
effective-selection rules to require unique behavior_id values across protected
records and one-to-one supersedes_behavior_id mappings. In the selection logic
described by the plan, reject duplicate reviewed owners for any behavior ID and
fail closed before resolving mutation input, while preserving the existing
zero-or-multiple effective-owner failure behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ad2cc6e9-2c1f-4f55-9170-eece3cd40b56
📒 Files selected for processing (9)
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-01-catalogue-foundation.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-02-context-evidence.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03A-auth-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03B-artifact-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03C-lifecycle-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03D-shared-ownership.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-05-mutation-reactivation.md
🚧 Files skipped from review as they are similar to previous changes (5)
- .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-02-context-evidence.md
- .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03B-artifact-ownership.md
- .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03A-auth-ownership.md
- .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-05-mutation-reactivation.md
- .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-03C-lifecycle-ownership.md
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/STATUS.md | ||
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md | ||
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/reviews/WS-QUAL-002-04-* |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Keep the chunk contract outside its own write set.
The allowed-files list includes .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md. If this list controls write scope, the chunk can change its own allowed files or acceptance criteria. Remove the chunk contract from its own write set. Require parent-level approval for contract changes.
Proposed boundary fix
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/STATUS.md
-.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/reviews/WS-QUAL-002-04-*📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/STATUS.md | |
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md | |
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/reviews/WS-QUAL-002-04-* | |
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/STATUS.md | |
| .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/reviews/WS-QUAL-002-04-* |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/chunks/WS-QUAL-002-04-completeness-preparation.md
around lines 25 - 27, Remove the chunk’s own contract file from the
allowed-files/write-set list in the WS-QUAL-002-04 scope, while retaining
STATUS.md and the review files. Ensure changes to the chunk contract require
parent-level approval rather than being authorized by the chunk itself.
| Each reviewed behavior has an immutable `behavior_id`; its current location is | ||
| the exact `(target_path, AST-qualified callable name)` binding. A remap record | ||
| names `supersedes_behavior_id`, is admitted only when the exact Git delta proves | ||
| the protected location is absent or renamed and the PR-head location exists, | ||
| and carries forward every protected owning test, outcome, and real boundary | ||
| unless a separately reviewed ownership change adds stronger evidence. Effective | ||
| selection resolves the superseded binding before mutation input and must yield | ||
| exactly one reviewed owner for every changed executable line; zero or multiple | ||
| effective owners fail closed. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Expect explicit uniqueness and one-to-one supersession validation.
rg -n -C 4 \
'behavior_id|supersedes_behavior_id|unique|duplicate|collision' \
.ci backend scripts .agent-loopRepository: Flow-Research/workstream
Length of output: 50383
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '## Candidate files\n'
git ls-files '.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/**' | sort
printf '\n## Targeted occurrences in WS-QUAL-002 initiative\n'
rg -n -C 3 \
'\b(behavior_id|supersedes_behavior_id|unique|collision|duplicate|exactly one|effective owner|zero or multiple)\b' \
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue
printf '\n## Plan lines 1-110\n'
sed -n '1,110p' .agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md | nl -baRepository: Flow-Research/workstream
Length of output: 12172
Require unique behavior identities before selection.
The plan makes behavior_id immutable and fail-closed for zero/multiple effective owners, but the schema does not require behavior_id uniqueness across protected records or one-to-one supersedes_behavior_id lookup. Add those invariants and fail closed when duplicate reviewed owners exist for the same ID.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/PLAN.md
around lines 42 - 50, Update the behavior catalogue schema and
effective-selection rules to require unique behavior_id values across protected
records and one-to-one supersedes_behavior_id mappings. In the selection logic
described by the plan, reject duplicate reviewed owners for any behavior ID and
fail closed before resolving mutation input, while preserving the existing
zero-or-multiple effective-owner failure behavior.
Workstream PR Trust Bundle
Chunk
WS-QUAL-002-PLAN— repository-wide behavior ownership catalogue planning.Goal
Define durable reviewed test ownership and a safe, changed-line-aware path for any future mutation reactivation without restoring the retired callable-wide 05M workflow.
Intent And Planning Context
AUTH and other contributors should not pause implementation to rediscover owning tests. PR #289 retired the blocking mutation workflow after callable-wide selection mutated unchanged executable lines. This PR records the replacement architecture and bounded chunk contracts; it implements no runtime behavior.
What Changed
.ci/behavior-ownership/partition.v1.jsoncustody and exact population boundaries.Design Chosen
A durable catalogue is separate from transient PR selection. Existing ownership comes from protected base; PR-head data is additive for new or validated remapped behavior. Population chunks consume one digest-bound partition and cannot edit parent or sibling contracts. Future mutation input must contain exact changed spans, never callable names alone.
Scope
Only
.agent-loop/initiatives/WS-QUAL-002-behavior-ownership-catalogue/**changes. No backend application code, migration, workflow, coverage threshold, product lifecycle, authorization behavior, payment, or reputation behavior changes.Evidence
git diff --check— passed.python3 scripts/check_markdown_links.py— passed.python3 scripts/check_stale_workstream_wording.py— passed.python3 scripts/check_stale_authorization_docs.py— passed.Acceptance Proof
Test Delta
Planning Markdown only. No product test was removed, skipped, deselected, or weakened. The contracts require new validator and negative tests during their respective implementation chunks.
Reviewer Results
Architecture, QA, CI integrity, documentation, reuse/deduplication, senior engineering, security, and product/operations reviews passed or passed with documented low implementation cautions. CodeRabbit findings were incorporated and revalidated.
CI Integrity
No active workflow changed. Backend lanes, coverage floors, lint, Agent Gates, branch protection, CodeRabbit, and human merge remain unchanged. Chunk 02 explicitly forbids workflow changes. Chunk 05 requires one stable always-emitted check, no workflow path filters, and internal
not_applicablepreflight before dependency installation.Risks
False ownership, stale partitions, narrowed protected evidence, duplicate effective owners, and callable-wide regression all fail closed. Mutation remains inactive until a separate human-approved reactivation chunk passes exact-head hosted evidence.
Follow-Up
After this plan merges and the human approves implementation, begin only
WS-QUAL-002-01. Do not start later chunks automatically.Human Review Focus
Review partition custody, remap single-owner resolution, structural-only schema rules, narrowed chunk scopes, and changed-span mutation input.
Human Merge Ownership
Summary by CodeRabbit