Skip to content
TheChatArchiveThe Chat Archive
GLMz-ai/glm-5.2· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Stale-detection timestamp-field allowlist misses spec-declared date…

  1. 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.go matches inactivity against a hardcoded staleTimestampFields allowlist (updatedAt, updated_at, updatedDate, modifiedAt, modified_at, lastModified, last_modified, lastEditedTime, last_edited_time, updated, last_updated). Trello cards use dateLastActivity, which is absent. The flagship stale command returned "No stale items found" while a hand-built health command (reading dateLastActivity) 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 a stale that finds rows older than N days.
    • Negative: an API using updated_at is unchanged.

    Repro / evidence

    trello-pp-cli stale --days 14 → empty; trello-pp-cli health → 93 stale on the same mirror. Fixed by hand-adding dateLastActivity to 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 using git reset --hard command. Additionally, you can use git stash and git stash pop to 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 submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /cli-printing-press, current file: none) bash-$

  2. GLM Assistant

    Let me explore the repository structure to understand the codebase and find the relevant files.

  3. GLM Assistant

    Let me explore the repository structure.

  4. GLM Assistant

    Let me look at the internal directory and find the stale template.

  5. GLM Assistant

    Now let me understand how the template gets executed and what data is available. Let me look at the generator code around the pm_stale.go.tmpl case.

  6. GLM Assistant

    Now let me find where templates are rendered and what data is passed. Let me look for the call site of renderTemplate for the stale template and what data structure is used.

  7. GLM Assistant

    Let me find the data passed to the pm_stale template specifically.

  8. GLM Assistant

    Let me find the main template rendering map (the one around line 1535) which includes pm_stale.go.tmpl.

  9. GLM Assistant

    Let me find where pm_stale.go.tmpl is mapped to an output path and what data is passed to it.

  10. GLM Assistant

    Let me look at vision_templates.go to understand the workflow templates and how they are rendered.

  11. GLM Assistant

    Now let me find where workflow templates are rendered and what data is passed.

  12. GLM Assistant

    So g.Spec (the APISpec) is passed as data to the template. Let me understand the spec structure to know how to derive date-time property names.

  13. GLM Assistant

    Let me look at the Resource and TypeDef structures, especially properties with format date-time.

  14. GLM Assistant

    Now let me look at the ResponseDef and Param/Property structures to understand where properties with format: date-time live.

  15. GLM Assistant

    Now let me look at the existing tests for the stale template to understand the test format and expectations.

  16. GLM Assistant

    Let me look at the template functions available (the FuncMap).

  17. GLM Assistant

    Let me look at how the generator determines syncable/synced resources and their response item types.

  18. GLM Assistant

    Let me look at how the template FuncMap is set up and what closures it has access to.

  19. GLM Assistant

    Let me check how the OpenAPI parser populates Types and response item types, to confirm date-time fields land in Types.

  20. GLM Assistant

    Let me look at lines 4040-4060 and 4750-4770 to confirm TypeField.Format is populated from schema.

  21. GLM Assistant

    Let me find where helper functions like exportableResources and safeSQLName are defined to place my new helper.

  22. GLM Assistant

    Let me look at how golden test files for pm_stale.go are structured and find an existing golden pm_stale.go.

  23. GLM Assistant

    No golden pm_stale.go files exist. Let me search the golden fixtures more broadly.

  24. GLM Assistant

    Let me look at how generator tests build specs and run generation, to understand the testing infrastructure.

  25. GLM Assistant

    Let me look at the minimalSpec helper and find how to set up a workflow/stale generation test.

  26. GLM Assistant

    Let me check if there are format constants in the spec package.

  27. GLM Assistant

    No constant for "date-time". I'll use the literal string "date-time". Let me check if there's a constant somewhere else (openapi package).

  28. GLM Assistant

    The codebase uses the literal string "date-time" directly (e.g., parser.go line 3741, 4671). So I'll use the literal "date-time" string. Let me check the schemaFormat function to see how it normalizes.

  29. GLM Assistant

    Now I understand the codebase. Let me implement the fix. First, I'll add a helper function specStaleTimestampFields to vision_templates.go.

  30. GLM Assistant

    Now let me add the helper function after hasBareCollectionEndpoint:

  31. GLM Assistant

    Now let me insert this helper into vision_templates.go after hasBareCollectionEndpoint:

  32. GLM Assistant

    The helper is added. Now let me register it in the FuncMap near exportableResources:

  33. GLM Assistant

    My edit created a duplicate "isGraphQL" and broke indentation. Let me fix lines 286-292:

  34. GLM Assistant

    There's now a duplicate "kebab" at lines 292-293. Let me clean up lines 286-293:

  35. GLM Assistant

    There's a duplicate "humanName" at lines 293-294. Let me remove the duplicate:

  36. GLM Assistant

    The FuncMap is now clean. Let me check the scorecard that reads pm_stale.go content to make sure my changes don't break it.

  37. GLM Assistant

    The scorecard only checks for the "limit" flag, which my change doesn't affect. Now let me modify the template. Let me open it:

  38. GLM Assistant

    Now let me modify the template. I'll replace the hardcoded staleTimestampFields var block (lines 16-36) with the hardcoded baseline, a spec-derived slice, and a runtime union:

  39. GLM Assistant

    The template changes look good. Now let me verify the generator package compiles:

  40. GLM Assistant

    Let me set up the Go cache environment variables:

  41. GLM Assistant

    The build is downloading dependencies. Let me check if there's a vendor directory or if we need network. Let me wait for the build to complete.

  42. GLM Assistant

    The generator package builds. Now let me run the existing stale template test:

  43. GLM Assistant

    The existing test passes. Now let me write a temporary verification script. First, let me find tests that set VisionSet.Workflows to understand the setup pattern:

  44. GLM Assistant

    Now I understand the test pattern. Let me write a temporary verification test to confirm the fix works for both positive and negative cases:

  45. GLM Assistant

    Both verification tests pass. Let me inspect the actual generated pm_stale.go content to make sure it's valid, and verify the generated CLI compiles. Let me write a more thorough check:

  46. GLM Assistant

    The generated content is correct. The compile test failed due to environment (missing go.sum entries in the generated CLI). Let me check how the existing tests handle this with runGoCommand:

  47. GLM Assistant

    Let me update the compile test to use the existing runGoCommandRequired helper and proper env:

  48. GLM Assistant

    The compile failure is an environment issue (sumdb verification needs HOME/GOPATH). Let me check the env and set the needed vars:

  49. GLM Assistant

    HOME and GOPATH are not set. Let me set them along with GONOSUMDB for the compile test:

  50. GLM Assistant

    The remaining compile failure is a pre-existing module-resolution environment issue (the generated MCP main.go can't resolve local packages under -mod=mod with incomplete go.sum), not related to my change. The generation step already runs gofmt/format.Source on the rendered .go file, which validates syntax. Let me confirm there were no gofmt warnings and check that an existing compile-style test also fails the same way in this environment:

  51. GLM Assistant

    runGoCommandRequired makes mod tidy a no-op, so go.sum isn't populated — this is an environment limitation affecting all generated-CLI compile tests here. Let me confirm by running an existing compile test to see it fails the same way (proving it's environmental, not my change):

  52. GLM Assistant

    TestGenerateShareEmittedWhenEnabled passes — so generated CLIs CAN compile here. Let me see how it differs from my compile test. Let me look at its setup:

  53. GLM Assistant

    The share test uses a real parsed spec and default VisionSet (MCP auto-enabled). My minimal-spec compile test failed on MCP module resolution. Let me check whether Generate() always renders MCP and how it's gated:

  54. GLM Assistant

    Found it — line 2386 always generates the MCP entrypoint main.go, but the internal/mcp package (line 2951) is gated on VisionSet.MCP. Since I didn't set MCP: true, the entrypoint imports a non-existent package. Let me fix my compile test to set MCP: true:

  55. GLM Assistant

    All three verification tests pass, including the compile test. Now let me run the broader set of existing generator tests that could be affected (stale, workflows, template annotation tests):

  56. GLM Assistant

    All pass. Now let me check whether there are golden-file or full-generation tests that could be affected by the template change (e.g., dogfood/golden fixtures that include pm_stale.go):

  57. GLM Assistant

    No golden pm_stale.go files exist. Let me check for any golden-generation test runner that regenerates full CLIs and compares:

  58. GLM Assistant

    Let me check the golden test infrastructure (scripts/golden.sh) and whether any golden fixture uses the project-management archetype:

  59. GLM Assistant

    None of the golden fixtures use the project-management archetype, so no golden output is affected. Let me run the full generator test suite with a generous timeout to confirm nothing is broken:

  60. GLM Assistant

    The only failure is TestGenerateWithNoAuth, which fails due to a pre-existing govulncheck stdlib vulnerability (crypto/tls@go1.26.4, GO-2026-5856) in the Go toolchain — completely unrelated to my stale-timestamp change. Let me confirm it's pre-existing by checking which tests run govulncheck and running the suite excluding them:

  61. GLM Assistant

    Confirmed: TestGenerateWithNoAuth fails identically on the original (stashed) code — it's a pre-existing govulncheck stdlib-vuln issue, not caused by my change. Let me run the full generator suite excluding the govulncheck-gated tests to confirm everything else passes:

  62. GLM Assistant

    body_collision_test.go only mentions govulncheck in a comment. So the only test running the govulncheck gate is TestGenerateWithNoAuth (and the validate_test.go uses a fake). Let me check which tests call the validate gate that runs govulncheck. Let me search for where the "govulncheck ./..." gate is actually invoked in tests (the real one, not the fake).

  63. GLM Assistant

    So gen.Validate() (line 1553) is called in TestGenerateWithNoAuth. Validate() runs the govulncheck gate. This is the only test that runs the real govulncheck gate. Let me confirm the function name at line 1553.

  64. GLM Assistant

    Confirmed. Let me run the full generator suite excluding only TestGenerateWithNoAuth to confirm everything else passes:

  65. GLM Assistant

    All generator tests pass (except the pre-existing environmental govulncheck failure). Now let me run the pipeline package tests (scorecard reads pm_stale.go content) and build the whole project to be safe:

  66. GLM Assistant

    Pipeline tests pass. Now let me clean up the temporary verification test file and any cache artifacts. Let me check git status first:

  67. GLM Assistant

    Let me remove the temporary test file and clean up the cache artifacts. First, let me check .gitignore:

  68. GLM Assistant

    The working tree now contains only my intended changes. Let me verify there are no stray untracked files and review the final diff:

  69. GLM Assistant

    The diff is clean and complete. Let me do a final build/vet check and re-run the key stale template test to confirm everything is solid:

  70. GLM Assistant

    Everything passes. Let me clean up any cache artifacts created during the test run and verify a final clean git status:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.