Skip to content

fix(views): list repeating project templates, hide them from things projects - #170

Merged
ryanlewis merged 1 commit into
mainfrom
fix/repeating-project-templates
Sep 5, 2026
Merged

ryanlewis merged 1 commit into
mainfrom
fix/repeating-project-templates

Conversation

@ryanlewis

Copy link
Copy Markdown
Owner

What changed

A project repeats the same way a to-do does: a template row carrying the recurrence rule, plus the projects it generates. The repeating view added in #147 pinned t.type = 0, so a project template appeared nowhere at all, while ListProjects had no template exclusion and listed it in things projects as an ordinary project.

  • repeating is now the one view not pinned to t.type = 0 — it takes types 0 and 1, matching the app's Repeating list, which shows both kinds. Headings cannot reach it: they carry no recurrence rule, and type 2 is outside the set (there is a test for this, since dropping the type pin removes the guard that used to be implicit).
  • ListProjects excludes rows carrying a recurrence rule, through the same probed column reference the views use, so a schema without that column degrades to a no-op.
  • The view orders by type before index, keeping to-dos and projects in contiguous blocks rather than interleaving them by an index that is only meaningful within a kind.

Marking projects in output

Plain output marks a project row (project), and the detail view prints a Type: project line, so a project template is not left reading as a to-do. Both are text rather than colour, so they survive --color never and a pipe. JSON already carried "type": 1. This also covers things search, which could already return an unmarked project. To-do output is unchanged in both cases.

Search

things search deliberately stays a raw lookup: it searches the database as it stands and returns templates like anything else, so a title visible in the Things app is always findable. Results carry "repeating": true and things show prints a Repeats: line, so a template is identifiable when one comes back. The docs said templates were kept out of every view but search; that wording is now fixed rather than the behaviour.

How tested

  • make test (race) and make lint — both green.
  • New tests: project templates appear in repeating ordered after to-do templates and carry Type/Repeating; headings stay out; ListProjects excludes templates with and without --completed and leaves ordinary projects untouched; ListProjects still works on a schema with no recurrence column; and the two output markers, each asserting to-do output is unchanged.
  • I confirmed each new test fails without its fix by reverting the three changes in turn.
  • Checked against a read-only copy of the real Things database: it holds no repeating projects, so nothing shifts there — 12 projects and 2 to-do templates, both unchanged.

Left out

The to-dos inside a template project have no guard: they carry no recurrence rule themselves, so they still list in anytime/someday/upcoming with a projectTitle pointing at a project things projects no longer reports. Same class as #147 and #155. I have not fixed it here because I cannot confirm the row layout — this machine's database has no repeating projects — and a wrong guard would hide real to-dos. It also needs an alias-parameterised recurrence helper, since the current one only emits the t alias. Worth its own issue, checked against a database that actually has a repeating project.

Closes #165

…rojects

A project repeats the same way a to-do does: a template row carrying the
recurrence rule, plus the projects it generates. The repeating view added in
#147 pinned t.type = 0, so a project template appeared nowhere, while
ListProjects had no template exclusion and listed it in `things projects` as
an ordinary project.

The repeating view is now the one view not pinned to t.type = 0 — it takes
types 0 and 1, matching the app's Repeating list, which shows both kinds —
and ListProjects excludes rows carrying a recurrence rule. Headings cannot
reach the view: they carry no rule, and type 2 is outside the set.

Ordering the view by type before index keeps to-dos and projects in
contiguous blocks rather than interleaving them by an index that is only
meaningful within a kind.

Plain output marks a project row "(project)" and the detail view prints a
"Type: project" line, so a project template is not left reading as a to-do.
Both are text rather than colour, so they survive --color never and a pipe.
This also covers `things search`, which could already return an unmarked
project.

The docs gain the project-template behaviour, correct the claim that trash
and logbook can hold a template of either kind (both are to-do lists), and
say plainly that search is a lookup rather than a view: it returns templates
like anything else, carrying "repeating": true so a caller can tell.

Closes #165
@ryanlewis
ryanlewis merged commit d264da4 into main Sep 5, 2026
7 checks passed
@ryanlewis
ryanlewis deleted the fix/repeating-project-templates branch September 5, 2026 11:00
ryanlewis added a commit that referenced this pull request Sep 5, 2026
## What changed

A repeating project is a template row carrying the recurrence rule plus
the projects it generates. The template's own child to-dos carry no rule
— only their project does — so the template exclusion added in #147
could not see them, and they listed as ordinary tasks against a project
`things projects` no longer reports.

The guard tests the resolved parent through the existing `p` join. That
needs a recurrence reference for an alias other than `t`, so
`probeRepeating` now caches the bare column name and a small
`recurrenceRef(alias, column)` builds the reference from it —
`recurrenceColFor` can serve any alias, and `probeRepeating` can still
build its own without re-entering the `sync.Once`. The `repeatSQL` field
goes away; there is now one place that knows how the reference is
spelled.

It runs for the same views that exclude templates, so `trash` and
`logbook` keep reporting what the database holds. Because `p` resolves
through `COALESCE(t.project, h.project)`, a to-do nested under a heading
in a template project is covered too.

## Verification status — please read before merging

**This is not verified against a real repeating project.** This
machine's Things database has none, so the tests assert the modelled row
layout rather than an observed one.

