Skip to content

Add front and back guard for undefined#3556

Merged
jmthomas merged 2 commits into
mainfrom
script_guard
Jul 11, 2026
Merged

Add front and back guard for undefined#3556
jmthomas merged 2 commits into
mainfrom
script_guard

Conversation

@jmthomas

Copy link
Copy Markdown
Member

This was observed in the wild in a bad deployment where a script hung and thus didn't create a log. The request for the log resulted in a bad URL path. Add a check for the log in the frontend and a sanity check in the backend.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.34%. Comparing base (56a2a5f) to head (c7f9ed1).

Files with missing lines Patch % Lines
...-cmd-tlm-api/app/controllers/storage_controller.rb 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3556      +/-   ##
==========================================
+ Coverage   79.29%   79.34%   +0.04%     
==========================================
  Files         691      691              
  Lines       57724    57730       +6     
  Branches      728      728              
==========================================
+ Hits        45773    45803      +30     
+ Misses      11873    11849      -24     
  Partials       78       78              
Flag Coverage Δ
python 80.31% <ø> (ø)
ruby-api 81.43% <33.33%> (+0.54%) ⬆️
ruby-backend 83.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Wrap viewScriptLog request/decode in try/catch to match downloadScriptLog,
so a present-but-404 log identifier no longer throws on window.atob. Update
storage_controller specs to mock File.exist? for the new backend 404 guard.
Drop exact wait-time assertions in test_api_shared that flake on slow CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@jmthomas

Copy link
Copy Markdown
Member Author

Does the frontend guard also cover the interval between requesting a log and the backend returning that no log exists, or only an initially undefined value? A regression test for a script record that exists but never acquires a log identifier could verify that neither navigation nor polling constructs a path containing undefined.

I think we're fully covered on that path but I did find another path in RunningScripts where we download the log.

@jmthomas
jmthomas merged commit c0b0967 into main Jul 11, 2026
55 of 57 checks passed
@jmthomas
jmthomas deleted the script_guard branch July 11, 2026 16:59
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