Skip to content

refactor(resources): one canonical layout, scoped bases, dedup schemas#55

Merged
Datata1 merged 1 commit into
mainfrom
refactor/04-resource-layer-normalization
Jul 12, 2026
Merged

refactor(resources): one canonical layout, scoped bases, dedup schemas#55
Datata1 merged 1 commit into
mainfrom
refactor/04-resource-layer-normalization

Conversation

@Datata1

@Datata1 Datata1 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Implements plans/refactor/04-resource-layer-normalization.md:

  • Canonical per-resource layout everywhere: operations.py / schemas.py / resources.py. Renamed domain+usage manager.py and envVars/git/ landscape/logs models.py to resources.py; git schema.py -> schemas.py; deleted the zero-byte landscape/resources.py placeholder
  • envVars/ package renamed to env_vars/; the old camelCase import path remains as a deprecation shim module (warns, re-exports)
  • Domain entity moves to domain/schemas.py alongside its base (matching Team/Workspace); TeamDomainManager lives in domain/resources.py; domain/init.py gains proper re-exports
  • New TeamScopedResource / WorkspaceScopedResource bases in core/base.py replace six copy-pasted manager __init__s; managers expose team_id/workspace_id consistently
  • EnvVar derives from CamelModel like every other schema (gains to_dict/to_json/to_yaml)
  • PipelineStatusList is now an alias of ResourceList[PipelineStatus] instead of a reimplementation
  • PaginatedResponse: refresh() hoisted from the two response subclasses, limit/offset are non-Optional with defaults (drops the repeated 'or 25' re-defaulting); single _clamp_page_size helper replaces four inline min(max(...)) clamps
  • Deleted dead utils.dict_to_model_list

Only internal module paths moved; all public re-exports (top-level codesphere, package __init__s) are unchanged, plus the envVars shim.

Implements plans/refactor/04-resource-layer-normalization.md:

- Canonical per-resource layout everywhere: operations.py / schemas.py /
  resources.py. Renamed domain+usage manager.py and envVars/git/
  landscape/logs models.py to resources.py; git schema.py -> schemas.py;
  deleted the zero-byte landscape/resources.py placeholder
- envVars/ package renamed to env_vars/; the old camelCase import path
  remains as a deprecation shim module (warns, re-exports)
- Domain entity moves to domain/schemas.py alongside its base (matching
  Team/Workspace); TeamDomainManager lives in domain/resources.py;
  domain/__init__.py gains proper re-exports
- New TeamScopedResource / WorkspaceScopedResource bases in core/base.py
  replace six copy-pasted manager __init__s; managers expose
  team_id/workspace_id consistently
- EnvVar derives from CamelModel like every other schema (gains
  to_dict/to_json/to_yaml)
- PipelineStatusList is now an alias of ResourceList[PipelineStatus]
  instead of a reimplementation
- PaginatedResponse: refresh() hoisted from the two response subclasses,
  limit/offset are non-Optional with defaults (drops the repeated
  'or 25' re-defaulting); single _clamp_page_size helper replaces four
  inline min(max(...)) clamps
- Deleted dead utils.dict_to_model_list

Only internal module paths moved; all public re-exports (top-level
codesphere, package __init__s) are unchanged, plus the envVars shim.
@Datata1 Datata1 self-assigned this Jul 12, 2026
@github-actions

Copy link
Copy Markdown

🛡️ Bandit Security Scan Results

✅ No security issues found by Bandit.

@github-actions

Copy link
Copy Markdown

Coverage

Pytest Coverage Report
FileStmtsMissBranchBrPartCoverMissing
__init__.py9000100% 
client.py40060100% 
config.py9000100% 
exceptions.py9432382259%25->30, 40–42, 53->58, 54->55, 55, 73->74, 74, 85–87, 101–104, 106–107, 148–151, 158–160, 196->197, 197–199, 204->205, 205, 206->207, 207, 210->211, 211, 214, 215->216, 216, 217->218, 218–219, 222
http_client.py4966285%42->exit, 52->exit, 87–88, 90–91, 96–97
utils.py1024179%9->10, 10–11
core
   __init__.py4000100% 
   base.py55020100% 
   handler.py59318096%80–82
   operations.py15000100% 
resources
   __init__.py0000100% 
resources/metadata
   __init__.py3000100% 
   operations.py6000100% 
   resources.py13000100% 
   schemas.py28000100% 
resources/team
   __init__.py5000100% 
   operations.py8000100% 
   resources.py11000100% 
   schemas.py27000100% 
resources/team/domain
   __init__.py3000100% 
   operations.py11000100% 
   resources.py16000100% 
   schemas.py5550091%67, 69, 72, 75–76
resources/team/usage
   __init__.py3000100% 
   operations.py4000100% 
   resources.py4328292%99->102, 102, 162->165, 165
   schemas.py7076584%66->67, 67, 72–73, 76, 84–86
resources/workspace
   __init__.py5000100% 
   envVars.py4000100% 
   operations.py12000100% 
   resources.py1624280%13->14, 14, 19->20, 20
   schemas.py99146681%100–101, 103–109, 115–116, 118, 142, 161
resources/workspace/env_vars
   __init__.py3000100% 
   operations.py7000100% 
   resources.py25212484%28->30, 30–31, 33->exit
   schemas.py4000100% 
resources/workspace/git
   __init__.py3000100% 
   operations.py8000100% 
   resources.py15040100% 
   schemas.py4000100% 
resources/workspace/landscape
   __init__.py3000100% 
   operations.py12000100% 
   resources.py94736888%27->28, 28, 126->129, 132->135, 158->159, 159–160, 162->157, 165->166, 166, 170–172
   schemas.py2902910489%113–114, 117, 122–123, 126–127, 130, 135–137, 140–141, 144, 251, 258–259, 334–336, 338–340, 342–343, 458–459, 466–467
resources/workspace/logs
   __init__.py3000100% 
   operations.py5000100% 
   resources.py15186625434%41–42, 48, 50–52, 54, 57–58, 61, 64–65, 67–70, 72–73, 76–77, 79–80, 82–83, 85–87, 89–90, 92–96, 98–99, 101–103, 105–110, 123–124, 209–211, 220–222, 231–233, 243–252, 262–271, 281–290
   schemas.py19000100% 
TOTAL143219722211081% 

Test Execution Summary

Tests Skipped Failures Errors Time
279 0 💤 0 ❌ 0 🔥 2.999s ⏱️

@github-actions

Copy link
Copy Markdown

Integration Test Results

63 tests    0 ✅  10s ⏱️
 1 suites   0 💤
 1 files    24 ❌  39 🔥

For more details on these failures and errors, see this check.

Results for commit 8c9f102.

@Datata1 Datata1 merged commit f401ab3 into main Jul 12, 2026
3 of 5 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