Skip to content

feat(platform): state the task rules in a spec that tests hold - #4351

Merged
larryro merged 1 commit into
mainfrom
feat/domain-spec-contracts
Oct 5, 2026
Merged

larryro merged 1 commit into
mainfrom
feat/domain-spec-contracts

Conversation

@larryro

@larryro larryro commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The rules a backend domain keeps lived in its code and tests alone: of 58 domains only governance had a written contract, and the manual suites, the user docs and the REST contract share no identifier. This adds one checked format for those rules and trials it on tasks.

  • A domain spec (backend/domains/<domain>/spec.md, shape in spec-template.md) states the rules for a reader who has not opened the code. It takes the prefix of the feature's manual suite (TASK-R4 beside TASK-F63), groups its rules under topic headings, and gives each rule one card: a heading that is the rule as one plain sentence, a short body, and an example with a named person.
  • A spec carries rules only: no status and no list of tests. Whether a rule is the intended one is settled in the review of the change that adds it. A question nobody has decided goes under Not yet, not into a rule.
  • The test that holds a rule names it in its title (it('… [TASK-R4]', …), or the describe when the whole block does).
  • The guard (tests/guards/domain-specs.guard.test.ts) parses every spec and the titles of the workspace's tests. It fails on a shape it does not know, a rule without an example, a rule no running test names, and a title that names a rule no spec states. A skipped test holds nothing.

tasks/spec.md is the first spec: 13 rules on who may create, change and delete a task, archived tasks and projects, size limits, automated agent starts and deletion.

What else changes:

  • 26 existing test and describe titles under backend/core/tasks and backend/domains/tasks gain their rule's ID. No assertion changes.
  • One new test: the 50-attachment cap (TASK-R11) had none.
  • .agents/repo.md and backend/README.md document the format.

Two things for the reviewer:

  • One question is left undecided under Not yet. A task that holds a description over 20,000 from an old import: the server accepts a change to its title alone (updateTask validates a description only when the request sends one), while the user docs say Save stays unavailable until the description is shortened. One of the two is the intended rule.
  • The spec covers part of the domain. Agent runs, reviews, repeating tasks and the importers are listed under Not yet. The guard reads vitest and Playwright titles only, so a rule that only an integration lane proves cannot be tagged yet.

Checklist

  • bun run check passes (format, lint, typecheck, all tests): on CI, where Format, Lint, Type check, Unit (both platform shards executed, not replayed), UI, Browser, Knip and Backend integration are green on ba0d3124a. Not run in full locally; run there on the rebased branch: the new guard, turbo-inputs.guard and the 11 tagged test files (191 tests), platform typecheck, oxlint --type-aware and oxfmt --check on every changed file, lint:manual, lint:links, lint:conflicts.
  • bun run lint:sast passes (Opengrep): 476 rules, 0 findings.
  • Translations: N/A, no user-visible string.
  • Docs: N/A for the user docs, no user-visible change. The contributor docs (.agents/repo.md, backend/README.md) are updated.
  • README.md / README.de.md / README.fr.md: N/A.

Test plan

  • bun run --filter @tale/platform test -- tests/guards/domain-specs.guard.test.ts passes.
  • Remove [TASK-R13] from the describe in backend/domains/tasks/retire.test.ts and run the guard: it fails with TASK-R13 is held by no test.
  • Add [TASK-R99] to any test title and run the guard: it fails with the title names TASK-R99, which no spec states.
  • Change it( to it.skip( on the [TASK-R11] test in service.attachments.test.ts: the guard fails with TASK-R11 is held by no test.
  • Loosen the check in normalizeAttachments (service.ts) to > TASK_ATTACHMENTS_MAX + 1: the new [TASK-R11] test fails.

All four were observed locally and reverted.

The rules a backend domain keeps lived in its code and tests alone: of
58 domains only governance had a written contract, and the manual
suites, the user docs and the REST contract share no identifier.

A domain spec (backend/domains/<domain>/spec.md) states those rules for
a reader who has not opened the code. It takes the prefix of the
feature's manual suite, groups its rules under topic headings, and
gives each rule one card: a heading that is the rule as one plain
sentence, a short body, and an example with a named person. A spec
carries no status and no list of tests. A question nobody has decided
goes under Not yet instead of becoming a rule.

The test that holds a rule names it in its title ([TASK-R4]).
tests/guards/domain-specs.guard.test.ts parses every spec and the
titles of the workspace's tests, and fails on a shape it does not know,
a rule without an example, a rule no running test names, and a title
that names a rule no spec states.

tasks is the first spec: 13 rules on who may create, change and delete
a task, archived tasks and projects, size limits, automated agent
starts and deletion. 26 existing test and describe titles gain their
rule's ID. The 50-attachment cap had no test; one is added.
@larryro
larryro merged commit 2ca379b into main Oct 5, 2026
@larryro
larryro deleted the feat/domain-spec-contracts branch October 5, 2026 12:35
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.

1 participant