What *is* observed, from the checkpointed daily backups of the real
database: for repeating **to-dos**, Things keeps the rule-bearing row as
a blueprint (2 rows with `rt1_recurrenceRule`, `rt1_repeatingTemplate`
NULL, `start = 2`, `instanceCreationPaused = 1`) and generates
**separate** instance rows (17 rows with `rt1_repeatingTemplate` set and
no rule of their own). The blueprint is the row the app files under
Repeating; the instances are what appear in Today. This guard assumes
projects follow the same shape, which is the same `rt1_*` column family
and the same mechanism.

The residual risk is that projects diverge from to-dos — that Things
regenerates children in place under the row holding the rule. If that
were so, this would hide every live to-do of every repeating project. I
judge that unlikely given the above, but it is the thing to weigh, and
it is why this says so here rather than in a comment.

## How tested

- `make test` (race) and `make lint` — both green.
- `TestTemplateProjectChildrenExcludedFromOpenViews` is table-driven
across all seven views the guard applies to (`inbox`, `today`,
`upcoming`, `anytime`, `someday`, `deadlines`, `project`). Each case
seeds a child of a template project *and* a sibling in an ordinary
project, so the assertion proves the guard discriminates rather than
hiding everything.
- `TestTemplateProjectChildrenExcludedThroughHeading` covers the
heading-nested path; `TestTrashAndLogbookKeepTemplateProjectChildren`
pins the two opt-out views; `TestRecurrenceColForAlias` covers the
helper for a non-`t` alias and the no-column fallback.
- I confirmed every exclusion case fails without the guard.
- Against a read-only copy of the real database, every view count is
byte-identical to before the change — there are no repeating projects
there, which is what a guard that cannot over-hide should do.

## Also here

`internal/skill/SKILL.md` had a sentence duplicated on main (my edit and
a review fix collided in #170); removed.

Closes #171
ryanlewis added a commit that referenced this pull request Sep 5, 2026
…st (#176)

Tidy of the bundled agent skill before v0.7.0. Six PRs edited
`internal/skill/SKILL.md` piecemeal since v0.6.0 (#150, #151/#166,
#157/#168, #160, #169, #170/#173, #172) and it had drifted into a pile
of overlapping notes.

## Audited against the CLI

Built the binary and checked every command and flag the skill mentions
against `./things --help` and each subcommand's `--help`, in both
directions. Both now come back clean: no flag in the help is missing
from the skill, and no flag named in the skill is absent from the CLI.

## What moved

Reordered so the first screen is what an agent needs before it acts:

| Before | After |
| --- | --- |
| Safety → Output → Config → Commands → Repeating → Confirming → Tags →
`--agent` → Refs → Values → Flows → Completions → Tips | Safety →
**Referring to an item** → Output and `--json` → **Writes: what Things
refuses or drops** (4 numbered rules) → Config → Command reference →
`--agent` → Values → Flows → Completions |

"Referring to an item" moved up from near the bottom — how refs and
UUIDs work is prerequisite to almost everything else, and the
index-cache trap (any `list` or `search` overwrites it, *including one
the agent runs itself*) was buried. The four scattered write-refusal
topics are now one section of numbered rules that the rest of the
document cross-references by number instead of restating.

## What was cut

- **Tips** — every bullet restated an earlier section. Kept its one
unique line, about when to reach for `open`.
- `--yes` and the project confirmation were stated in **four** places,
`--json` in **three**, repeating behaviour in **four**. Each is now in
one place.
- Comments in the command block that only restated `--help`.

Net **14% shorter** (19,107 → ~16,500 chars) while covering more
surface.

## What was stale or missing

- `open` was listed as a write that "modifies the user's real data". It
reveals an item in the app and pulls focus; it writes nothing.
- **Absent entirely**: the `skill` subcommands
(`list`/`show`/`install`/`uninstall`), `version`, `--db`, `--config`,
`$THINGS_CLI_CONFIG`, `--no-hints`.
- `--when ""` / `--deadline ""` clear a value on `edit`/`project edit`
(and only there) — undocumented.
- `tag add` prints its result on success, so the blanket "write commands
print nothing" was wrong for it; it is also covered by the `--no-verify`
read-back, which rule 1 did not mention.
- "Things3 must be running" applied only to `--create-tags`, but `tag
add` uses the same AppleScript path.

## One code change

`internal/output/agent.go` — a self-contradiction in the `--agent` brief
for a **repeating project**, from my #172: `closingOut` guarded the
to-do branch on `!t.Repeating` but not the project branch, so the brief
offered `things complete <uuid> --yes` / `cancel --yes` directly above a
note saying there were none — commands `checkRepeating` refuses anyway.
Guarded both branches, with a regression test
(`TestPrintAgentBriefRepeatingProject`; there was no test for a
repeating project brief).

This is outside a docs-only brief, and I flagged it rather than slipping
it in: it is here because the skill now documents the corrected
behaviour, so doc and code had to move together. The alternative was to
document the bug as if it were intended. Happy to split it out if
preferred.

## How tested

`make test` (`go test -race ./...`) and `make lint` (0 issues) pass;
`gofmt` clean. `internal/skill/skill_test.go` asserts the frontmatter
and a set of command references, all still present. Verified the
rendered install output via `things skill show claude`.

README's Agent skill section was checked and needs no change — its
subcommand table, flag table and the three default install paths all
match `internal/skill/{claude,codex,pi}.go`.
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.

bug: repeating project templates are missing from the repeating view and still listed in things projects

1 participant