@cc [owner:Yassimba,test:test_freshness_decision_table_over_window_ends_measures_at_window_end] freshness.measured-at-window-end
Applies only to `checktypes/freshness.sql`.

Freshness measures the age of the newest event time at the exclusive end of the Check Window.
A run without an upper bound measures at the current time of the Datasource.

@cc [owner:Yassimba,test:test_freshness_external_contract_on_duckdb_counts_fractional_hours] freshness.fractional-hours
Applies only to `checktypes/freshness.sql`.

Freshness gives the age in hours with its fraction, never rounded to whole hours, so a
30 minute promise (`mustBeLessThan: 0.5`) fails at 31 minutes.

@cc [owner:Yassimba,test:test_duplicate_value_key_decision_table_on_duckdb] duplicate-value.key-precedence
Applies only to `checktypes/duplicate-value.sql`.

The key is `columns`, then the column of the check, then the primary key columns in
declaration order. With no key, planning refuses the check. A row with a NULL in any key
column is not counted and not flagged.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.set-dimension
Applies only to `derivations/`.

Each built-in Derivation Rule sets `dimension` on its check, so an Organization Policy that
requires a dimension (Enexis) accepts the check.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.primary-key-one-check
Applies only to `derivations/contract.py`.

A Dataset with a primary key gets one `duplicate-value` check over all key columns together,
not one check for each key column. A composite key repeats only when the full combination
repeats.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.options-one-check
Applies only to `derivations/contract.py`.

A Column with an `enum` or with `logicalTypeOptions` gets one `invalid-values` check that
carries all its limits together. A Column where no limit maps to an argument gets no check.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.options-known-format
Applies only to `derivations/contract.py`.

The rule gives `validFormat` only for a format name that `invalid-values.sql` knows (`email`,
`uuid`). It never passes another `format` text, because the Check Type reads an unknown name
as a regular expression.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.options-exclusive-bound
Applies only to `derivations/contract.py`.

A value equal to `exclusiveMinimum` or `exclusiveMaximum` fails the check. A value equal to
`minimum` or `maximum` passes it.

@cc [owner:Yassimba,test:test_ref_decision_table_at_render_seam_refuses_a_bare_name_that_is_no_dataset] sql-ref.bare-name-is-a-dataset
Applies only to `reference` in `sql/values.py`.

A name without a schema gives the table of a Dataset of the same Data Product. When no Dataset
has the name, `reference` raises CheckPlanningError; the name never becomes a table in the SQL
text. A name with a schema that matches no Dataset is a table outside the Data Product and
stays as written. A name with a catalog before the schema is always a table outside the Data
Product. A name with no schema that selects more than one Dataset raises CheckPlanningError.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.foreign-key-own-type
Applies only to `derivations/contract.py`.

A relationship gives a `foreign-key` check, never an `invalid-values` check, so an authored
`invalid-values` check on the same column does not replace it. A key of one column goes under
that column; a key of more than one column has no column.

@cc [owner:Yassimba,test:test_foreign_key_scenario_on_duckdb_counts_the_keys_with_no_referenced_row] foreign-key.null-key-not-counted
Applies only to `checktypes/foreign-key.sql`.

A row with NULL in a key column is not counted. A referenced row with NULL in a referenced
column matches no key and does not make another row pass.

@cc [owner:Yassimba,test:test_absent_argument_decision_table_at_render_seam_is_false_and_renders_null] sql-body.declared-arguments-in-context
Applies only to `render_template` in `sql/render.py`.

Each declared argument of the Check Type is a name in the render context, also when the check
does not set it. An argument with no value is false in `{% if %}` and renders as NULL.

@cc [owner:Yassimba,test:test_reserved_name_decision_table_at_sql_parse_seam_refuses_the_argument] sql-body.reserved-names
Applies only to `SqlBody.parse` in `sql/body.py`.

A front-matter argument with the name of a body binding raises CheckTypeError. A body binding
is never an argument read.

