Skip to content

Delete legacy profile paths and add architecture guards, docs, and parity verification #2644

Description

@acoliver

Parent: #2635

Objective

Complete the transactional-profile cutover by deleting residual legacy paths and duplicate state holders, adding architecture guards/documentation, and running whole-system parity, migration, security, failure, and smoke verification.

This task begins only after the schema/repository, controller/runtime, foreground, and Agent API/subagent/role vertical cuts are functional. It must remove residue rather than introduce another bridge.

Scope

Delete obsolete production paths

Prove zero callers and remove or reduce to intentional public façades with no logic:

  • applyProfileWithGuards, applyProfileSnapshot, ambient profile snapshot/save/reverse reconstruction;
  • foreground/subagent/compression population helpers and profile-as-CLI-overrides;
  • ProfileManager.applyLoadedProfile, SettingsService.importFromProfile profile population;
  • ProfilesControl private store/directory scan/schema/direct mutation;
  • duplicate keyfile/auth/sensitive/preserve/reasoning/compression key lists;
  • profile process.env writes/read-back;
  • active provider/model/profile/auth/model-param/profile-policy values in Config/SettingsService/ProviderManager fallbacks;
  • runtime identity ALS/registry lookup and module-level active pointers for profile/provider execution;
  • global tool register/unregister caused by profile transitions;
  • old/new profile writers for any execution owner;
  • migration-only v1 parser outside the explicitly named bounded source.

Coordinate deletions with #2534, #2615, and #2616 so the same files are not first migrated into temporary abstractions.

Architecture guards

Add CI/AST/text guards for:

  • forbidden ambient/profile/runtime symbols and imports;
  • active execution state access through Config/application settings;
  • new literal auth/sensitive/persistable/preserve/profile key lists bypassing registry metadata;
  • direct profile directory scans outside repository/migrator;
  • provider mutation from CLI/Zed/public APIs;
  • v1 parsing outside the migration boundary;
  • generic runtime/settings service bags crossing package boundaries;
  • internal imports of compatibility façades.

Do not duplicate #2533's generic alias-probe rule; reference/extend it for the profile boundary.

Documentation

Document:

  • six mutable authorities and package direction;
  • ProfileDocumentV2 → ResolvedAgentSpec → ActiveProfileRuntime;
  • AgentProfile command/query/event protocol and typed outcomes;
  • exact /model, LB fork, /provider, load/save/set/settings/setup/startup semantics;
  • saved/draft identity, revisions, etags, conflicts, unsaved confirmation, external staleness;
  • scheduler-safe commit, candidate cleanup, runtime disposal and health;
  • application settings ownership/propagation and UI reasoning/context split;
  • agent policy requested/effective authority ceilings;
  • qualified repository IDs/scopes/trust/references;
  • migration check/run/recovery/rollback/read-only behavior and older-binary limitations;
  • redaction/audience/telemetry rules;
  • subagent/compression/role profile lifecycle;
  • removed files/symbols and before/after call/dependency flow.

Whole-system verification

Run behavioral parity and fault suites covering:

  • standard and LB profiles; auth references/OAuth buckets/failover; exact model clone; same-provider reset; clean load; save/conflict/delete/reference behavior;
  • startup/unconfigured/noninteractive/setup/Zed/Agent API/checkpoint restore;
  • simultaneous foreground agents/subagents/compression roles and scheduler boundaries;
  • tool/approval/shell policy intersections and captured invocation policy;
  • reasoning display/context and emoji/diagnostic propagation;
  • candidate partial-construction failure, cancellation races, listener failure, bounded old-runtime disposal and shared-resource non-disposal;
  • migration conversion/redaction/permissions/qualified naming/references/read-only/concurrent startup/fault injection/rollback;
  • local diagnostic versus remote telemetry serializers and secret-oracle resistance.

Run the project-required full suite: test, lint, typecheck, format, build, and Bun profile smoke. Use migrated standard/LB profiles and exercise provider/model/profile transitions plus reasoning-display toggle.

Coordination / non-overlap

Acceptance criteria

  • Every forbidden legacy symbol/path has zero production callers/imports and is deleted or documented as a truly external façade with no internal use.
  • One authoritative profile command/state/runtime route remains for every migrated execution owner; no dual writes or fallback read chains remain.
  • Architecture guards fail representative attempts to recreate ambient state, key-list bypasses, direct scans/mutations, v1 normal loading, or generic service bags.
  • Documentation is complete and consistent with implemented ownership/UX/migration/security behavior.
  • Focused parity, concurrency, failure, migration fault-injection, security/redaction, and cross-platform tests pass.
  • Full required verification and migrated-profile smoke tests pass.
  • Final report lists removed files/symbols, before/after flow, related issue acceptance criteria satisfied, and any explicitly deferred out-of-scope work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Code Quality / ModularizationIssues to do with the quality of llxprt code and its maintainability.architectureArchitectural refactor / clean designtype: task

    Type

    Projects

    Status
    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions