Skip to content

Conversation

@hessius
Copy link
Owner

@hessius hessius commented Feb 1, 2026

No description provided.

hessius and others added 30 commits February 1, 2026 10:02
- GET /api/machine/status - machine status and current profile
- POST /api/machine/preheat - start preheating (10 min duration)
- POST /api/machine/run-profile/{profile_id} - load and run a profile
- POST /api/machine/schedule-shot - schedule shot with optional preheat
- DELETE /api/machine/schedule-shot/{schedule_id} - cancel scheduled shot
- GET /api/machine/scheduled-shots - list scheduled shots

Uses pyMeticulous library directly for machine communication.
Preheat implemented via auto_preheat setting as per Meticulous API.
- Fix timezone handling in schedule_shot endpoint
- Add proper None check for API connection in preheat/run_profile
- Add validation for profile_id OR preheat requirement
- Add 14 comprehensive tests for run shot functionality
Returns version information for MeticAI, MeticAI-web, and MCP server.
…rofile overlays

- Fix exit trigger validation: use end_pressure/end_flow for <= comparisons
- Add start_pressure/end_pressure/start_flow/end_flow to stage stats
- Add execution description to stage analysis (e.g., 'Pressure rose from X to Y bar')
- Generate profile target curves for chart overlay
- Add _generate_profile_target_curves function for chart data
- Add _generate_execution_description function for descriptive narratives
- Add 12 new tests for analysis improvements

Subtasks completed:
- 3.1: Fix exit criteria validation (was using max values for all comparisons)
- 3.2: Add descriptive stage analysis
- 3.3: Add profile target curves for graph overlay
- GET /api/machine/status - machine status and current profile
- POST /api/machine/preheat - start preheating (10 min duration)
- POST /api/machine/run-profile/{profile_id} - load and run a profile
- POST /api/machine/schedule-shot - schedule shot with optional preheat
- DELETE /api/machine/schedule-shot/{schedule_id} - cancel scheduled shot
- GET /api/machine/scheduled-shots - list scheduled shots

Uses pyMeticulous library directly for machine communication.
Preheat implemented via auto_preheat setting as per Meticulous API.
- Fix timezone handling in schedule_shot endpoint
- Add proper None check for API connection in preheat/run_profile
- Add validation for profile_id OR preheat requirement
- Add 14 comprehensive tests for run shot functionality
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
- GET /api/machine/status - machine status and current profile
- POST /api/machine/preheat - start preheating (10 min duration)
- POST /api/machine/run-profile/{profile_id} - load and run a profile
- POST /api/machine/schedule-shot - schedule shot with optional preheat
- DELETE /api/machine/schedule-shot/{schedule_id} - cancel scheduled shot
- GET /api/machine/scheduled-shots - list scheduled shots

Uses pyMeticulous library directly for machine communication.
Preheat implemented via auto_preheat setting as per Meticulous API.
- Fix timezone handling in schedule_shot endpoint
- Add proper None check for API connection in preheat/run_profile
- Add validation for profile_id OR preheat requirement
- Add 14 comprehensive tests for run shot functionality
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Mock underlying API calls to raise ConnectionError rather than mocking
get_meticulous_api() to return None, which can never happen in production.

- test_machine_status_no_connection: Mock api.session.get to raise ConnectionError
- test_preheat_no_connection: Mock api.update_setting to raise ConnectionError
- test_run_profile_no_connection: Mock api.load_profile_by_id to raise ConnectionError

This reflects actual production behavior where the API instance exists but
network calls can fail.

Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
Follow PEP 8 style guidelines by importing requests at module level
instead of within individual test methods.

Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
Remove dead code check in run_profile endpoint
Fix connection error tests to mock actual API failures
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
Extract execute_scheduled_shot to module-level function
Remove duplicate TestVersionEndpoint class with incomplete test
…-4a6e-aaea-4d0017578c4a

Add persistence for scheduled shots
@hessius
Copy link
Owner Author

hessius commented Feb 1, 2026

@copilot python tests failing

The failing tests are caused by errors like:

Failed to schedule shot: schedule_shot.<locals>.execute_scheduled_shot() got an unexpected keyword argument 'schedule_id'

This indicates that in your /api/machine/schedule-shot endpoint, you are trying to call execute_scheduled_shot with a keyword argument schedule_id, but the async function on line 2057 does not accept schedule_id as a keyword argument.

Solution

Update the code in your async task creation (lines ~6169–6177):

task = asyncio.create_task(
    execute_scheduled_shot(
        schedule_id=schedule_id,
        shot_delay=shot_delay,
        preheat=preheat,
        profile_id=profile_id,
        scheduled_shots_dict=_scheduled_shots,
        scheduled_tasks_dict=_scheduled_tasks,
        preheat_duration_minutes=PREHEAT_DURATION_MINUTES
    )
)

to a positional invocation:

task = asyncio.create_task(
    execute_scheduled_shot(
        schedule_id,
        shot_delay,
        preheat,
        profile_id,
        _scheduled_shots,
        _scheduled_tasks,
        PREHEAT_DURATION_MINUTES
    )
)

Why this works:
Your execute_scheduled_shot definition takes only positional parameters, not keyword arguments. Python throws a TypeError when you pass keyword arguments not explicitly allowed.

Code Fix Example

Replace lines 6169–6177 in main.py:

task = asyncio.create_task(
    execute_scheduled_shot(
        schedule_id,
        shot_delay,
        preheat,
        profile_id,
        _scheduled_shots,
        _scheduled_tasks,
        PREHEAT_DURATION_MINUTES
    )
)

This should resolve the test failures related to scheduling shots and cancellation.

Summary:
Pass all arguments to execute_scheduled_shot positionally instead of by keyword throughout your scheduling endpoints. This fixes the unexpected keyword argument error and will allow your scheduled shot endpoints to function as intended.

Copy link
Contributor

Copilot AI commented Feb 1, 2026

@hessius I've opened a new pull request, #128, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits February 1, 2026 18:31
Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
Fix schedule_shot async task invocation with incorrect parameters
@hessius
Copy link
Owner Author

hessius commented Feb 1, 2026

@copilot test coverage has now fallen below threshold. Please aim for coverage of 75%, even if current threshold is just 68%. If 75% is reached please adjust the threshold upwards. DO NOT adjust the threshold downward.

Copy link
Contributor

Copilot AI commented Feb 1, 2026

@hessius I've opened a new pull request, #129, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 14 commits February 1, 2026 20:59
Co-authored-by: hessius <1499030+hessius@users.noreply.github.com>
Increase test coverage from 63% to 67%
… from repo URL

- Replace PartialSettings(auto_preheat=1) with api.execute_action(ActionType.PREHEAT)
- Fix preheat in: scheduled shots, restored shots, and /api/machine/preheat endpoint
- Strip .git suffix from mcp_repo_url in version endpoint (both .versions.json and git remote)
- Update tests to mock execute_action instead of update_setting
…te restart signal file

- Add /api/changelog endpoint with 1-hour server-side caching of GitHub releases
- Mount VERSION file at /VERSION for version info endpoint
- Create .restart-requested file for restart signal functionality
- Import timedelta for changelog cache duration
…urves

The Meticulous API returns stages with a 'dynamics' object containing
'points', 'over', and 'interpolation' attributes, not as direct stage
attributes. This fixes the profile target curves visualization in the
analysis graph.
- Fetch git commit hash for meticai-web and MCP repositories
- Return commit hashes alongside version numbers
- Use commit hash as version fallback for MCP if no version found
- Add /api/watcher-status endpoint to detect if rebuild-watcher is running
- Display watcher status indicator in Settings System section
- Show warning if watcher is not running with install instructions
- Fix path resolution for meticai-web and meticulous-source in version endpoint
- Filter out Installation section from changelog
- Enhance MarkdownText to handle block-level markdown (headers, lists, code blocks)
- Remove git commit hash from meticai-web version display
- Mount watcher log file for status detection
- Update installer to create watcher log file before docker compose
When a container restarts during the preheat phase of a scheduled shot,
the restoration logic now:
- Detects if the shot was already in 'preheating' status
- Skips the preheat delay calculation and just waits for shot time
- Assumes the machine preheat is still running from before restart
- Logs the current status and delay for debugging

