Repository navigation
Idle container shutdown (Epic 1/6) Idle shutdown management - #540
Open
cmyers-mieweb wants to merge 5 commits into
Open
cmyers-mieweb wants to merge 5 commits into
cmyers-mieweb wants to merge 5 commits into
Conversation
Supertest integration tests for every endpoint ahead of migrating the legacy route to resources/resource-requests (mvc-manifesto §6 step 1). Refs #526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Split the legacy god route into router/controller/service/repository/ validator/serializer per mvc-manifesto §6. Wire contract unchanged and pinned by the integration suite; validation now goes through zod via the shared validate() middleware with the legacy per-field messages. Refs #526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- idleTime (hours, 0 = never) joins RESOURCE_DEFAULTS; VALID_RESOURCE_TYPES is now derived from the defaults so the two can't drift. - Per-type RESOURCE_POLICIES in the service: idleTime auto-approves 1..72 (inverted vs capacity types), needs review for >72 or 0, never enqueues reconfigure-container.js, and can be approved without a provisioned container. - getIdleTimeHours(container) + IDLE_TIME_NEVER for the idle sweep (#527). - /resource-requests/effective returns idleTime. - Client: idle shutdown row on the Resources card (Never / hours / days); defaults, labels and formatting consolidated into lib/resources.ts. - OpenAPI: shared ResourceType/ResourceValue/EffectiveResources schemas. Closes #526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…bles The new 'Idle shutdown' label and '3 days -> 8 hours' amounts wrapped inside the narrow Resource/Amount columns. Refs #526 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Validation failures hide the non-negative-integer requirement, and the UI incorrectly describes which durations require approval.
2 open issues
What changed in this PR
Adds configurable idle-shutdown settings to the existing container resource-request workflow. Automatic shutdown and wake-up remain planned for later stages.
Changes:
- Adds
idleTimedefaults, approval policies, API validation, and tests. - Adds idle-time controls and shared resource formatting to the UI.
- Documents approval rules and the broader idle-shutdown design.
| File | Description |
|---|---|
| mie-opensource-landing/zensical.toml | Adds idle-shutdown documentation navigation. |
| mie-opensource-landing/docs/developers/idle-shutdown.md | Documents design and implementation stages. |
| mie-opensource-landing/docs/admins/core-concepts/containers.md | Explains resource approval rules. |
| create-a-container/routers/api/v1/resource-requests.js | Removes the monolithic router. |
| create-a-container/routers/api/v1/index.js | Mounts the replacement router. |
| create-a-container/resources/resource-requests/validator.js | Defines request validation schemas. |
| create-a-container/resources/resource-requests/service.js | Centralizes approval and application policies. |
| create-a-container/resources/resource-requests/serializer.js | Defines resource-request responses. |
| create-a-container/resources/resource-requests/router.js | Connects routes, validation, and authorization. |
| create-a-container/resources/resource-requests/repository.js | Encapsulates database access. |
| create-a-container/resources/resource-requests/controller.js | Connects HTTP handlers to services. |
| create-a-container/resources/resource-requests/__tests__/service.test.js | Tests policies and idle-time defaults. |
| create-a-container/resources/resource-requests/__tests__/resource-requests.api.test.js | Tests API behavior and job creation. |
| create-a-container/openapi.v1.yaml | Documents idle-time schemas and approvals. |
| create-a-container/models/resourcerequest.js | Adds the idle-time resource default. |
| create-a-container/client/src/pages/resource-requests/ResourceRequestsPage.tsx | Uses shared formatting for admin requests. |
| create-a-container/client/src/pages/resource-requests/MyRequestsPage.tsx | Uses shared formatting for user requests. |
| create-a-container/client/src/lib/types.ts | Extends resource types with idle time. |
| create-a-container/client/src/lib/resources.ts | Centralizes defaults, labels, and formatting. |
| create-a-container/client/src/components/containers/ResourceValueInput.tsx | Supports custom preset labels. |
| create-a-container/client/src/components/containers/ResourcesSection.tsx | Adds idle-shutdown controls and explanatory text. |
Review effort: Balanced
| router.get('/', validate({ query: listQuery }), ctrl.list); | ||
| router.get('/count', ctrl.count); | ||
| router.get('/effective/:siteId/:hostname/:username', validate({ params: effectiveParams }), ctrl.effective); | ||
| router.post('/', validate(createRequest), ctrl.create); |
Comment on lines
+180
to
+181
| (SSH and direct connections don't count). Shortening it applies immediately; longer | ||
| or Never requires admin approval. |
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.


Issue: #526
This pull request adds support for managing the "idle shutdown" (idleTime) resource for containers, allowing users to configure how long a container can be idle before being automatically stopped. It introduces new UI elements, validation, and formatting for idleTime, updates the resource request and display logic, and ensures both client and API schemas are consistent. The changes also refactor resource-related constants and formatting utilities for consistency and maintainability.
Idle Time Resource Support
idleTimeas a supported resource type throughout the UI, API schema, and backend model, allowing users to request and view idle shutdown settings for containers. [1] [2] [3] [4]idleTime, only values between 1 and 72 hours are auto-approved, while longer or "never" (0) require admin review.UI Enhancements & Formatting
ResourceValueInputto support custom formatting for preset labels, enabling correct display of idleTime options. [1] [2] [3] [4]Refactoring & Consistency
lib/resources.ts, removing duplication from multiple files and ensuring consistent display and validation across the app. [1] [2] [3]API Schema Updates
idleTimein all relevant types, enums, and documentation, clarifying units and approval behavior. [1] [2] [3]These changes collectively enable users and admins to control and view idle shutdown settings for containers, with clear UI and robust backend support.
Screenshots