Skip to content

refactor: DCP migration, naming cleanup, and CI workflow fixes - #28

Merged
klpanagi merged 11 commits into
devfrom
fix/cleanup_b
Jul 27, 2026
Merged

refactor: DCP migration, naming cleanup, and CI workflow fixes#28
klpanagi merged 11 commits into
devfrom
fix/cleanup_b

Conversation

@klpanagi

@klpanagi klpanagi commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Consolidates cleanup work on the fix/cleanup_b branch: DCP profile migration, stale test references removal, CI workflow harmonization, naming refactoring, plugin integration fixes, and flaky test isolation.

Changes

DCP Profiles — Inline Config Migration

  • feat(dcp): Migrated DCP profile definitions from external shell scripts to inline Zod config schema within the plugin configuration. Profiles (economy, balanced, performance, ultimate) are now defined in matrixx.jsonc and applied via dcp_switch_profile tool without external file dependencies.
  • test: Added 48 comprehensive tests covering all DCP profile switching scenarios, edge cases, error handling, and profile parameter validation.
  • feat: Replaced external dcp-switch.sh script with the built-in dcp_switch_profile tool.

CI Workflow Fixes

  • fix: Removed 4 stale test file references from both .github/workflows/ci.yml and .github/workflows/publish.yml:
    • tests/features/opencode-skill-loader/loader.test.ts
    • tests/features/opencode-skill-loader/agents-skills-global.test.ts
    • tests/hooks/prometheus-md-only/index.test.ts
    • tests/features/skill-mcp-manager/manager.test.ts
  • fix: Eliminated cross-test pollution from mock.module() usage and harmonized CI workflow patterns between ci.yml and publish.yml.
  • fix: Isolated 6 new flaky test groups in mock-heavy section (both workflows), eliminating all 51 remaining-test failures:
    • tests/features/mission-state/ (was: individual plan-storage.test.ts)
    • tests/features/handoff/
    • tests/features/task-storage/
    • tests/hooks/session-recovery/
    • tests/plugin/session-agent-resolver.test.ts
    • tests/hooks/auto-update-checker/checker/pinned-version-updater.test.ts

Naming & Refactoring

  • refactor: Removed old upstream naming conventions (prometheus, hephaestus, metis, momus, sisyphus) across the codebase.

Plugin Integration Fixes

  • fix: Forwarded browserProvider to createBuiltinSkills, resolving skill initialization issues.
  • fix: Discovered plugin-registered slash commands via OpenCode SDK, ensuring custom commands are properly recognized.

Files Modified

File Change
src/features/dcp/config.ts New — Zod schema for DCP profiles
src/tools/dcp-switch-profile/ New — built-in tool replacing external script
src/features/builtin-skills/ Updated — browserProvider forwarding
src/features/slash-command/ Updated — OpenCode SDK integration
.github/workflows/ci.yml Removed stale test refs + flaky test isolation
.github/workflows/publish.yml Removed stale test refs + flaky test isolation
AGENTS.md Added CI reproducibility policy (act required)
Various src/ files Old naming cleanup

Test Fixes

  • fix: Rewrote getMessageDir cache test to avoid mock.module("node:fs") — inconsistent across Bun versions. Uses behavioral verification: mock opencode-storage-paths (same proven pattern as B2) and verify caching by creating session dir after first call — cache hit returns null, broken cache would find the new dir.

Verification

  • bun run typecheck
  • bun run lint
  • Mock-heavy tests (177 pass / 0 fail) ✅
  • Remaining tests (2373 pass / 0 fail) ✅
  • Flaky test isolation verified via act locally ✅

klpanagi added 8 commits July 23, 2026 12:17
…momus, sisyphus)

- Rename hook prometheus-md-only → oracle-md-only (dir, schema, constants, tests, CI, docs)
- Rename file prometheus-agent-config-builder → oracle-agent-config-builder
- Rename system directive PROMETHEUS_READ_ONLY → ORACLE_READ_ONLY
- Rename constants PROMETHEUS_WORKFLOW_REMINDER → ORACLE_WORKFLOW_REMINDER
- Update ASCII art table: METIS CONSULTATION → SERAPH CONSULTATION, MOMUS REVIEW → SMITH REVIEW
- Remove legacy agent names (hephaestus, metis, momus) from delegate-agent ALLOWED_AGENTS
- Rename hephaestus* variables to keymaker* in keymaker-agent.ts
- Rename import aliases: createLibrarianAgent → createOperatorAgent, createExploreAgent → createTrinityAgent, createMultimodalLookerAgent → createConstructAgent
- Rename SISYPHUS_SPINNER → MORPHEUS_SPINNER
- Update comments referencing old names in keyword-detector, delegate-task, oracle agent
- Add prometheus-md-only → oracle-md-only migration mapping for backward compat
- Regenerate JSON schema
- Add mock.restore() to 24 test files using mock.module() without cleanup
- Replace mock.module('node:fs') with spyOn in bdd-create-contract and
  bdd-pipeline tests to prevent process-wide module mocking
- Extend test-setup.ts global beforeEach with all 11 _reset*ForTesting()
  functions for complete module-state isolation
- Harmonize publish.yml with ci.yml: switch from explicit whitelist to
  auto-discovery (find | grep -v | xargs) — restores 7 previously
  excluded test categories
