Skip to content

docs(coding): add the absent values rule - #379

Merged
daniel-kindl merged 5 commits into
mainfrom
docs/368-absent-values
Nov 25, 2026
Merged

daniel-kindl merged 5 commits into
mainfrom
docs/368-absent-values

Conversation

@daniel-kindl

Copy link
Copy Markdown
Owner

Closes #368

Summary

coding/absent-values.md is the owner page for absent values (null, undefined, None). Before, only the review checklist named "empty and null input".

  • Turn on the null check of the language and run it in CI as an error.
  • Show in the type when a value can be absent. Use no special value such as -1 or "".
  • Convert input once at the boundary to a type that cannot be absent.
  • An absent value does not report a failure. An empty collection means "no items".
  • A non-null assertion needs a check that proves it.

The page links types.md (merged in #370), so this PR waited for it.

Evidence

  • Verified: test/absent-values.test.mjs came first and failed on all three tests. It pins the key phrases, the examples and the index link. npm run check passes with main merged in. check:title passes.
  • Unverified: none.
  • Known risk: none.
  • NOT RUN: actionlint, which runs only in validate.
  • Observability: none, docs only.

Risk and rollback

Low. A new page (MINOR). Revert the commit to roll back.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Review of PR #379

Verdict: CHANGES-REQUESTED
Head SHA: e539fd3

Reviewed: head e539fd3 (2 commits: 47c0ad8, merge of main). Issue #368. No subagents used; I ran each axis myself. Local run on Linux, Node 24, in a throwaway checkout (removed).

Evidence

  • npm run check in a clean checkout of the head: exit 0, 1012 tests pass, 0 fail. Level 4, Run, on Linux only.
  • Claims checked at the source: "strict": true and <Nullable>enable</Nullable> are in the Enforcement table of coding/types.md (lines 54 and 56). strictNullChecks is part of strict in TypeScript (level 2, Documented; I did not run tsc). Optional[User] (Python typing) and Option<User> (Rust) are real optional types. The two links fail-fast.md and design-by-contract.md exist.
  • Mutation test, 6 mutations of the page: removing the special-value rule, the boundary rule, the empty-collection rule or the non-null rule each makes the test fail. Two mutations survive: H1 and M1 below.

Specification axis

All 7 acceptance criteria are met by the page, the index line and the CHANGELOG line (CHANGELOG.md has one line for #368).

  • Null check on and values present by default: coding/absent-values.md:10.
  • Type shows absence, no special value: coding/absent-values.md:14 and :16.
  • Parse once at the boundary: coding/absent-values.md:19.
  • Absent is not failure, empty collection is "no items": coding/absent-values.md:22 and :25.
  • Non-null assertion needs a proof: coding/absent-values.md:27.
  • Good and bad example: coding/absent-values.md:30 and :36.

No findings on this axis.

Standards axis

The page agrees with coding/error-handling.md (special values, line 10) and coding/types.md (non-null assertion rule, which it repeats without contradiction). The good and bad examples follow the rules: the good one returns User | undefined, throws on database failure and checks once at the boundary. The bad one breaks the failure and boundary rules. Title and body follow the PR rules. Evidence and Observability lines are present.

  • H1, test/absent-values.test.mjs:13, open. The test is weak, so a rule can be reversed without a failure. I changed "Do not use a special value" to "Use a special value" and all 3 tests still passed. The phrase list pins only fragments such as "special value" and "-1". Rule: tdd tests must prove behavior. Fix: pin the full rule sentences, for example "Do not use a special value for".
  • M1, test/absent-values.test.mjs:32, open. The example test checks only the two headings. I emptied both sections and the test still passed. Fix: check that each section has text, or pin findUser in both.

Blast radius

New page, one index line, one CHANGELOG line. No script, skill or consumer file changes. No breaking change. MINOR as the PR says.

Verdict

CHANGES-REQUESTED at head e539fd3. The page is correct and meets all 7 criteria. H1 and M1 are test strength gaps (the issue asks that the test pins the key phrases) and must be fixed before merge. Merge is for an independent reviewer or the owner, not the author.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #379

Verdict: APPROVE-RECOMMENDED
Head SHA: 3923f2b

Delta checked from earlier head e539fd3: coding/ is unchanged. Only test/absent-values.test.mjs changed, plus a merge of main.

  • H1, test/absent-values.test.mjs:13: fixed. The test pins full rule sentences. Inverting "Do not use a special value" now fails.
  • M1, test/absent-values.test.mjs:32: fixed. Each example section must have more than 80 characters, and the good example keeps its signature. An emptied good or bad section now fails.

Evidence: I re-ran my six page mutations and two more (empty bad example, inverted failure rule). All 8 fail the new tests. npm run check in a clean checkout of the head passes: 1013 tests, 0 fail (level 4, Run, Linux, Node 24). No new findings. The merge decision stays with an independent reviewer or the owner.

@daniel-kindl

Copy link
Copy Markdown
Owner Author

Re-review of PR #379

Verdict: APPROVE-RECOMMENDED
Head SHA: eb1ecbf

Delta checked from earlier head 3923f2b: only files that come from main changed (feature-flags, immutability, time, quality, tips and their tests). Against origin/main, the diff is the 4 files of this PR. coding/index.md keeps all 15 entries from main and adds one for absent-values.md. validate passes on this head and GitHub shows the merge state CLEAN. No new findings.

@daniel-kindl
daniel-kindl merged commit e88e719 into main Nov 25, 2026
1 check passed
@daniel-kindl
daniel-kindl deleted the docs/368-absent-values branch November 25, 2026 16:34
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.

docs(coding): add the absent values rule

1 participant