LESSON 3 OF 4
Exercise: validate rather than guess
Change the evidence
Add collection metadata
Add CheckedAtUTC, Target and CollectorVersion properties. A report without its time and target can be technically correct but unusable after a configuration change or when two teams test different endpoints.
Test contradictory data
Create a case with DNS FAILED and Application OK. The current classifier reports AVAILABLE because it prioritizes observed application success. Add a contradiction flag and describe possible causes; do not simply delete one observation.
Prepare a handoff
Write a ticket note with the user symptom, affected population, observations, interpretation and next owner. Include a reproducible target rather than saying checked network. Keep credentials and raw authentication tokens out of the report.
Diagnose failures
The script restarts a service after a ping failure
The remediation does not follow from the evidence. Return to read-only assessment and establish that the specific service is failing before proposing an approved action.
Results are stale when a ticket is escalated
Record timestamps and the collector version. Repeat only the checks relevant to the changed condition, then distinguish the new evidence from the original report.
A failure is converted into UNKNOWN without explanation
Preserve the collector error category. UNKNOWN should explain why no result is available: timeout, unsupported method, access denial, or a check not attempted.
A second worked example
$tickets = @(
[pscustomobject]@{Id=101;Priority=' high ';Owner='Ana'},
[pscustomobject]@{Id=102;Priority='Low';Owner='Ben'}
)
$tickets | Where-Object { $_.Priority.Trim().ToLowerInvariant() -eq 'high' } |
Select-Object Id, Owner | Export-Csv './high.csv' -NoTypeInformation
The comparison normalizes the priority for matching without rewriting the input objects. Ticket 101 is exported with Id and Owner. The relative output path is under the current directory, so run in a disposable practice folder. Inspect the CSV and confirm its row count before adding scheduling or a live ticket source.
Transfer exercise
Add a blank priority and a value Urgent. Explain how the report should handle them if only High and Low are approved categories.
Worked transfer answer
Flag both as invalid or unknown in a separate validation report instead of silently assuming Low. Protect the Trim call from null input if data can be missing. State the accepted categories and ensure every source row appears either in accepted processing or in the rejected-row count.
Exercise: validate rather than guess
A CSV row contains Application=SUCCESS instead of the declared OK/FAILED/UNKNOWN values. Should the classifier silently treat it as failure or success?
Worked reasoning
Neither. Validate each field against the input contract and return a clear invalid-data result or stop the report according to the specification. Unknown is a declared measurement state; an unexpected string is a schema/data problem. Keep the raw value and source row for correction. Add tests for an empty computer name and contradictory observations as separate failure classes.
Worked laboratory solution
Compare your reasoning with the worked solution
Only H2 is confirmed stopped. H3 has unknown service state because collection failed. H4 has a known absence, which may be expected or an inventory issue but is not a stopped installed service. The three cases require different owners and next steps. Return explicit fields such as Host, CollectionStatus, Installed, ServiceState and Reason rather than one misleading Boolean. Preserve a nonzero/error indication for collection failures in automation without discarding the successfully collected rows.
YOUR NEXT STEP
Keep building your skills
No directly related CogniSkill book is mapped to this course yet. Continue with the free learning, or compare the publishing catalogue by your next goal.
Explore books by topic and goal →Sign in to save lesson completion. Reading position is separate from completion.
Practice notes — your working space
Save predictions, outputs and explanations as you work. Notes stay on this browser, not your account; people sharing this browser can access them. Avoid passwords and sensitive data. Export to keep a portable copy, or clear your notes before leaving a shared device.
How was this lesson?
Help us improve this lesson.