mirror of
https://github.com/boshu2/agentops.git
synced 2026-09-14 15:08:13 +08:00
ee748d580d
**Wave 1 of the orchestration-substrate cascade rip** (soc-2rtm0). The
full cascade (daemon + dream/overnight + schedule/plans/watch + gc-glue
+ factory) is ~50K LOC across deeply-entangled packages — far past one
reviewable PR. Per the bead's slice directive and the recon map's
serial-by-wave verdict, this ships as sequential PRs by wave. **This is
the factory wave** (the only cleanly-disjoint slice — no KEEP-feature
entanglement).
## What this retires (operator-confirmed FULL factory retire)
**Go command surface** (no external non-test caller — clean delete):
- `cmd/ao/factory.go`, `factory_admit.go`, `factory_pilot.go`,
`factory_admission_adapter.go` (+ all tests)
- `internal/ports/factory_admission.go` +
`inmemory_factory_admission.go` (+ test) — the port was only wired to
the daemon by the deleted production adapter
- severed factory flag save/restore + command-tree assertions from
`cobra_commands_test.go` / `testutil_test.go`
**Contract corpus** (scripts, schemas, contract docs, runbooks,
fixtures, tests):
- `scripts/check-factory-{admission,claim-ledger,yield-ledger}.sh`
- `schemas/factory-{admission,work-order,yield}.v1.schema.json`
- `docs/contracts/factory-{admission,claim-ledger,yield-ledger}.*`
-
`docs/runbooks/{factory-manual-merge,daemon-factory-admission,cloud-frontier-pilot}.md`
- `tests/e2e/factory-operator-canary.sh`,
`tests/integration/test-factory-claim-ledger-ci-job.sh`,
`tests/scripts/test-factory-admission-contracts.py`,
`tests/fixtures/factory-*`
- orphaned `aggregate-observation-log` subsystem (script + integration
test + fixtures) — its only data source was the deleted
`factory-claim-ledger-strict` CI job
**CI / generated reconciliation:**
- removed 3 factory jobs from `validate.yml` (+ both `needs:` arrays +
verdict echoes); removed entries from `ci-jobs.yaml`; regenerated
`AGENTS-CI.md` (63 jobs)
- removed factory gate-ids from `GOALS.md`; trimmed
`contracts-structural-floor` factory references
- regenerated `registry.json` (177→174 CLI commands), `COMMANDS.md` (−70
lines), `cli-skills-map.md` (73→72 headings)
- updated `cli-command-surface-matrix` canary spec + fixture counts
(`top=72 sub=194 all=266`); scrubbed deleted-file links from
`documentation-index.md`, `SCHEMAS.md`, `contracts/index.md`,
`agentopsd-control-plane.md`, `insert-schema-practices.py`
## Deliberately left for the daemon-carve wave
Daemon-owned factory job types (`factory.admission`,
`factory.local-pilot`) and the `agentopsd` routing-policy schema remain
— they belong to `internal/daemon/` and retire when the daemon does.
## Gates verified green locally
`gofmt`/`go build`/`go vet`, full Go test (**11830 pass**),
`validate-ci-policy-parity`, `contract-compatibility`,
`contracts-structural-floor`, `registry --check`, `doc-release` (0
broken links), `smoke-test`, `json-flag-consistency` (0 errors),
**`contract-canaries` (failures=0)**, codex-hashes, `pre-push-gate.bats`
(55).
Diff: 66 files changed, ~16 insertions / ~5680 deletions.
Closes-scenario: soc-2rtm0#cascade-rip
Bounded-context: BC5-Runtime
Evidence: .agents/discovery/2026-05-24-rip-caller-map.md
93 lines
4.1 KiB
Python
93 lines
4.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Pass-10: insert `"practices": [...]` immediately after the top-level
|
|
`"description"` line in each schema. Idempotent (skips if already present).
|
|
Preserves indentation and trailing comma style. Validates JSON afterward.
|
|
"""
|
|
import json
|
|
import pathlib
|
|
import re
|
|
import sys
|
|
|
|
MAPPING = {
|
|
"agent-update.schema.json": ["gitops", "continuous-delivery"],
|
|
"bead.v1.schema.json": ["dora-metrics", "lean-startup"],
|
|
"briefing.v1.schema.json": ["wiki-knowledge-surface", "pragmatic-programmer"],
|
|
"codex-marketplace.v1.schema.json": ["microservices", "team-topologies"],
|
|
"codex-plugin-manifest.v1.schema.json": ["microservices", "design-by-contract"],
|
|
"eval-run.v1.schema.json": ["llm-eval-harness", "dora-metrics"],
|
|
"eval-suite.v1.schema.json": ["llm-eval-harness", "tdd"],
|
|
"evidence-only-closure.v1.schema.json": ["adr", "cmm-process-maturity"],
|
|
"execution-packet.schema.json": ["design-by-contract", "pragmatic-programmer"],
|
|
"finding.json": ["dora-metrics", "wiki-knowledge-surface"],
|
|
"handoff.v1.schema.json": ["event-sourcing-cqrs", "distributed-tracing"],
|
|
"hooks-manifest.v1.schema.json": ["gitops", "infrastructure-as-code"],
|
|
"learning.v1.schema.json": ["wiki-knowledge-surface", "lean-startup"],
|
|
"memory-packet.v1.schema.json": ["wiki-knowledge-surface", "event-sourcing-cqrs"],
|
|
"phase.v1.schema.json": ["continuous-delivery", "agile-manifesto"],
|
|
"plugin-manifest.v1.schema.json": ["microservices", "hexagonal-architecture"],
|
|
"quest.v1.schema.json": ["agile-manifesto", "lean-startup"],
|
|
"release-readiness.v1.schema.json": ["continuous-delivery", "supply-chain-integrity"],
|
|
"remote-compute-target.schema.json": ["microservices", "distributed-systems-design"],
|
|
"remote-session-event.schema.json": ["event-sourcing-cqrs", "distributed-tracing"],
|
|
"routing-policy.v1.schema.json": ["microservices", "service-mesh"],
|
|
"rubric.v1.schema.json": ["llm-eval-harness", "design-by-contract"],
|
|
"scenario.v1.schema.json": ["property-based-testing", "llm-eval-harness"],
|
|
"schedule.schema.json": ["sre", "continuous-delivery"],
|
|
"session-quality-signal.v1.schema.json": ["dora-metrics", "sre"],
|
|
"skill-frontmatter.v1.schema.json": ["design-by-contract", "code-complete"],
|
|
"swarm-evidence.schema.json": ["dora-metrics", "team-topologies"],
|
|
"verdict.v1.schema.json": ["llm-eval-harness", "adr"],
|
|
"watch-event.v1.schema.json": ["event-sourcing-cqrs", "distributed-tracing"],
|
|
"worker-spec.v1.schema.json": ["microservices", "team-topologies"],
|
|
}
|
|
|
|
schemas_dir = pathlib.Path("schemas")
|
|
edited = 0
|
|
skipped = 0
|
|
errors = []
|
|
|
|
# Match a top-level "description": "..." line. We accept either a closing
|
|
# comma or a closing brace on the same line, but only insert when the line
|
|
# ends in a comma (i.e. another property follows).
|
|
DESC_LINE = re.compile(r'^(\s+)"description"\s*:\s*"(?:[^"\\]|\\.)*",\s*$')
|
|
|
|
for fname, slugs in MAPPING.items():
|
|
path = schemas_dir / fname
|
|
if not path.exists():
|
|
errors.append(f"missing: {path}")
|
|
continue
|
|
text = path.read_text()
|
|
if '"practices"' in text.split("\n", 50)[0:50].__str__():
|
|
# extremely conservative idempotency guard
|
|
pass
|
|
lines = text.splitlines(keepends=True)
|
|
if any('"practices"' in l for l in lines[:50]):
|
|
skipped += 1
|
|
continue
|
|
new_lines = []
|
|
inserted = False
|
|
for line in lines:
|
|
new_lines.append(line)
|
|
if not inserted and DESC_LINE.match(line):
|
|
indent = re.match(r'^(\s+)', line).group(1)
|
|
slug_list = ", ".join(f'"{s}"' for s in slugs)
|
|
new_lines.append(f'{indent}"practices": [{slug_list}],\n')
|
|
inserted = True
|
|
if not inserted:
|
|
errors.append(f"no top-level description: {fname}")
|
|
continue
|
|
new_text = "".join(new_lines)
|
|
# Validate JSON parses
|
|
try:
|
|
json.loads(new_text)
|
|
except json.JSONDecodeError as e:
|
|
errors.append(f"json invalid after edit: {fname}: {e}")
|
|
continue
|
|
path.write_text(new_text)
|
|
edited += 1
|
|
|
|
print(f"edited={edited} skipped={skipped} errors={len(errors)}")
|
|
for e in errors:
|
|
print(f" ERR: {e}")
|
|
sys.exit(1 if errors else 0)
|