Stale-detection timestamp-field allowlist misses spec-declared date fields Retro finding…
- User
Stale-detection timestamp-field allowlist misses spec-declared date fields Retro finding · priority: P2 · component: generator · source: Trello CLI generation (printing-press 4.9.0)
What happened
The generated
internal/cli/pm_stale.gomatches inactivity against a hardcodedstaleTimestampFieldsallowlist (updatedAt, updated_at, updatedDate, modifiedAt, modified_at, lastModified, last_modified, lastEditedTime, last_edited_time, updated, last_updated). Trello cards usedateLastActivity, which is absent. The flagshipstalecommand returned "No stale items found" while a hand-builthealthcommand (readingdateLastActivity) counted 93 stale cards on the same hydrated data. Silent-empty flagship command, no error.Root cause
The stale template hardcodes a timestamp-name allowlist instead of also deriving candidate timestamp fields from the spec (properties with
format: date-time).Durable fix (proposed)
Build the stale timestamp-field set as
hardcoded allowlist ∪ spec-declared date-time property names for the synced resources. Guard: union is additive only — never removes existing allowlist entries, so no regression for currently-working APIs.Test
- Positive: a spec with a
dateLastActivity(format: date-time) card property produces astalethat finds rows older than N days. - Negative: an API using
updated_atis unchanged.
Repro / evidence
trello-pp-cli stale --days 14→ empty;trello-pp-cli health→ 93 stale on the same mirror. Fixed by hand-addingdateLastActivityto the allowlist. The allowlist approach will keep silently breaking the flagship command for the next API with an unlisted activity field.Interface
No new interfaces are introduced.
- Positive: a spec with a
- Assistant
Now wire the derived fields into the workflow-template render data in
generator.go: - Assistant
Now the template — union block plus updated doc comment:
- Assistant
Now the tests:
- Assistant
All new tests pass. Now the full suite, formatting, and golden verification:
- Assistant
The environment is hitting process limits with parallel compilation. Retrying with limited parallelism:
- Assistant
Pre-existing failure confirmed (fails on clean tree — the sandbox's Go stdlib version trips govulncheck). Now golden verification, required since a template changed:
- Assistant
16 cases failing is suspicious — my change shouldn't touch any golden case. Let me inspect a diff and check the clean-tree baseline:
- Assistant
All golden diff lines are exclusively the
mvanhorn<REPO>normalization artifact — zero real changes. The built binary isn't ignored though; let me check: - Assistant
No dependent skills/docs. Final full run of the affected package:
- Assistant
Everything passes except
TestGenerateWithNoAuth, which I confirmed fails identically on the clean tree (a govulncheck stdlib finding from this sandbox's Go toolchain — unrelated to this change). The work is complete.Summary
Fixed the P2 retro finding:
stalesilently returned empty when an API's activity timestamp (e.g. Trello'sdateLastActivity) wasn't in the hardcoded allowlist. The stale field set is nowhardcoded allowlist ∪ spec-declared date/date-time modification fields, built at generation time — a machine change, so every future printed CLI gets it.Changes:
internal/generator/stale_fields.go(new) —specStaleTimestampFields()walks each resource's (and sub-resource's) spec-declared response types via the existingcollectResponseFields, and keeps fields that are:format: date-timeordate;- named like a modification/activity timestamp (stems:
update,modif,activity,edited,changed,touched) — this filter is essential because the staleWHEREORs across fields, so unioningcreatedAt/dueDate/startDatewould flag actively-updated rows as stale and regress currently-working APIs (suffixed stems chosen to excludeactivatedAt,exchangeRateDate); - safe to embed in both a Go string literal and a
json_extract('$.<name>')path (^[A-Za-z_][A-Za-z0-9_]*$); - not already in the hardcoded allowlist (Go-side mirror
staleTemplateHardcodedFields, pinned to the template by a drift test).
templates/workflows/pm_stale.go.tmpl— appends{{range .SpecStaleTimestampFields}}after the hardcoded literals. Additive-only per the retro guard: existing entries are never removed, ordering keeps first-present-wins stable, and anupdated_at-shaped API emits byte-identical output.generator.gorenderWorkflowFiles— workflow templates now receive{*spec.APISpec, SpecStaleTimestampFields}; embedding keepspm_orphans/pm_load/comm_healthuntouched.stale_fields_test.go(new) — covers the retro's test spec: positive (dateLastActivityderived and emitted in generatedpm_stale.go), negative (updated_atAPI emits exactly the hardcoded list), plus creation-field exclusion, no-format exclusion, unsafe-name exclusion, sub-resource walking, and the template↔Go allowlist drift pin.
Verification: new + existing stale tests pass (including
TestStaleTemplateCoversCommonTimestampFields, unmodified);go vet/gofmtclean; fullgo test ./...green except pre-existing failures I confirmed on the clean tree (govulncheck stdlib finding; some parallel-run flakes from this sandbox's process limits that pass in isolation).scripts/golden.sh verifyshows only a pre-existing environmental artifact — this checkout lives at/cli-printing-press, so the harness's<REPO>path normalizer mangles the literalgithub.com/mvanhorn/cli-printing-pressURL; identical 16-case result on the clean tree, zero diffs attributable to this change. No new golden fixture: no golden case exercises the vision-plan-selected PM workflow templates (verified — no fixture containsstaleTimestampFields), and the behavior contract is pinned by the package's unit tests, matching existing precedent. golangci-lint isn't installed in this environment, so that gate will run in CI/pre-push.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →