Skip to content

chore: merge dev to main (v0.26.7)#143

Merged
djm81 merged 1 commit intomainfrom
dev
Jan 27, 2026
Merged

chore: merge dev to main (v0.26.7)#143
djm81 merged 1 commit intomainfrom
dev

Conversation

@djm81
Copy link
Copy Markdown
Collaborator

@djm81 djm81 commented Jan 27, 2026

Description

This PR merges the latest changes from `dev` to `main`, including version bump to 0.26.7 and performance optimizations.

Fixes #142

New Features

  • Startup performance optimization with metadata tracking
  • Backlog field mapping and refinement improvements
  • Custom field mapping support for ADO and GitHub
  • Update command for CLI version management

Contract References:

  • Startup checks optimization maintains existing contracts
  • Backlog mappers use `@icontract` and `@beartype` decorators
  • Auth command improvements maintain existing authentication contracts

Type of Change

Please check all that apply:

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔒 Contract enforcement (adding/updating `@icontract` decorators)
  • 🧪 Test enhancement (scenario tests, property-based tests)
  • 🔧 Refactoring (code improvement without functionality change)

Contract-First Testing Evidence

Required for all changes affecting CLI commands or public APIs:

Contract Validation

  • Runtime contracts added/updated (`@icontract` decorators on public APIs)
  • Type checking enforced (`@beartype` decorators applied)
  • CrossHair exploration completed: `hatch run contract-test-exploration`
  • Contract violations reviewed and addressed

Test Execution

  • Contract validation: `hatch run contract-test-contracts` ✅
  • Contract exploration: `hatch run contract-test-exploration` ✅
  • Scenario tests: `hatch run contract-test-scenarios` ✅
  • Full test suite: `hatch run contract-test-full` ✅

Test Quality

  • CLI commands tested with typer test client
  • Edge cases covered with Hypothesis property tests
  • Error handling tested with invalid inputs
  • Rich console output verified manually or with snapshots

How Has This Been Tested?

Contract-First Approach: All changes validated through contracts and comprehensive test suite.

Manual Testing

  • Tested CLI commands manually
  • Verified rich console output
  • Tested with different input scenarios
  • Checked error messages for clarity

Automated Testing

  • Contract validation passes
  • Property-based tests cover edge cases
  • Scenario tests cover user workflows
  • All existing tests still pass

Test Environment

  • Python version: 3.11
  • OS: Linux (Ubuntu)

Checklist

  • My code follows the style guidelines (PEP 8, ruff format, isort)
  • I have performed a self-review of my code
  • I have added/updated contracts (`@icontract`, `@beartype`)
  • I have added/updated docstrings (Google style)
  • I have made corresponding changes to documentation
  • My changes generate no new warnings (basedpyright, ruff, pylint)
  • All tests pass locally
  • I have added tests that prove my fix/feature works
  • Any dependent changes have been merged

Quality Gates Status

  • Type checking ✅ (`hatch run type-check`)
  • Linting ✅ (`hatch run lint`)
  • Contract validation ✅ (`hatch run contract-test-contracts`)
  • Contract exploration ✅ (`hatch run contract-test-exploration`)
  • Scenario tests ✅ (`hatch run contract-test-scenarios`)

Key Changes Summary

Version: 0.26.6 → 0.26.7

Major Features:

  1. Startup Performance Optimization - Metadata tracking reduces startup check overhead
  2. Backlog Field Mapping - Custom field mapping support for ADO and GitHub adapters
  3. Update Command - New `specfact update` command for version management
  4. Auth Improvements - Enhanced Azure DevOps authentication with better error handling

Files Changed: 47 files, +4196 insertions, -178 deletions

See CHANGELOG.md for complete details.

