ISSUE DESCRIPTION Stale-detection timestamp-field allowlist misses spec-declared date…
- User
ISSUE DESCRIPTION
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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call ) using or commands. However you don't need to use or before submitting your changes. In fact, only submits currently unstaged changes because it uses to get the changes that need to be submitted. - Positive: a spec with a
Assistant
Now let's find where these workflow templates are rendered with data, to see what data structure is passed and whether spec properties are accessible.
Assistant
Good,
sortis already imported. Now let's find a good place to add this function and register in FuncMap.Assistant
Now let's add the function registration and the helper function/data. I'll add after
hasNonScalarType.Assistant
Now let's add the helper function and the base allowlist map. Let's find
commandConstructorForTemplatelocation to add nearby, or a good standalone spot.Assistant
Now let's fix gofmt alignment for the map literal, then update the template.
Assistant
Now update the template file itself.
Assistant
Now let's check the template renders correctly. Let's build and run the existing generator tests related to pm_stale.
Assistant
Build succeeds. Now let's run the relevant tests.
Assistant
Now let's run the wider pm_stale related tests (grep earlier lines 12796, 12824, etc.) to confirm nothing broken.
Assistant
These use
minimalSpec(which likely has no Types with date-time). Let's run these tests to confirm generation still works.Assistant
Now let's build a reproduction script simulating a Trello-like spec with
dateLastActivitydate-time field and generate the pm_stale.go to verify the union works.Assistant
Now let's write a temporary Go test-like script (not added to repo) to render the pm_stale template with a spec having Types with a date-time field like Trello's dateLastActivity, and inspect the output.
Assistant
Need to place the script inside the module tree (internal package restriction). Let's put it under a temp directory within the repo, e.g.
/cli-printing-press/cmd/reprocheckbut that's a package addition — better to just write a _test.go file temporarily, run it, then remove before submit.Assistant
It works —
dateLastActivityis added. Now let's negative-test: an API usingupdated_atshould be unchanged (no duplicate).Assistant
No duplicate
updated_atline added — negative case confirmed unchanged. Now let's remove the temp test file and run the broader test suite.Assistant
Now run full test suite for generator package (and maybe others) to confirm nothing is broken.
Assistant
Confirmed this is a pre-existing failure unrelated to our change (environment go version vulnerability). Restore our changes.
Assistant
Good, that failure is pre-existing and environment-related (govulncheck flags an unrelated stdlib TLS vuln), not caused by our change. Let's run the full generator test suite excluding that known-failing test to confirm everything else passes.
Assistant
All other generator tests pass. Now let's run the full repo test suite (excluding that known failing govulncheck-dependent test) to be safe.
Assistant
All tests pass across the whole repo (aside from the pre-existing unrelated govulncheck environment issue). Let's do a final review of the diff.
Assistant
Only pm_stale.go.tmpl has this pattern, consistent with the issue scope. Let's do final gofmt check and full diff review.
Assistant
Good — no output means it's already properly formatted (empty output from gofmt -l = no files need formatting). Let's also verify the generated pm_stale.go from our repro compiles standalone by checking gofmt on rendered output (already done via generator, which runs go/format internally, and Generate() succeeded, confirming valid Go syntax).
Assistant
The working tree only has the intended two-file change, and the temporary repro test file was removed. Now let's go through the checklist.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.