Skip to content

Commit b7cfb84

Browse files
samrusaniSami Rusani
andauthored
P11-S6: ship tier-2 packs and launch clarity assets (#141)
Co-authored-by: Sami Rusani <sr@samirusani>
1 parent 05cf00e commit b7cfb84

13 files changed

Lines changed: 552 additions & 105 deletions

BUILD_REPORT.md

Lines changed: 37 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,65 @@
11
# BUILD_REPORT
22

33
## sprint objective
4-
Implement P11-S5: Azure Adapter + AutoGen Integration through the existing provider abstraction by adding Azure provider registration/test/invoke support, enterprise credential/auth hardening, Azure capability posture fields, and AutoGen integration documentation/sample path.
4+
Implement `P11-S6` by adding tier-2 model packs (DeepSeek, Kimi, Mistral) on the shipped model-pack abstraction, plus compatibility/setup clarity assets for local, self-hosted, enterprise, and external-agent paths, without reopening `P11-S1` through `P11-S5` architecture.
55

66
## completed work
7-
- Added Azure provider adapter support in the runtime adapter registry (`provider_key: azure`) with normalized capability discovery and invoke behavior using the existing `openai_responses` runtime contract.
8-
- Added Azure-specific helper module for:
9-
- auth header handling (`azure_api_key`, `azure_ad_token`)
10-
- `api-version` query handling
11-
- model enumeration payload parsing
12-
- OpenAI-compatible responses invoke payload/response normalization
13-
- Added additive provider data fields and migration support:
14-
- `model_providers.azure_api_version`
15-
- `model_providers.azure_auth_secret_ref`
16-
- expanded `model_providers.auth_mode` constraint to include Azure auth modes
17-
- Added Azure secret-reference credential handling in runtime secret resolution:
18-
- Azure modes now resolve credentials from `azure_auth_secret_ref`
19-
- plaintext Azure credentials are not persisted in provider rows
20-
- Added Azure registration endpoint:
21-
- `POST /v1/providers/azure/register`
22-
- strict auth payload validation (mode-specific field requirements)
23-
- Preserved existing provider/runtime seams and behavior for shipped P11-S1 through P11-S4 paths.
24-
- Added Azure capability snapshot posture fields:
25-
- `azure_api_version`
26-
- `azure_auth_mode`
27-
- Added docs and sample integration path:
28-
- Azure + AutoGen integration guide in `docs/integrations/phase11-azure-autogen.md`
29-
- runtime bridge sample in `scripts/run_phase11_autogen_runtime_bridge.py`
30-
- Updated control-doc truth checker markers to P11-S5 active-sprint truth so required truth checks pass.
7+
- Added tier-2 built-in pack specs in `model_packs.py`:
8+
- `deepseek@1.0.0`
9+
- `kimi@1.0.0`
10+
- `mistral@1.0.0`
11+
- Preserved shipped pack API behavior and selection semantics:
12+
- seeded catalog still resolves through existing `/v1/model-packs` flow
13+
- workspace binding and request override precedence are unchanged
14+
- no new runtime/provider paths were introduced
15+
- Extended family contract/type support for tier-2 families:
16+
- `deepseek`, `kimi`, `mistral`
17+
- Added additive migration `20260412_0056_phase11_model_packs_tier2_families.py` to widen `model_packs_family_check` without schema redesign.
18+
- Updated catalog reservation conflict text to cover built-in catalog entries (tier-1 + tier-2).
19+
- Added/updated sprint docs:
20+
- `docs/integrations/phase11-model-pack-compatibility.md` with provider/pack compatibility matrices
21+
- `docs/integrations/phase11-setup-paths.md` with operator setup paths for local, self-hosted, enterprise, and external-agent use
22+
- `docs/integrations/phase11-azure-autogen.md` guardrails/references refreshed for P11-S6
23+
- Updated sprint-owned tests for tier-2 catalog presence, runtime override behavior, and migration coverage.
24+
- Updated control-doc truth checker markers to active `P11-S6` packet/state markers.
25+
- Updated `REVIEW_REPORT.md` for `P11-S6`.
3126

3227
## incomplete work
3328
- None within the sprint packet scope.
3429

3530
## files changed
36-
- `apps/api/src/alicebot_api/azure_provider_helpers.py` (new)
37-
- `apps/api/src/alicebot_api/provider_runtime.py`
38-
- `apps/api/src/alicebot_api/main.py`
39-
- `apps/api/src/alicebot_api/store.py`
31+
- `apps/api/src/alicebot_api/model_packs.py`
4032
- `apps/api/src/alicebot_api/contracts.py`
41-
- `apps/api/alembic/versions/20260412_0055_phase11_azure_provider_config_fields.py` (new)
42-
- `tests/unit/test_provider_runtime.py`
43-
- `tests/integration/test_phase11_provider_runtime_api.py`
44-
- `tests/unit/test_20260412_0055_phase11_azure_provider_config_fields.py` (new)
45-
- `docs/integrations/phase11-azure-autogen.md` (new)
46-
- `scripts/run_phase11_autogen_runtime_bridge.py` (new)
33+
- `apps/api/src/alicebot_api/main.py`
34+
- `apps/api/alembic/versions/20260412_0056_phase11_model_packs_tier2_families.py` (new)
35+
- `tests/unit/test_model_packs.py`
36+
- `tests/integration/test_phase11_model_packs_api.py`
37+
- `tests/unit/test_20260412_0056_phase11_model_packs_tier2_families.py` (new)
38+
- `docs/integrations/phase11-model-pack-compatibility.md`
39+
- `docs/integrations/phase11-setup-paths.md` (new)
40+
- `docs/integrations/phase11-azure-autogen.md`
4741
- `scripts/check_control_doc_truth.py`
48-
- `README.md`
49-
- `BUILD_REPORT.md`
5042
- `REVIEW_REPORT.md`
43+
- `BUILD_REPORT.md`
5144

5245
## tests run
5346
1. `python3 scripts/check_control_doc_truth.py`
5447
- Result: PASS
5548

5649
2. `./.venv/bin/python -m pytest tests/unit tests/integration -q`
57-
- Result: PASS (`1142 passed in 196.54s (0:03:16)`)
50+
- Result: PASS (`1145 passed in 185.18s (0:03:05)`)
5851

5952
3. `pnpm --dir apps/web test`
60-
- Result: PASS (`62 passed`, `199 passed`, duration `4.62s`)
53+
- Result: PASS (`62 files`, `199 tests passed`, duration `5.49s`)
6154

6255
4. Focused sprint tests during implementation:
63-
- `./.venv/bin/python -m pytest tests/unit/test_provider_runtime.py tests/unit/test_provider_secrets.py tests/unit/test_20260412_0055_phase11_azure_provider_config_fields.py tests/integration/test_phase11_provider_runtime_api.py -q`
64-
- Result: PASS (`20 passed`)
56+
- `./.venv/bin/python -m pytest tests/unit/test_model_packs.py tests/integration/test_phase11_model_packs_api.py tests/unit/test_20260412_0056_phase11_model_packs_tier2_families.py -q`
57+
- Result: PASS (`14 passed in 1.62s`)
6558

6659
## blockers/issues
6760
- No functional blockers for sprint scope implementation.
68-
- Pre-existing dirty files not modified as sprint work and excluded from sprint merge scope:
69-
- `ARCHITECTURE.md`
70-
- `PRODUCT_BRIEF.md`
61+
- Pre-existing dirty file not modified as sprint work and excluded from sprint merge scope:
62+
- `README.md`
7163

7264
## recommended next step
73-
Proceed to Control Tower merge approval for `P11-S5`, then run staging validation against a live Azure endpoint for both `azure_api_key` and `azure_ad_token` registration/invoke flows before production rollout.
65+
Proceed to merge review for `P11-S6`, then run staging smoke checks for one local provider, one self-hosted OpenAI-compatible provider, and one Azure provider with tier-2 and custom pack coverage.

REVIEW_REPORT.md

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,49 @@
44
PASS
55

66
## criteria met
7-
- `POST /v1/providers/azure/register` is implemented and validated with strict auth-mode payload checks.
8-
- Azure provider registration/test/invoke flows are covered through shipped APIs:
9-
- `POST /v1/providers/azure/register`
10-
- `POST /v1/providers/test`
11-
- `POST /v1/runtime/invoke`
12-
- `GET /v1/providers`
13-
- `GET /v1/providers/{provider_id}`
14-
- Credential/auth hardening is implemented for Azure:
15-
- Azure credentials are persisted via secret references (`azure_auth_secret_ref`)
16-
- Integration tests verify no plaintext Azure credential leakage in `model_providers`
17-
- Azure invoke path uses the existing normalized provider abstraction/adapter registry (no continuity-semantic fork).
18-
- Azure capability posture additions are present (`azure_api_version`, `azure_auth_mode`).
19-
- AutoGen integration guide and sample path are present:
20-
- `docs/integrations/phase11-azure-autogen.md`
21-
- `scripts/run_phase11_autogen_runtime_bridge.py`
22-
- Required verification commands pass (re-run after fix):
23-
- `python3 scripts/check_control_doc_truth.py`
24-
- `./.venv/bin/python -m pytest tests/unit tests/integration -q` ✅ (`1142 passed in 196.54s`)
25-
- `pnpm --dir apps/web test` ✅ (`62 files / 199 tests passed`, duration `4.62s`)
26-
- Local identifier check: no local machine paths/usernames found in sprint-owned changed files.
7+
- Tier-2 packs are implemented on the existing model-pack seam: `deepseek@1.0.0`, `kimi@1.0.0`, `mistral@1.0.0` (`apps/api/src/alicebot_api/model_packs.py`).
8+
- Family contract support is added additively in code + DB constraint migration (no provider/runtime redesign):
9+
- `apps/api/src/alicebot_api/contracts.py`
10+
- `apps/api/alembic/versions/20260412_0056_phase11_model_packs_tier2_families.py`
11+
- Pack listing/detail/binding/invoke flows remain on shipped APIs and semantics:
12+
- workspace default binding still applies when no request override is provided
13+
- request-level pack override still takes precedence
14+
- reserved built-in catalog IDs/versions are blocked from custom create
15+
- Compatibility and launch-clarity docs are present and within sprint scope:
16+
- `docs/integrations/phase11-model-pack-compatibility.md`
17+
- `docs/integrations/phase11-setup-paths.md`
18+
- `docs/integrations/phase11-azure-autogen.md` (guardrail/reference update)
19+
- Sprint tests cover tier-2 catalog presence, runtime shaping override path, and migration statements:
20+
- `tests/unit/test_model_packs.py`
21+
- `tests/integration/test_phase11_model_packs_api.py`
22+
- `tests/unit/test_20260412_0056_phase11_model_packs_tier2_families.py`
23+
- Required verification commands were executed and passed:
24+
- `python3 scripts/check_control_doc_truth.py` -> PASS
25+
- `./.venv/bin/python -m pytest tests/unit tests/integration -q` -> `1145 passed in 185.18s`
26+
- `pnpm --dir apps/web test` -> `62 files passed, 199 tests passed in 5.49s`
27+
- Local identifier sweep on sprint-owned changes found no leaked local computer paths/usernames.
2728

2829
## criteria missed
2930
- None.
3031

3132
## quality issues
32-
- None blocking or non-blocking found in sprint-owned implementation after scope cleanup.
33+
- None blocking for `P11-S6`.
34+
- Overreach check: no new provider adapters, no new framework integrations beyond shipped AutoGen path, and no product-surface expansion detected.
3335

3436
## regression risks
35-
- Low residual risk: Azure behavior is validated in mocked integration tests; live-endpoint staging validation is still recommended for environment-specific routing/auth nuances.
37+
- Low: compatibility posture is declarative/documented, but real provider/model availability is deployment-dependent and should still be smoke-tested per environment.
3638

3739
## docs issues
38-
- Sprint docs are present and scoped correctly for P11-S5.
40+
- No scope violations found in sprint docs.
41+
- Process note: `README.md` is currently dirty in the workspace; ensure only intended sprint files are included in merge scope.
3942

4043
## should anything be added to RULES.md?
41-
- Optional improvement: add a standing rule that sprint PRs must exclude unrelated dirty local files before review.
44+
- No.
4245

4346
## should anything update ARCHITECTURE.md?
44-
- No required architecture update for P11-S5 acceptance.
47+
- No.
4548

4649
## recommended next action
47-
1. Proceed with sprint merge review/approval for `P11-S5`.
48-
2. Run staging smoke validation against live Azure for both `azure_api_key` and `azure_ad_token` before production rollout.
50+
1. Approve `P11-S6` for merge.
51+
2. Before merge, confirm the final PR file list excludes unrelated dirty files.
52+
3. Run staging smoke checks across one local provider path, one self-hosted openai-compatible path, and one Azure path using tier-2 pack bind/override flows.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
"""Expand model-pack family constraint for Phase 11 tier-2 packs."""
2+
3+
from __future__ import annotations
4+
5+
from alembic import op
6+
7+
8+
revision = "20260412_0056"
9+
down_revision = "20260412_0055"
10+
branch_labels = None
11+
depends_on = None
12+
13+
_UPGRADE_STATEMENTS = (
14+
"ALTER TABLE model_packs DROP CONSTRAINT IF EXISTS model_packs_family_check",
15+
(
16+
"ALTER TABLE model_packs ADD CONSTRAINT model_packs_family_check "
17+
"CHECK (family IN ('llama', 'qwen', 'gemma', 'gpt-oss', 'deepseek', 'kimi', 'mistral', 'custom'))"
18+
),
19+
)
20+
21+
_DOWNGRADE_STATEMENTS = (
22+
"ALTER TABLE model_packs DROP CONSTRAINT IF EXISTS model_packs_family_check",
23+
(
24+
"ALTER TABLE model_packs ADD CONSTRAINT model_packs_family_check "
25+
"CHECK (family IN ('llama', 'qwen', 'gemma', 'gpt-oss', 'custom'))"
26+
),
27+
)
28+
29+
30+
def _execute_statements(statements: tuple[str, ...]) -> None:
31+
for statement in statements:
32+
op.execute(statement)
33+
34+
35+
def upgrade() -> None:
36+
_execute_statements(_UPGRADE_STATEMENTS)
37+
38+
39+
def downgrade() -> None:
40+
_execute_statements(_DOWNGRADE_STATEMENTS)

apps/api/src/alicebot_api/contracts.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,16 @@
192192
ProviderAdapterKey = Literal["openai_compatible", "ollama", "llamacpp", "azure"]
193193
ModelProviderStatus = Literal["active"]
194194
ProviderCapabilityDiscoveryStatus = Literal["ready", "failed"]
195-
ModelPackFamily = Literal["llama", "qwen", "gemma", "gpt-oss", "custom"]
195+
ModelPackFamily = Literal[
196+
"llama",
197+
"qwen",
198+
"gemma",
199+
"gpt-oss",
200+
"deepseek",
201+
"kimi",
202+
"mistral",
203+
"custom",
204+
]
196205
ModelPackStatus = Literal["active"]
197206
ModelPackBindingSource = Literal["manual", "runtime_override"]
198207
ModelFinishReason = Literal["completed", "incomplete"]

apps/api/src/alicebot_api/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7022,7 +7022,7 @@ def create_v1_model_pack(request: Request, body: CreateModelPackRequest) -> JSON
70227022
content={
70237023
"detail": (
70247024
f"model pack {normalized_pack_id}@{normalized_pack_version} "
7025-
"is reserved for tier-1 catalog entries"
7025+
"is reserved for built-in catalog entries"
70267026
)
70277027
},
70287028
)

0 commit comments

Comments
 (0)