- Add lsp-process.test.ts and bdd-parse-gherkin to CI isolation lists
- Update run-ci.sh to match ci.yml exclusion lists
- Update package.json test script to match CI scope (excludes demos/)

CI simulation: 10/10 steps, 0 failures across 3139 tests
Matrixx's auto-slash-command hook and slashcommand tool only scanned
builtin commands + .opencode/command/ files + skills, missing commands
registered programmatically by other OpenCode plugins (e.g., /dcp-compress).

Now queries client.command.list() from the OpenCode SDK to discover
plugin-registered commands and merges them into the command registry.
Also removes misleading 'Marketplace plugin commands are not supported'
error messages.
… files

- Forward browserProvider parameter to createBuiltinSkills() in agent-builder.ts
  and skill-resolver.ts — fixes agent-browser and playwright-cli skill resolution
- Remove stale opencode-skill-loader imports/tests from deleted module
  (tests/features/opencode-skill-loader/, config-handler.test.ts)
- Clean up clearSkillCache references, SkillMcpManager references,
  and mockSetupFactory related dead tests
…file tool

- Create src/tools/dcp-switch-profile/ with dcp_switch_profile tool that
  reads, merges, and applies DCP profile config natively in Matrixx
- Remove dependency on external ~/.myopencode/dcp/switch-profile.sh script
- Register tool in tool registry (dcp_switch_profile)
- Rewrite /dcp-profile command template to use built-in tool instead of external script
- Remove switch_script from DCP config schema (no longer needed)
- Add tests for dcp_switch_profile tool
- Redesign DCP profile parameters for more aggressive/effective compression:
  * nudgeForce: strong (was soft) across all profiles
  * iterationNudgeThreshold: 2-7 (was 15) depending on profile
  * showCompression: true (was false)
  * Lower minContextLimit thresholds for earlier nudging
Cover factory, metadata, all 4 built-in profile values, output structure,
base config overrides, profile override merging, and error handling
(invalid profile + DCP not installed). Uses mock.module for fs isolation.
…fig schema

- Expand DcpConfigSchema with full profile parameter definitions
  (DcpCompressOverrideSchema, DcpStrategiesOverrideSchema,
   DcpTurnProtectionSchema, DcpExperimentalSchema,
   DcpProfileDefinitionSchema) and 4 built-in profile defaults
- Rewrite dcp_switch_profile tool: config-driven, full inline output,
  no more extend key or external file reads
- Remove stripJsoncComments(), deepMerge(), readJsoncConfig() helpers
- Wire MatrixxConfig into tool factory via assembly pattern
- Update DCP slash command template to reflect config-driven architecture
- Add 48 comprehensive tests (up from 3) covering all profiles,
  output structure, base overrides, and error handling
- Regenerate assets/matrixx.schema.json with new DCP profile fields
- Remove deprecated modules: agent-loader, opencode-skill-loader,
  skill-mcp-manager, mcp-oauth, command-loader/loader.ts
4 deleted test files referenced in both ci.yml and publish.yml:
- tests/features/opencode-skill-loader/loader.test.ts
- tests/features/opencode-skill-loader/agents-skills-global.test.ts
- tests/hooks/prometheus-md-only/index.test.ts
- tests/features/skill-mcp-manager/manager.test.ts

Removed from both mock-heavy run sections and grep -v exclude lists.
@klpanagi klpanagi changed the title test: add 48 comprehensive tests for dcp_switch_profile tool refactor: DCP migration, naming cleanup, and CI workflow fixes Jul 27, 2026
klpanagi added 3 commits July 27, 2026 13:17
…port

The getMessageDir cached after first call test used spyOn on its own
fs reference, which doesn't intercept calls from message-dir.ts's
own import binding for node:fs. The test also relied on
mock.module('node:fs') from the B2 test, but B2's mock is set up
inside the test body — never active during getMessageDir's execution.

Fix: give the test its own mock.module('node:fs', ...) setup with
local call counters, following the same pattern as the B2 regression
test. Revert B2's existsSync/readdirSync wrappers to simple pass-
through since the shared mockCalls object is no longer needed.
The previous test used mock.module("node:fs") to intercept fs calls and
count them. This works on Bun 1.3.9 but fails on 1.3.14 (CI node image),
likely due to differences in how mock.module handles built-in modules.

New approach uses behavioral verification: mock opencode-storage-paths
(same proven pattern as the B2 test) to redirect MESSAGE_STORAGE to a
tmpdir, then verify caching by creating the session dir AFTER the first
call — a working cache returns null (cached from first call), while a
broken cache would find the new dir and return its path.

Verified: 103/103 pass manager.test.ts, 105/105 other mock-heavy tests,
typecheck + lint clean.
Add 6 new entries to mock-heavy isolation in ci.yml and publish.yml to
eliminate 51 remaining-test failures:

Directories (all test files within run together):
  - tests/features/mission-state/  (was: individual plan-storage.test.ts)
  - tests/features/handoff/
  - tests/features/task-storage/
  - tests/hooks/session-recovery/

Individual files:
  - tests/plugin/session-agent-resolver.test.ts
  - tests/hooks/auto-update-checker/checker/pinned-version-updater.test.ts

Verified locally on Bun 1.3.9 + 1.3.14:
  - Mock-heavy isolated: 177 pass / 0 fail
  - Remaining batch:     2373 pass / 0 fail
@klpanagi
klpanagi merged commit 791d80a into dev Jul 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant