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
I'll explore the repository structure and locate the stale-detection timestamp allowlist logic.
- Assistant
Let me look at the stale template and how timestamp fields are determined.
- Assistant
Let me search for how the stale template is used and how other templates handle date-time fields from specs.
- Assistant
I'll use proper grep syntax for this search.
- Assistant
Let me look at how generator.go handles the pm_stale template rendering, and the related tests.
- Assistant
I need to see how workflow templates get their data and how the generator injects context into them.
- Assistant
Workflows are rendered with
g.Spec. Next I'll inspect Resource field shapes and nearby template-data patterns. - Assistant
Let me look at Resource structure and Types/TypeField, and how breakable fields are discovered from specs.
- Assistant
There's a
collectResponseFieldshelper — I'll inspect it and how date-time fields are identified. - Assistant
I'll check AGENTS.md and similar template-data patterns for injecting extra fields.
- Assistant
Next I'll examine related helpers and how generated golden outputs currently look.
- Assistant
I'll inspect the template FuncMap and how extra data is passed into templates.
- Assistant
I'll inspect the profiler syncable resource structure and how the generator accesses it during workflow rendering.
- Assistant
I'll check recent commits and whether similar work already exists.
- Assistant
Checking the previous timestamp-field expansion for context on the current structure:
- Assistant
Checking which template fields the other workflow templates reference:
- Assistant
I'll check retro notes and related docs for more detail on the intended approach.
- Assistant
Checking DependentResource structure and how resource names map onto the Resources map:
- Assistant
Confirming when the profile is available relative to workflow rendering:
- Assistant
I'll check how subresource naming works so we can map dependent resources correctly.
- Assistant
Let me read SubResourceShardedNames
- Assistant
I'll check what minimalSpec looks like and whether workflow generation could be affected:
- Assistant
Hmm empty output? Maybe it's in a different file.
- Assistant
Let me read minimalSpec
- Assistant
Implementing the allowlist ∪ spec date-time fields fix.
- Assistant
Now write the content of the file.
- Assistant
I'll simplify the walk logic to handle a single level of subresources.
- Assistant
I'll open the file and apply the replacement with exact content.
- Assistant
Let me replace lines 106-147 with simplified version.
- Assistant
I'll verify that
spec.ToSnakeCaseis exported. - Assistant
Updating the template to append spec-declared date-time fields, then wiring the render path.
- Assistant
Update the comment and the list to include range of ExtraStaleTimestampFields.
- Assistant
Updating the workflow render path to pass the extra timestamp fields.
- Assistant
I'll update the loop to pass special data for all workflows - wrapping APISpec with ExtraStaleTimestampFields so both pm_stale and others work (orphans/load only need .Name and .Owner).
- Assistant
There's another workflow render path around line 1897 — I'll check it as well.
- Assistant
Writing a temporary verification script to reproduce and confirm the fix.
- Assistant
Need to set GOPATH and module cache environment variables.
- Assistant
Can't import internal from outside — I'll put a temporary test inside the generator package instead.
- Assistant
The unit tests passed. Running an end-to-end stale-detection check and the existing related tests next.
- Assistant
Checking which SQLite driver the module already uses.
- Assistant
I'll run the existing stale-related tests and clean up the temporary test file.
- Assistant
Verifying cleanup and confirming the package builds cleanly.
- Assistant
.gocacheis polluting the diff — I'll restore it and keep only our source changes. - Assistant
Cleaning untracked cache files and verifying our intentional changes.
- Assistant
Submit only picks up
git diffon tracked files, so I'll move the new helper into an existing file. - Assistant
I'll move the logic into schema_builder.go and remove the separate untracked file.
- Assistant
I'll add profiler import and append the functions at the end of schema_builder.go, then delete the other file.
- Assistant
I'll append the content from stale_timestamp_fields.go to the end of schema_builder.go
- Assistant
Verifying final state and running the related existing tests one last time.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.