…command (#142)

* feat: implement backlog field mapping and refinement improvements

- Add FieldMapper abstract base class with canonical field names
- Implement GitHubFieldMapper and AdoFieldMapper
- Add custom field mapping support with YAML templates
- Add field validation in refinement (story_points, business_value, priority)
- Add comprehensive unit and integration tests (42 tests)
- Add custom field mapping documentation
- Fix custom_field_mapping parameter connection
- Add early validation for custom mapping files

Implements OpenSpec change: improve-backlog-field-mapping-and-refinement

* perf: optimize startup performance with metadata tracking and update command

- Add metadata management module for tracking version and check timestamps
- Optimize startup checks to only run when needed:
  - Template checks: Only after version changes detected
  - Version checks: Limited to once per day (24h threshold)
- Add --skip-checks flag for CI/CD environments
- Add new 'specfact update' command for manual update checking and installation
- Add comprehensive unit and integration tests (35 tests, all passing)
- Update startup_checks to use metadata for conditional execution
- Ensure backward compatibility (first-time users still get all checks)

Performance Impact:
- Startup time: Reduced from several seconds to < 1-2 seconds
- Network requests: Reduced from every startup to once per day
- File system operations: Reduced from every startup to only after version changes

Fixes #140
Implements OpenSpec change: optimize-startup-performance

* feat: request offline_access scope for Azure DevOps refresh tokens

- Add offline_access scope to Azure DevOps OAuth requests
- Refresh tokens now last 90 days (vs 1 hour for access tokens)
- Automatic token refresh via persistent cache (no re-authentication needed)
- Update documentation to reflect 90-day refresh token lifetime

This addresses the issue where tokens were expiring too quickly.
Refresh tokens obtained via offline_access scope enable automatic
token renewal for 90 days without user interaction.

Fixes token lifetime limitation issue

* feat: improve CLI UX with banner control and upgrade command

- Change banner to hidden by default, shown on first run or with --banner flag
- Add simple version line (SpecFact CLI - vXYZ) for regular use
- Rename 'update' command to 'upgrade' to avoid confusion
- Update documentation for new banner behavior and upgrade command
- Update startup checks message to reference 'specfact upgrade'

* fix: suppress version line in test mode and fix field mapping issues

- Suppress version line output in test mode and for help/version commands to prevent test failures
- Fix ADO custom field mapping to honor --custom-field-mapping on writeback
- Fix GitHub issue body updates to prevent duplicate sections
- Ensure proper type handling for story points and business value calculations

* Fix failed tests

* chore: bump version to 0.26.7 and update changelog

- Fixed adapter token validation tests (ADO and GitHub)
- Resolved test timeout issues (commit history, AST parsing, Semgrep)
- Improved test file discovery to exclude virtual environments
- Added file size limits for AST parsing to prevent timeouts

---------

Co-authored-by: Dominikus Nold <djm81@users.noreply.github.com>
@djm81 djm81 self-assigned this Jan 27, 2026
@djm81 djm81 added bug Something isn't working enhancement New feature or request labels Jan 27, 2026
@djm81 djm81 moved this from Todo to In Progress in SpecFact CLI Jan 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

SpecFact CLI Validation Report

All validations passed!
Duration: 41.52s
Checks: 4 total (4 passed)

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 700c360450

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +207 to +211
for ado_field, canonical in field_mappings.items():
if canonical == canonical_field:
value = fields_dict.get(ado_field)
if value is not None:
return str(value).strip() if isinstance(value, str) else str(value)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prefer custom ADO mappings over defaults during extraction

Custom field mappings are documented as overriding defaults, but _extract_field walks field_mappings in insertion order, and _get_field_mappings builds the dict by copying defaults then appending custom mappings. This means if a work item contains both a default field and a custom field for the same canonical value (common when templates add custom fields but the defaults remain populated, e.g., story points = 0), the default value is returned first and the custom mapping is ignored. In ADO setups with custom fields, this causes the mapper to silently read the wrong value. Consider prioritizing custom mappings when extracting or removing default entries for canonical fields that are custom-mapped.

Useful? React with 👍 / 👎.

@@ -179,6 +200,21 @@ def convert_ado_work_item_to_backlog_item(item_data: dict[str, Any], provider: s
body_markdown = fields.get("System.Description", "") or ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use custom-mapped description for ADO body content

The converter always sets body_markdown from System.Description. With the new custom field mapping support, ADO instances that store descriptions in a different field (e.g., Custom.Description) will produce empty body_markdown even though AdoFieldMapper can extract the description. This breaks template detection/refinement for those users because the backlog item body is blank. Consider populating body_markdown from the mapper’s extracted description (or falling back to it when System.Description is missing).

Useful? React with 👍 / 👎.

@djm81 djm81 merged commit c4cd5de into main Jan 27, 2026
9 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in SpecFact CLI Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Change] Optimize Startup Performance [Change] Improve backlog field mapping and refinement handling

1 participant