This fixes the bug where shots would be skipped if a rebuild/restart
happened during the preheat window.
- Rename 'Run Shot' to 'Run / Schedule' throughout the app
- Add recurring schedules persistence layer with JSON file storage
- Add API endpoints: GET/POST/PUT/DELETE /api/machine/recurring-schedules
- Support recurrence types: daily, weekdays, weekends, every X days, specific days
- Add background task to check and schedule next occurrences hourly
- Add full UI for creating, editing, toggling, and deleting recurring schedules
- Show next scheduled occurrence for each recurring schedule
- Automatically create one-time scheduled shots from recurring schedules
- TestRecurringSchedulesPersistence: 6 tests for save/load/error handling
- TestGetNextOccurrence: 8 tests for next occurrence calculation
- TestRecurringScheduleEndpoints: 14 tests for CRUD API endpoints
- TestWatcherStatusEndpoint: 3 tests for watcher status endpoint
- TestScheduledShotRestoration: 2 tests for preheating status
- TestRecurringScheduleChecker: 2 tests for background task logic

Total: 48 new tests, all 321 tests passing
Issues fixed:
1. Profile name matching now strips whitespace (trailing space mismatch)
2. Dynamics points extraction now works with Pydantic Dynamics objects
3. Stage timing matching now uses stripped identifiers

The profile_target_curves are now visible in the shot analysis response
and will overlay on the shot chart when the 'Analyze' tab is activated.
…rves

The embedded profile in shot data uses nested format (dynamics.points/dynamics.over)
while profiles fetched from the API are converted to flat format (dynamics_points).
Now _generate_profile_target_curves handles both formats.
The initial peak flow from piston retraction was being used to assess
if flow targets were reached. Now uses end_flow which reflects the
actual stabilized flow value at stage end.
New Features:
- Profile target curves overlay on analysis chart (dashed lines with dots)
- Extraction summary card showing post-preinfusion stages
- Stage backgrounds and legend in analysis chart

Fixes:
- Fixed nested dynamics format (dynamics.points) for embedded profiles
- Use end_flow instead of max_flow for flow stage assessments
- Profile images now load for all profiles (removed 20 limit)
- Fixed analysis chart alignment and margins

Tests:
- Added tests for nested dynamics format
- Added tests for end_flow vs max_flow in assessments
- All 108 frontend tests passing
- 31 unit tests passing
@hessius
Copy link
Owner Author

hessius commented Feb 2, 2026

Version 1.1.0 - Ready for Review

New Features

  • Profile Target Curves: Generate target overlay curves for shot analysis charts

    • Supports both nested (dynamics.points) and flat (dynamics_points) formats
    • Proper handling of embedded profiles in shot data
  • Extraction Summary: Backend now calculates extraction stage summaries

Fixes

  • Flow Stage Assessment: Now uses end_flow instead of max_flow for flow stage assessments
    • The initial peak flow from piston retraction was misleading users
    • Assessment now correctly reflects stabilized flow values

Tests

  • Added 4 new tests:
    • test_generate_profile_target_curves_nested_dynamics_format
    • test_generate_profile_target_curves_handles_both_formats
    • test_flow_stage_assessment_uses_end_flow_not_max_flow
    • test_pressure_stage_assessment_uses_max_pressure

All unit tests passing (31 tests).

@hessius hessius merged commit feaca4d into main Feb 2, 2026
3 of 9 checks passed
@hessius hessius deleted the version/1.1.0 branch February 2, 2026 21:14
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.

2 participants