@cc [owner:Yassimba,test:test_argument_read_decision_table_at_sql_parse_seam_takes_only_loaded_names] sql-body.reads-are-loaded-names
Applies only to `argument_reads` in `sql/render.py`.

An argument read is a name that the body loads and does not set. A name from `{% set %}`, a
loop variable, and a Jinja global are not argument reads.

@cc [owner:Yassimba,test:test_body_lint_decision_table_at_sql_engine_seam_reports_only_a_parse_refusal] sql-body.lint-uses-planning-parser
Applies only to `body_refusal` in `sql/body.py`.

The body check parses the rendered text with `parse_and_validate` and `parse_failing_row`, the
functions that Check Run planning calls. It has no SQL parse of its own.

@cc [owner:Yassimba,test:test_body_lint_decision_table_at_sql_engine_seam_reports_only_a_parse_refusal] sql-body.lint-reports-parse-only
Applies only to `body_refusal` in `sql/body.py`.

The body check gives only a refusal of the SQL parse of the rendered text. A refusal of the
render gives no finding, because a placeholder value can be wrong for a correct body.

@cc [owner:Yassimba,test:test_earlier_rows_decision_table_at_sql_body_seam] sql-body.earlier-rows-needs-lookback
Applies only to `SqlBody.parse` in `sql/body.py`.

A SQL body reads `earlier_rows` only when its front matter has `lookback: true`, and a front
matter with `lookback: true` has a body that reads `earlier_rows`. Each other pair is refused
with what to write.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.schedule-in-definition
Applies only to `derivations/sla.py`.

A schedule promise gives a `refresh-delay` check that holds the cron text. The threshold never
holds a time computed from the clock.

@cc [owner:Yassimba,test:test_refresh_delay_decision_table_at_render_seam_takes_the_firing_before_the_window_end] refresh-delay.firing-before-window-end
Applies only to `checktypes/refresh-delay.sql` and `_previous_firing` in `sql/render.py`.

The firing is the last one before the exclusive end of the Check Window, in the time zone of
the schedule. A run without an upper bound uses the current time.

@cc [owner:Yassimba,test:test_age_check_types_external_contract_on_duckdb_measure_at_the_window_end] oldest-row-age.measured-at-window-end
Applies only to `checktypes/oldest-row-age.sql`.

The age of the oldest value is measured at the exclusive end of the Check Window. A run
without an upper bound measures at the current time of the Datasource.

@cc [owner:Yassimba,test:test_sla_promises_scenario_on_duckdb_measures_each_rule_at_the_window_end] oldest-row-age.reads-full-table
Applies only to `checktypes/oldest-row-age.sql`.

The oldest value is that of each row before the end of the Check Window, also in a run with a
lower bound. The start of the Check Window never hides an older row.

@cc [owner:Yassimba,test:test_built_in_rule_decision_table_at_rule_seam_gives_the_check] built-in-rules.deadline-is-before
Applies only to `time_of_availability` in `derivations/sla.py`.

A row that arrived before the daily deadline keeps the promise of that day. The check fails
only when no row arrived after the deadline of the day before.

@cc [owner:Yassimba,test:test_quality_spec_event_time_external_contract_at_codec_seam_round_trips] quality-spec.event-time-is-the-mark
Applies only to `formats/quality_spec/model.py` and `formats/odcs/schema.py`.

The tag `event-time` on a Quality Spec column and on a Data Contract column sets the same field,
`Column.event_time`. No Dataset key and no custom property names the event time.

@cc [owner:Yassimba,test:test_odcs_status_external_contract_has_the_marketplace_values_and_their_limits] odcs-status.matches-marketplace
Applies only to `OdcsContractStatus` in `formats/odcs/metadata.py`.

Its values are exactly `proposed`, `draft`, `active`, `deprecated`, and `archived`, the values of
the `mp.status` type of the PAX Marketplace.
