mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
419bda7532
## Summary Implements ag-u1zi W4.1: a deterministic classifier for migrating `bd remember` notes into the memory architecture without promoting bead-local operational chatter into pull-learning memory. Changes: - adds `scripts/classify-bd-remember.py` with JSON/markdown output, `--input`, `--expected-count`, and `--generated-at` options - adds fixture and Bats coverage for classification coverage, lineage preservation, markdown manifest, and expected-count mismatch - adds `docs/contracts/bd-remember-migration-manifest.md` plus documentation-index entry Classification policy: - `bead`: bead-linked, session-local, one-off, or tracker-operational notes - `pull-learning`: reusable project learning candidates, emitted as `reach=pull`, `maturity=provisional`, `source=migrated-bd-remember` - `discard`: empty/stale/deprecated/obsolete notes Dolt/bd caveat: `bd update ag-u1zi --claim` and `bd ready` are failing via the known Dolt/MySQL write/read path (`context canceled` / invalid connection), so claim/provenance is recorded in Agent Mail rather than bd state. ## Validation Focused: - `bats tests/scripts/bd-remember-classifier.bats` PASS - `python3 -m py_compile scripts/classify-bd-remember.py` PASS - `bash scripts/check-contracts-structural-floor.sh` PASS after indexing the new contract doc - `git diff --check` PASS Required push path: - `bash scripts/regen-all.sh` ran; failed only known CMDAO surface parity red, timestamp-only `registry.json` drift reverted - `PRE_PUSH_FAIL_FAST=false bash scripts/pre-push-gate.sh` completed with the known red set: 4 failures (`test-fixture parity`, canonical-root worktree disposition, corpus freshness, contract canary pre-push-governance); no observed diff-caused failure ## Review Request Requesting cross-model ACK before merge. Do not merge unless PR checks reach CLEAN and quorum is satisfied. Closes-scenario: ag-u1zi Bounded-context: BC1-Corpus Validation-evidence: classifier script + Bats coverage; see Validation section above.
50 lines
2.2 KiB
Bash
50 lines
2.2 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
setup() {
|
|
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../.." && pwd)"
|
|
SCRIPT="$REPO_ROOT/scripts/classify-bd-remember.py"
|
|
FIXTURE="$REPO_ROOT/tests/fixtures/bd-remember-memories.json"
|
|
}
|
|
|
|
@test "classifies every bd memory and preserves lineage" {
|
|
run python3 "$SCRIPT" \
|
|
--input "$FIXTURE" \
|
|
--expected-count 4 \
|
|
--generated-at "2026-06-05T00:00:00+00:00"
|
|
|
|
[ "$status" -eq 0 ]
|
|
echo "$output" | jq -e '.schema_version == "bd-remember-migration-manifest.v1"'
|
|
echo "$output" | jq -e '.total == 4 and .classified == 4 and .unclassified == 0'
|
|
echo "$output" | jq -e '.counts["pull-learning"] == 1'
|
|
echo "$output" | jq -e '.counts.bead == 2'
|
|
echo "$output" | jq -e '.counts.discard == 1'
|
|
echo "$output" | jq -e '.items[] | select(.key == "landed-means-origin-main") | .proposed_learning.reach == "pull"'
|
|
echo "$output" | jq -e '.items[] | select(.key == "landed-means-origin-main") | .proposed_learning.maturity == "provisional"'
|
|
echo "$output" | jq -e '.items[] | select(.key == "landed-means-origin-main") | .proposed_learning.source == "migrated-bd-remember"'
|
|
echo "$output" | jq -e '.items[] | select(.key == "landed-means-origin-main") | .lineage.body == "Verify landed work against origin/main or GitHub, not local fast-forward state."'
|
|
echo "$output" | jq -e '.items[] | select(.key == "ag-rbx8-pr-body-evidence") | .disposition == "bead"'
|
|
echo "$output" | jq -e '.items[] | select(.key == "old-evolve-cli") | .disposition == "discard"'
|
|
}
|
|
|
|
@test "markdown manifest exposes zero-unclassified invariant" {
|
|
run python3 "$SCRIPT" \
|
|
--input "$FIXTURE" \
|
|
--format markdown \
|
|
--generated-at "2026-06-05T00:00:00+00:00"
|
|
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"# bd remember migration manifest"* ]]
|
|
[[ "$output" == *"Unclassified: **0**"* ]]
|
|
[[ "$output" == *"\`pull-learning\`: **1**"* ]]
|
|
[[ "$output" == *"\`bead\`: **2**"* ]]
|
|
[[ "$output" == *"\`discard\`: **1**"* ]]
|
|
}
|
|
|
|
@test "expected-count mismatch fails before emitting manifest" {
|
|
run python3 "$SCRIPT" --input "$FIXTURE" --expected-count 196
|
|
|
|
[ "$status" -eq 1 ]
|
|
[[ "$output" == *"expected 196 memories, got 4"* ]]
|
|
[[ "$output" != *"bd-remember-migration-manifest.v1"* ]]
|
|
}
|