Skip to content

feat: extend latest_release filter options - #188

Merged
httpdss merged 2 commits into
mainfrom
feature/latest-release-options
Aug 20, 2026
Merged

feat: extend latest_release filter options#188
httpdss merged 2 commits into
mainfrom
feature/latest-release-options

Conversation

@httpdss

Copy link
Copy Markdown
Owner

Summary

  • add strip_v=False to remove exactly one leading lowercase v from the latest release tag while leaving tags without that prefix, uppercase V, and default-branch fallbacks unchanged
  • add return_sha=False to return the commit SHA represented by the selected release tag, including lightweight and nested annotated tags
  • document the new options, fallback/error behavior, and examples in both filter references

Backward compatibility and option interaction

Both parameters are appended optional booleans, so existing one-argument Python and Jinja calls preserve the current tag/default-branch/LATEST_RELEASE_ERROR behavior. When return_sha=True and strip_v=True are used together, SHA output takes precedence and strip_v is intentionally a no-op.

If latest-release selection fails, version mode retains the existing default-branch-name fallback; SHA mode resolves that branch head to a commit SHA. Once a release has been selected, tag-resolution failures return LATEST_RELEASE_ERROR rather than silently returning an unrelated branch revision.

Test coverage

Coverage includes:

  • unchanged default behavior and disabled stripping
  • lowercase v, repeated v, no-prefix, and uppercase V tags
  • lightweight, annotated, and nested annotated tag resolution
  • return_sha precedence when both options are enabled
  • default-branch fallback in version and SHA modes
  • malformed/missing refs, tag names, object types, object IDs, cycles, excessive nesting, and lookup failures
  • cache isolation between calls/options

Validation

Passed:

  • .venv/bin/pytest -q239 passed in 28.84s
  • .venv/bin/pre-commit run --all-files — YAML, EOF, and trailing-whitespace hooks passed
  • .venv/bin/mkdocs build — documentation built successfully in 5.95s (existing link warnings remain)
  • .venv/bin/python -m compileall -q structkit tests — passed
  • git diff --check origin/main...HEAD — passed
  • live authenticated check against httpdss/structkit — default v3.2.1, stripped 3.2.1, SHA 892c7aa8d35d44bf7ffbe41ab4367a0933bd6b05

Additional repository-wide diagnostics expose existing baseline debt rather than regressions from this PR:

  • mkdocs build --strict aborts on the same 9 pre-existing broken-link warnings on origin/main
  • mypy structkit fails on both this branch and origin/main at unchanged structkit/commands/validate.py:99
  • full black --check / flake8 are not currently clean on origin/main; focused changed-file comparison introduces no new failures (and tests/test_filters_more.py is now clean under both)

@httpdss
httpdss merged commit 6642fbf into mainAug 20, 2026
3 checks passed
@httpdss
httpdss deleted the feature/latest-release-options branch August 20, 2026 14:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@httpdss