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
Let me start by exploring the repository structure to understand the
Assistant
Let me explore the structure more thoroughly.
Assistant
Now let me look at how the generator works to understand the relationship between spec properties and templates.
Assistant
Let me look at the test file related to this to understand the tests.
Assistant
let me understand the Spec data model and the resources model.
Assistant
Now let me see how the OpenAPI specs are processed and how
format: date-timeproperties would be discovered.Assistant
Let me look at how the spec stores properties with format: date-time.
Assistant
Let me look at the response schema parsing to understand how response schemas (which contain properties) are stored.
Assistant
Now let me look at how the
typesdata are populated from the OpenAPI spec.Assistant
let me look at how
spec.Typesis consumed and how we can extract fields with formatdate-timefrom the spec.Assistant
me look at how resources are linked to types in the spec.
Assistant
Now let me look at the vision_templates.go for understanding the templates context.
Assistant
me look at the renderTemplate function and how the data is passed to the pm_stale template.
Assistant
Let me look at how the template data is passed.
Assistant
Let me write a quick test to understand the structure better.
Assistant
Let me now look at the
NewandGeneratefunctions:Assistant
Now let me look at the renderWorkflowFiles in detail to understand the template data:
Assistant
Let me look at how synced resources are determined:
Assistant
Let me trace the
g.funcsdefinition more carefully:Assistant
Let me look at the openapi parser test for date-time format:
Assistant
Now let me run the existing tests to see they pass first:
Assistant
Now I have a good understanding. Let me check the agent_context_test.go to see if there are existing patterns for testing:
Assistant
Let me look at
templateData:Assistant
Now I have a clear plan. Let me implement the fix. First, let me create a helper function in the generator package:
Assistant
Let me create a new file for the stale timestamp fields helper. I'll call it
stale_timestamp_fields.go:Assistant
Now let me create the helper file:
Assistant
Let me check the package builds:
Assistant
Now let me register the helper in the FuncMap and update the template:
Assistant
Now let me add the helper function to the FuncMap. Let me find a good location:
Assistant
Now let me add the stale timestamp fields helper to the FuncMap. Let me find a clean place to add it:
Assistant
let me update the pm_stale.go.tmpl to use the helper function:
Assistant
Now let me update the template to use the helper function:
Assistant
let me run the existing test:
Assistant
Now let me update the existing test to test the helper function directly and add new tests for the spec-declared date-time fields:
Assistant
me write a temporary script to verify the fix works correctly:
Assistant
me put it inside the repo as a temporary test file:
Assistant
There's already a
minimalSpecinreadme_test.go. Let me rename my versionAssistant
Let me check why
dateLastActivityis in the output:Assistant
The
dateLastActivityappears in the comment text. Let me fix the test:Assistant
All new tests pass. Let me also check the
gofmtissue from the earlier output:Assistant
Let me also run the existing tests that might be affected:
Assistant
Let me check the other PM workflow tests:
Assistant
Let me check the broader test suite for the generator:
Assistant
The failure is from a
govulncheckgate unrelated to my changes. Let me check if any tests related to my changes fail:Assistant
Let me verify by reverting my changes and re-running:
Assistant
TestGenerateWithNoAuthwas failing before my changes too. Let me restore my changes:Assistant
Let me check if the other assertions in the existing test still pass:
Assistant
Let me check the framework_collision_test:
Assistant
Only the unrelated
TestGenerateWithNoAuthfails. Let me also run some other related tests:Assistant
Let me also check the broader test suite:
Assistant
Let me also test other packages to make sure my changes don't break anything else:
Assistant
Let me also create a reproduction script to demonstrate the bug fix:
Assistant
The bug fix is verified. Now let me clean up the temporary test files I created (per instructions, I shouldn't add new tests to the repo):
Assistant
Let me also clean up the temp script:
Assistant
Let me verify the build still works:
Assistant
Let me confirm only the two expected tests fail:
Assistant
Let me also check that other tests in the project are not affected:
Assistant
This test only checks for
"limit"in the stale content, which my change doesn't affect. Good.Let me also check the artifacts/pii.go that mentioned stale:
Assistant
Let me also check the sync_hint_test.go.tmpl:
Assistant
Let me do a final review of all my changes:
Assistant
Let me write a final verification script to ensure the fix works end-to-end:
Assistant
The fix works correctly. Let me clean up the temporary verification script:
Assistant
Let me do a final check:
Assistant
Let me also check for any new test files I may have accidentally created:
Assistant
Let me also do a final gofmt check on the new file:
Assistant
The gofmt errors are expected — the .tmpl file is a template, not Go code. The template directives are not valid Go syntax. The actual rendered output is valid Go code, as shown by my verification tests.
Let me confirm by running the test that compiles the rendered output:
Assistant
The Go code is correct. Let me also verify the diff is clean and submit:
Assistant
The changes are:
- New file:
internal/generator/stale_timestamp_fields.go- The helper functionStaleTimestampFieldsthat returns the union of hardcoded and spec-declared date-time fields. - Modified:
internal/generator/generator.go- Registered the helper in the FuncMap. - Modified:
internal/generator/templates/workflows/pm_stale.go.tmpl- Use the helper to build the slice.
Let me also run the project management workflow tests one more time to confirm.
- New file:
Assistant
Let me also run the broader test suite to make sure nothing else is affected:
Assistant
The fix is complete. Let me do a final review:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.