T0: absorb shared/ into backend — cot_logger→src/core, CotJsonFormatter→src/core/cot_formatter.py, _llm_http/_llm_health/ssl→src/core/utils; imports rewritten (26 prod + tests, patch targets); run.sh/backend.Dockerfile/requirements/.axiom source_dirs/semantic_health/AGENTS/INSTALL cleaned; ADR-0022 supersedes ADR-0015; fixed latent CI defects (ss_tools ImportError, record.message in logger tests, same-name test-module collision). ADR-0021 wire enrichment (additive): contract_id/claim/error_code/loc fields; _contract_id ContextVar + resolve_contract_id (explicit > belief_scope > declared-src mirror, derived src never mirrors); EXPLORE auto-loc via single frame walk; facade error auto-fill; 2KB payload cap with payload_truncated/payload_bytes markers; migrated 85 error="CODE" sites to error_code= (12 files); pilot editor/load.py; superset preview payload-bomb inlined bodies removed. Analytics SSOT src/core/log_stats.py (bond transition matrix, orphan-EXPLORE ratio, REFLECT pairing, intent families, coverage, insufficient-sample flag); pretty_cot.py --stats/--digest/--trajectory/--story over one engine; log_gap_service three-tier ground-truth triangulation (FAILED w/o EXPLORE etc.) + GET /api/reports/log-stats|task-log-gaps (polling-suppressed); scripts/cot_audit.py CLI; enriched fields persisted into task_logs.payload for tier queries. Frontend: ReportsAnalyticsModel + AnalyticsStatsPanel (Logs tab) + TaskGapPanel and per-row T1/T2/T3 gap badges (Tasks tab); cot-logger.ts ADR-0021 opts; i18n en/ru. Scheduler console spam fixed: apscheduler logger demoted to WARNING via LoggingConfig.scheduler_log_level. .axiom belief patterns -> $OBJ.* (alias undercount). molecular-cot-logging skill updated (fields, decision rules, tie-break, CLI) and synced. Reviewed orthogonally: F1 cot_span contract pollution, F2 cap boundary accounting, F3 digest over-dedup, F4 trace-state bound, F5 tier metadata — fixed with regression tests. Validation: backend 11287 passed + ruff + compileall; frontend 3446 passed + lint + build; CLI smoke on live app.log.
3.5 KiB
3.5 KiB
@{ Doc.Adr.ADR0022 [C:2] [TYPE ADR]
@STATUS ACCEPTED
@BRIEF Absorb the shared/ package into backend/ after the standalone agent removal; collapse the second runtime boundary and the duplicated logger facade.
@RELATION DEPENDS_ON -> [Doc.Adr.ADR0015]
@RELATION BINDS_TO -> [backend/src/core/cot_logger.py]
@RELATION BINDS_TO -> [backend/src/core/cot_formatter.py]
@RELATION BINDS_TO -> [backend/src/core/utils/llm_http.py]
@RELATION BINDS_TO -> [backend/src/core/utils/llm_health.py]
@RELATION BINDS_TO -> [backend/src/core/utils/ssl.py]
@RATIONALE ADR-0015 justified shared/ by two independent Python runtimes (agent container + backend). The agent was removed (agent/ and docker/Dockerfile.agent no longer exist; src/agent was replaced by ss_tools.shared._llm_health per the agent_status route rationale). With a single consumer the package boundary became pure overhead: an editable pip install step in run.sh and backend.Dockerfile, import indirection (ss_tools.shared.* instead of src.core.*), and — critically — the boundary kept a duplicated logger facade alive (shared/logger.py for the "pydantic-free agent" vs backend/src/core/logger.py), reproducing the drift class ADR-0017 fought (4 suppression lists). CI never installed shared/ at all, so logger smoke tests failed on ImportError — the absorption fixes that structurally.
@REJECTED Keeping shared/ for hypothetical future consumers was rejected — YAGNI plus a permanent pip -e step in two build systems for zero current benefit.
@REJECTED Physically moving files while preserving the ss_tools.shared namespace inside backend/src was rejected — it keeps the indirection and does not force the facade consolidation.
@REJECTED Renaming region IDs (Shared.CotLoggerModule, Shared.CotJsonFormatter, Shared.Ssl.*) during the move was rejected — INV_6: contracts have inbound relations (skills, @RELATION edges, tests); ID curation is a separate curator pass with an index rebuild.
Decision
shared/ is deleted. Mapping:
| Before | After |
|---|---|
ss_tools/shared/cot_logger.py |
backend/src/core/cot_logger.py (stdlib-only invariant kept) |
ss_tools/shared/logger.py :: CotJsonFormatter |
backend/src/core/cot_formatter.py |
ss_tools/shared/logger.py :: instance/setup_handler/monkey-patched reason-reflect-explore |
deleted (dead standalone agent path); the only facade is backend/src/core/logger.py |
ss_tools/shared/ssl.py |
backend/src/core/utils/ssl.py |
ss_tools/shared/_llm_http.py |
backend/src/core/utils/llm_http.py |
ss_tools/shared/_llm_health.py |
backend/src/core/utils/llm_health.py |
Infrastructure: run.sh no longer installs ../shared; backend.Dockerfile no longer copies/installs it (openai/httpx already pinned in requirements-backend.txt); .axiom/axiom_config.yaml source_dirs drop shared/src and dead agent/src/agent/tests; ADR-0017's "single suppression list lives in shared/cot_logger.py" consequence relocates to backend/src/core/cot_logger.py. Existing venvs must run pip uninstall ss-tools-shared.
Consequences
- One import namespace (
src.*), one logger facade, one suppression list file; the CI smoke tests for logging become hermetic. - Region IDs of the moved contracts keep their
Shared.*names until a curator pass renames them with an Axiom rebuild (tracked separately). - If a second runtime consumer ever appears again, extraction must be justified by a new ADR (0015's mechanism remains available as precedent).