fs-sanity-check¶
Run the sanity checks in one call (tdfs4ds.sanity_check), write the HTML or Markdown report, read the verdict and decide what to fix first. No language model; nothing is changed.
Each check with its why and an example: The sanity checks: what each one finds. Findings are leads for an expert, not verdicts.
name: "Feature Store: Sanity check"
description: "Generate code to run the tdfs4ds sanity checks in one call and write the HTML or Markdown report (tdfs4ds.sanity_check), read the verdict, say whether run() and roll_out() can still refresh each process, and decide what to fix first. Code only, no language model, changes nothing. Invoke when the user asks for a sanity check or health check, whether a pipeline or store is healthy, whether a process can still be refreshed, or what to check before a migration. SKIP for what one finding means in detail or for the thresholds of the checks (use fs-workflow-assessment), for catalog/storage consistency and orphans (use fs-inspect) and for the performance of one process (use fs-analyze)."
argument-hint: "[report path][data-domain] [processes]"
allowed-tools: "Read, Edit, Write, Bash, Glob, Grep"
Generate Python code that runs the tdfs4ds sanity checks and writes the report, then help the user read it.
User context: $ARGUMENTS
Always tell the user: These checks are not exhaustive and can report false positives: have an expert review the findings. They support experts, they do not replace them. A finding is a lead to investigate, not a verdict. The absence of a finding is not proof that everything is well. Repeat this when you present findings.
Related skills¶
| Step | Skill | Why |
|---|---|---|
| Before | fs-setup |
Connect first if no Teradata context is open. |
| Before | fs-lineage-graph |
The order and input checks read the persisted lineage graph. |
| Details | fs-workflow-assessment |
Every finding with its meaning and fix; findings as data; thresholds. |
| Fix | fs-upload |
Stay inside the framework: what replaces a loop or a custom step around a process. |
| Fix | fs-rollout |
Re-run in the right order, rebuild a history. |
| After | fs-migrate |
A migration report opens with these checks on the source store. |
Ask for any missing values before generating code:
- Report format: HTML to read or share, Markdown for a wiki.
- Scope: cheap unless the user asks about entity keys or empty dataset columns.
- Data domains or processes, or the whole store.
Run¶
import tdfs4ds
tdfs4ds.connect(database='<DATABASE>')
path = tdfs4ds.sanity_check('<REPORT>.html') # a .md path writes Markdown; returns the path
| Argument | Meaning |
|---|---|
out_path |
The report file. Default: tdfs4ds.DASHBOARD_REPORT_DIR. |
fmt |
'html' or 'md', overrides the extension. 'csv' writes the findings alone. |
processes |
Process ids or view names. Default: every process. |
data_domains |
Restrict to these data domains. |
scope |
'cheap' (default): the checks a migration report runs, closed entities included. 'full' adds the entity and dataset scans, which read the storage tables. |
display |
Print the summary and the findings. Default True. |
The checks use no language model and change nothing. A finding names its fix and never runs it. An exported report names the checks it left out.
The order and input checks need the persisted lineage graph. When it is empty they are reported as not verified, never as passing:
Read the report¶
- Executive summary: the overall verdict, the main issues, and one row per process in execution order, with a cell per dimension:
ok, the worst severity found, orn/awhen the check did not run. - Not verified: what could not be checked, and why. It is not a pass.
- Checks not run: under
scope='cheap', the entity and dataset scans.
A redundant_key_column on a bucket column (entity (KEY, KEY_BUCKET), primary_index=[KEY], FilterManager or partitioning) is info, so it does not lower the verdict. A process that wrote 0 rows counts as done for its date unless an upstream wrote rows after it (no false "upstream recomputed after"). The server_batch check (cheap) compares the server-side batch objects with their registry: server_batch_object_missing (SERVER_SIDE_BATCH is on but the procedure is absent: every batch falls back to the client path), server_batch_body_drift, server_batch_stale, server_batch_orphan. A point-in-time read (D - 1, AS OF) is not reported as a window.
Fix in this order, because later findings can be symptoms of earlier ones:
- Lineage errors: a view or a process that no longer has what it reads.
- Refresh:
not refreshable, thenat risk. - Run order and point-in-time inputs: values computed on the wrong inputs.
- Segments and SQL changed without a run: re-run the process.
- Entity keys, skew and distribution: these change storage, so plan them.
Can run() and roll_out() refresh this process?¶
run() and roll_out() refresh a process from what is registered: its view, managers and options. What was done around them is not replayed, and no error is raised.
usage = tdfs4ds.process_usage_for('<PROCESS_ID>', closed=True) # closed=True also reads the storage tables
usage['verdict'] # 'refreshable', 'at risk', 'not refreshable' or 'not checked'
usage['reasons']
usage['findings'] # kind, label, severity, detail, fix
usage['unverifiable']
| Verdict | Meaning |
|---|---|
refreshable |
No refresh finding, or information only. When storage_checked is false, the verdict comes from the run history only. |
at risk |
At least one warning: a refresh may not reproduce the data. |
not refreshable |
At least one error: a refresh only repeats the last state. |
not checked |
The check did not run. |
| Finding | What happened | What to do |
|---|---|---|
external_time_loop |
One execution wrote several business dates with no TimeManager. | A TimeManager and one roll_out. |
external_segment_loop |
One execution completed one date several times with no FilterManager. | upload_features(..., filtermanager=fm), then run. |
view_rewritten_between_runs |
The view was rewritten with a new literal for each run. | Read the value from a manager. |
recursive_query |
Recursion in the SQL chain. A date or sequence generator is a warning; walking a hierarchy is information. | A TimeManager, or valid_time_column when the source holds the history. |
closed_without_flag |
Entities have only closed periods while close_absent_entities is off. |
close_absent_entities=True if entities really leave; otherwise find what closes them. |
validity_gap_without_flag |
A gap in an entity's history. A run leaves none, so a step outside it ended a period. | Remove that step, then rebuild the history with roll_out(..., force_compute=True) from the first date. |
writes_outside_run |
The query log shows writes to a FS_T_* table without the package's query band. Information only: removals and relocations write the same way. |
Check who wrote. |
Never propose a loop or a custom step around run / roll_out, or a write to FS_T_*. See Stay inside the framework in fs-upload.
Limits: a loop whose runs fall in separate executions looks like a schedule. A loop calling roll_out one step at a time looks like a roll_out: only what its step did to storage shows, so ask for closed=True, or scope='cheap' or 'full', which include that read.
Will one roll_out cover the data domain?¶
Check order also asks, per data domain checked, whether roll_out(data_domain=...) moves every TimeManager its processes read (the rule roll_out applies, shared with tdfs4ds.write_time_manager_report()):
| Finding | Severity | What to do |
|---|---|---|
rollout_refused |
error | A process reads a manager on other dates than the clock: the domain's roll-out stops before its first date. align_domain_time_managers(domain, calendars=True, dry_run=True). |
rollout_no_single_calendar |
warning | No clock, processes on several tables of dates. set_domain_time_manager(...), then align. |
manager_shared_across_domains |
warning | One manager read by processes of several data domains: rolling one out moves it for all. Give each domain its own soft clones (align), or roll them out together. |
domains_share_calendar |
info | Two clocks on one table of dates: in step only when every domain is rolled out to the same date. |
Only the managers read by the processes checked are considered (leftovers no process reads are not reported).
Is the domain clock up to date? (0.3.7.31)¶
The cheap check clock compares each domain clock with its calendar rule (the stored one, else inferred from the dates):
| Finding | Severity | What to do |
|---|---|---|
glossary_valid_in_future |
warning | A glossary term starts at a future time: nothing reads it until then. Metadata is written at the current time since 0.3.7.34, so this only comes from an explicit valid_from= or an older write. |
documentation_valid_in_future |
warning | A documented part starts at a future time: the pipeline and the agent read documentation at the current time, so it is invisible until then. Documentation written with 0.3.7.34 or later starts when written. |
metadata_valid_in_future |
warning | Catalog rows (feature or process catalog, data distribution, manager associations, process SQL versions) start at a future time, typically a registration made by a roll_out at a future business date before 0.3.7.34: what they register looks absent today. Inspect with NONSEQUENCED VALIDTIME SELECT * FROM <table> WHERE ValidStart > CURRENT_TIMESTAMP; for a key with no other row, start them now. |
registry_orphan |
info | A TimeManager is in the manager registry but its table of dates is gone and no process uses it (a test leftover); a domain clock of data domains that have no process counts as unused. The finding names tdfs4ds.utils.manager_registry.unregister_view('<db>', '<view>') and, for such domains, tdfs4ds.data_domain_settings.detach_domain_time_manager('<domain>', dry_run=False). |
calendar_table_missing |
error | A TimeManager's table of dates is gone while a process, or the clock of a data domain that has processes, still reads it: their next run fails (Error 3807). |
documentation_low_confidence |
warning | A description a model generated has no documented input, or is built on a low-confidence object (rule: an object is never more confident than its least confident documented input; a person's text is high and stops it). Document the sources, then tdfs4ds.rebuild_documentation(objects=[...], force_update=True). |
documentation_can_be_improved |
info | An input of a generated description is better documented than when the text was written. Nothing is rewritten by itself: run the call named in the finding. |
documentation_confidence_not_recorded |
info | Generated descriptions written before confidence was recorded: unknown, not high. tdfs4ds.assess_documentation_confidence() previews a level computed from the current documentation of the inputs; dry_run=False stores it as assessed after the fact. |
clock_behind |
warning | Business dates are due by now (rule and due delay) and not in the clock's table, or a process is behind the clock. tdfs4ds.domain_clock_status('<DATA_DOMAIN>') lists them; tdfs4ds.refresh_domain('<DATA_DOMAIN>', until='now') adds and rolls them out (a large backlog needs catch_up=, see fs-rollout). |
calendar_gap |
info | Dates a catch_up='latest' refresh skipped on purpose (setting CALENDAR_GAPS). Nothing to fix unless they must be computed: roll them out from the first gap. |
The clock check also inspects the calendar of every TimeManager, and the cheap check windows the SQL of the processes:
| Finding | Severity | What to do |
|---|---|---|
calendar_rule_inferable |
info | No rule is stored but the dates follow one. tm.set_calendar(<the rule in the finding>) enables extend, refresh_domain(until='now'), enable_previous and change_calendar. |
calendar_irregular |
info | No rule stored, none can be inferred. Attach one with tm.set_calendar(tdfs4ds.Calendar....) or keep add_time_steps. |
calendar_off_rule_dates |
warning | Dates that do not fit the stored rule: a half-finished change_calendar (call it again with the same calendar), or dates added by hand. |
hand_written_window |
info | A window written by hand from the TimeManager value (ADD_MONTHS, INTERVAL). It does not follow a change of frequency: read <clock>_PREVIOUS (clock.enable_previous(), see fs-rollout). |
window_mismatch_calendar |
warning | The hand-written window spans a different step than the calendar: windows overlap or leave gaps. Same fix, or declare the length you mean: upload_features(..., window_length='31 days') / set_process_options(pid, window_length='31 days'). A window equal to the declaration is info ("declared"); a window that differs from the declaration stays a warning. |
fixed_window_bound |
info | A literal lower bound: the window grows with the clock. Keep it if a cumulative read is meant, else the previous view. |
Before changing the frequency of a clock, run tdfs4ds.sanity_check('windows.html') # the cheap scope includes the windows check.
After a replay¶
After rebuilding a history (roll_out(data_domain=..., time_id_start=1, force_compute=True) or roll_out([...], ...)), run the cheap checks on the processes just replayed:
Look at, in this order:
| Look at | Check or finding | Good result |
|---|---|---|
| One COMPLETED follow-up row per process and date | tdfs4ds.completed_dates(pids); the segments check |
no missing date, no FAILED segment |
| Empty dates | COMPLETED,0 rows in completed_dates (column EMPTY) |
none, or each one explained |
| Dates in order | order check (date_order_findings) |
no process computed before its upstream, none ahead of it |
| No validity gap | validity_gap_without_flag in usage; it reads storage, so use scope='full' or process_usage_for(pid, closed=True) |
none: a run leaves no gap |
| Absent entities | closed_entities, when close_absent_entities=True |
no entity closed without the flag; the closed ones are the expected ones |
| The domain roll-out | rollout_refused, manager_shared_across_domains |
absent |
Fix the first finding of each process before the next replay: a replay rewrites every date from the first one.
Accept an expected finding¶
A finding that is correct but expected (base tables behind an access layer of views, an empty first month) stays in the summary at every run. An administrator accepts it with a justification; it then leaves the counts and the verdict and is listed under Accepted, and it comes back when its details, dates or object change or the acceptance expires:
model = tdfs4ds.assess_workflow(display=False)
finding = model['findings'][0]
tdfs4ds.accept_finding(finding=finding, justification='...', until='2027-01-31', dry_run=True) # the statement
tdfs4ds.list_accepted_findings()
# tdfs4ds.revoke_finding(key)
Since 0.3.8.1 the acceptance records the severity the finding had (in the AREA column, nothing altered). The Accepted section shows each accepted finding at its current severity: "accepted when it was warning; it is now info: this acceptance is no longer needed" (an acceptance recorded before 0.3.8.1, or by check and object alone, of a finding that is now info says the same: info is in no count). A finding that became more severe than when it was accepted is open again ("re-opened: more severe"). Nothing stored is rewritten.
A justification is required. plan_migration lists the source store's acceptances and does not copy them.
Before a migration¶
plan_migration(seeds, source, sanity='cheap') runs the same checks on the source store and shows them first in the report. They never block migrate_objects: a process that is not refreshable carries its problem to production, so fix it in the source first.
In the app¶
Operations → Workflow assessment runs the checks and downloads the report. The process card in Feature catalog shows the refresh verdict. The (?) button shows the matching script.
Full guide¶
Documentation: Design & operate → Assess workflow health.