Add OpenSpec framework for unit test enhancement#120
Open
RahulRengeshOfficial wants to merge 1 commit into
Open
Add OpenSpec framework for unit test enhancement#120RahulRengeshOfficial wants to merge 1 commit into
RahulRengeshOfficial wants to merge 1 commit into
Conversation
OpenSpec Core Documents: - proposal.md: Problem statement, goals, 7 requirements - design.md: Technical architecture, mock patterns - tasks.md: 56 tasks across 18 phases (P0-P2) - status.md: Progress tracking OpenSpec Specs (11 files): - Module specs: DCM, Queries, Telemetry, Change, Shared, Supporting - Infrastructure: Mock DAO, Database tables, Use cases - Patterns: Test patterns, Module inventory OpenSpec Workflow (.github): - Prompts: explore, propose, apply, archive - Skills: openspec-explore, openspec-propose, openspec-apply-change, openspec-archive-change Key findings: - 3 DAO types: CachedSimpleDao (39 files), SimpleDao (1), ListingDao (1) - 100+ test scenarios documented - 15+ test_utils.go files to create
There was a problem hiding this comment.
Pull request overview
This PR introduces an OpenSpec “spec-driven” documentation/workflow scaffold for the “unit-test-enhancement” initiative in xconfadmin, including proposal/design/tasks/status trackers and module-specific specs, plus GitHub workflow prompt/skill docs to support the OpenSpec CLI-driven flow.
Changes:
- Adds OpenSpec change artifacts (proposal/design/tasks/status) and detailed specs covering modules, tables, use-cases, and test patterns for dual-mode (mock/real DB) testing.
- Adds OpenSpec GitHub “skills” and “prompts” documentation to standardize explore/propose/apply/archive workflows.
- Adds a minimal
openspec/config.yamlto declare schema usage.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| openspec/config.yaml | Declares OpenSpec schema (spec-driven) and placeholder sections for context/rules. |
| openspec/changes/unit-test-enhancement/proposal.md | Problem statement, goals, scope, and risks for dual-mode test enhancement. |
| openspec/changes/unit-test-enhancement/design.md | Technical design and patterns for mock/real DB switching and test structure. |
| openspec/changes/unit-test-enhancement/tasks.md | Large phased task breakdown for implementing mock support + idempotent tests. |
| openspec/changes/unit-test-enhancement/status.md | Status/progress tracker for phases and priorities. |
| openspec/changes/unit-test-enhancement/specs/use-cases.md | Cross-module use-case catalog and test-case matrix. |
| openspec/changes/unit-test-enhancement/specs/test-patterns.md | Standardized test patterns, forbidden patterns, and cleanup guidance. |
| openspec/changes/unit-test-enhancement/specs/telemetry-module-spec.md | Telemetry module-specific spec (tables, use-cases, issues, goals). |
| openspec/changes/unit-test-enhancement/specs/supporting-modules-spec.md | Specs for smaller modules (setting/rfc/canary/auth/xcrp/etc.) requiring mock support. |
| openspec/changes/unit-test-enhancement/specs/shared-modules-spec.md | Specs for shared packages and DAO-mock requirements (incl. ListingDao/SimpleDao). |
| openspec/changes/unit-test-enhancement/specs/queries-module-spec.md | Queries module-specific spec (architecture, issues, coverage goals). |
| openspec/changes/unit-test-enhancement/specs/module-inventory.md | Inventory of modules/files needing enhancement and patterns/issues present. |
| openspec/changes/unit-test-enhancement/specs/mock-infrastructure-spec.md | Requirements/spec for mock DAO infrastructure and init patterns. |
| openspec/changes/unit-test-enhancement/specs/dcm-module-spec.md | DCM module-specific spec (issues, tables, endpoints, coverage targets). |
| openspec/changes/unit-test-enhancement/specs/database-tables-spec.md | Table-to-entity mapping and DAO type usage summary. |
| openspec/changes/unit-test-enhancement/specs/change-module-spec.md | Change module-specific spec (SimpleDao emphasis, tasks/coverage goals). |
| .github/skills/openspec-propose/SKILL.md | Documentation for “propose” skill behavior and artifact generation flow. |
| .github/skills/openspec-explore/SKILL.md | Documentation for “explore” skill stance/guardrails. |
| .github/skills/openspec-apply-change/SKILL.md | Documentation for “apply” skill behavior and task execution loop. |
| .github/skills/openspec-archive-change/SKILL.md | Documentation for “archive” skill behavior and checks. |
| .github/prompts/opsx-propose.prompt.md | Prompt doc for /opsx:propose workflow. |
| .github/prompts/opsx-explore.prompt.md | Prompt doc for /opsx:explore workflow. |
| .github/prompts/opsx-apply.prompt.md | Prompt doc for /opsx:apply workflow. |
| .github/prompts/opsx-archive.prompt.md | Prompt doc for /opsx:archive workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+68
to
+78
| GetOne(tenantId, tableName, rowKey string) (interface{}, error) | ||
| GetOneFromCacheOnly(tenantId, tableName, rowKey string) (interface{}, error) | ||
| SetOne(tenantId, tableName, rowKey string, entity interface{}) error | ||
| DeleteOne(tenantId, tableName, rowKey string) error | ||
| GetAllByKeys(tenantId, tableName string, rowKeys []string) ([]interface{}, error) | ||
| GetAllAsList(tenantId, tableName string, maxResults int) ([]interface{}, error) | ||
| GetAllAsMap(tenantId, tableName string) (map[interface{}]interface{}, error) | ||
| GetAllAsShallowMap(tenantId, tableName string) (map[interface{}]interface{}, error) | ||
| GetKeys(tenantId, tableName string) ([]interface{}, error) | ||
| RefreshAll(tenantId, tableName string) error | ||
| RefreshOne(tenantId, tableName, rowKey string) error |
| func TestMain(m *testing.M) { | ||
| // 1. Check environment for mode selection | ||
| useMock := os.Getenv("USE_MOCK_DB") | ||
| isMockMode := useMock == "true" || useMock == "1" || useMock == "" |
Comment on lines
+141
to
+148
| db.GetDefaultTenantId(), | ||
| db.TABLE_ENTITY, | ||
| testID, | ||
| ) | ||
| } else { | ||
| db.GetCachedSimpleDao().DeleteOne( | ||
| db.GetDefaultTenantId(), | ||
| db.TABLE_ENTITY, |
Comment on lines
+284
to
+289
| func InitMockDatabase() { | ||
| mockDao = mocks.NewMockCachedSimpleDao() | ||
| mockListingDao = mocks.NewMockListingDao() | ||
| db.SetMockCachedSimpleDao(mockDao) | ||
| db.SetMockListingDao(mockListingDao) | ||
| } |
| | GetAllAsShallowMap | `(tableName string) (map[interface{}]interface{}, error)` | Get shallow map | | ||
| | GetAllByKeys | `(tableName string, rowKeys []string) ([]interface{}, error)` | Get by multiple keys | | ||
| | RefreshAll | `(tableName string) error` | Refresh cache | | ||
| | GetKeys | `(tableName string) ([]string, error)` | Get all keys | |
Comment on lines
+66
to
+68
| - `common/` - Configuration and constants | ||
| - `http/` - HTTP connectors (already has mocks) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OpenSpec Core Documents:
OpenSpec Specs (11 files):
OpenSpec Workflow (.github):
Key findings: