Skip to content

adds polling on prediction run with UI progress notification#3

Merged
SteveDala merged 1 commit into
SteveDala:Feature/AI-Suggestionfrom
jtalev:poll-prediction-job
May 16, 2026
Merged

adds polling on prediction run with UI progress notification#3
SteveDala merged 1 commit into
SteveDala:Feature/AI-Suggestionfrom
jtalev:poll-prediction-job

Conversation

@jtalev
Copy link
Copy Markdown

@jtalev jtalev commented May 5, 2026

Description

Polls backend for job status and updates UI accordingly

image image

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Manual testing in browser

Testing Checklist:

  • Tested in latest Chrome

Checklist:

  • [] My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have requested a review from @macite and @jakerenzella on the Pull Request

Copy link
Copy Markdown

@officialid130-13e13 officialid130-13e13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the changes look good. The only thing I noticed is that enablePrediction is hardcoded to true in task-definition-effort.component.ts (around line 22). Since we now have a unit‑level flag - unit.allowEffortPredictions, this value should come from the unit rather than being hardcoded.

@jtalev
Copy link
Copy Markdown
Author

jtalev commented May 7, 2026

Overall the changes look good. The only thing I noticed is that enablePrediction is hardcoded to true in task-definition-effort.component.ts (around line 22). Since we now have a unit‑level flag - unit.allowEffortPredictions, this value should come from the unit rather than being hardcoded.

Fair point, I think I just decided to leave this as I wasn't sure whether we still wanted to have task level control over running predictions, we should discuss again as a team in the weekly meeting to see what we want to do and either delete this checkbox or update to include your suggestion here so we aren't doubling up on work

@SteveDala
Copy link
Copy Markdown
Owner

SteveDala commented May 7, 2026

Overall the changes look good. The only thing I noticed is that enablePrediction is hardcoded to true in task-definition-effort.component.ts (around line 22). Since we now have a unit‑level flag - unit.allowEffortPredictions, this value should come from the unit rather than being hardcoded.

Fair point, I think I just decided to leave this as I wasn't sure whether we still wanted to have task level control over running predictions, we should discuss again as a team in the weekly meeting to see what we want to do and either delete this checkbox or update to include your suggestion here so we aren't doubling up on work

We do want to keep task level control over whether predictions are enabled. Each task gets its own prediction job and value so even if we kick it off as a batch job from the unit, we need to keep the ability for the unit staff to disable and enter manually.

This discussion is outside of the scope of this pull request. I think the changes made are good.


@Injectable()
export class SidekiqJobService extends CachedEntityService<SidekiqJob> {
protected readonly endpointFormat = 'sidekiq/:id:';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert this change, I have found that it breaks the integration for retrieving Sidekiq jobs on the frontend, meaning that it now only ever shows "prediction failed".

if (this.pollSub) {
this.pollSub.unsubscribe();
}
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would also be wise to implement an ngOnChanges(changes: SimpleChanges) as currently when switching between tasks the html for a prediction succeeding or failing is keeping the phantom state of the last task.

private resetPredictionState() {
  this.isPredicting = false;
  this.predictionStatus = undefined;
  this.jobId = null;
}

ngOnChanges(changes: SimpleChanges) {
  if (changes['taskDefinition']) {
    this.resetPredictionState();
  }
}

Also ensure to import { OnChanges, SimpleChanges } from '@angular/core';

@SteveDala SteveDala merged commit 5d43f88 into SteveDala:Feature/AI-Suggestion May 16, 2026
1 check 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.

4 participants