Skip to content

feat(v2): implement daily activity extractor and migrate legacy test suite - #1

Merged
Volcann merged 24 commits into
mainfrom
feat/v2
Oct 25, 2026
Merged

Volcann merged 24 commits into
mainfrom
feat/v2

Conversation

@Volcann

@Volcann Volcann commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Overview

This PR introduces the v2 architecture rewrite for workedTask, replacing the legacy monolithic collector with a streamlined, modular daily activity extraction pipeline (src/extractors/daily_activity_extractor.py) and migrating the test suite.

Key Changes

1. Daily Activity Extractor (src/extractors/)

  • Implemented DailyActivityExtractor to extract and structure developer activity (commits, comments, reviews, issues, and pull requests) for specified dates.
  • Standardized the activity schema to produce structured JSON outputs compatible with reporting pipelines.
  • Added support for filtering by author, repository, date windows, and shift schedules.

2. Legacy Codebase Refactoring

  • Removed legacy, obsolete monolithic collection and presentation modules (src/collection/, src/processing/, src/presentation/, src/models/, src/shared/).
  • Moved pre-v2 tests to tests/legacy/ to preserve historical test references while preventing suite clutter.

3. Test Suite & Validation

  • Added comprehensive unit test coverage under tests/extractors/:
    • test_activity_schema.py: Validates schema conformance of extracted records.
    • test_cli_execution.py: Verifies CLI arguments, date handling, and stdout/file output.
    • test_comment_extraction.py: Validates PR and issue comment parsing and sanitization.
    • test_commit_extraction.py: Verifies author commit filtering and message parsing.
    • test_issue_extraction.py: Exercises issue event and comment extraction.
    • test_live_extraction.py: Integration testing for live GitHub extraction workflows.

4. Build & Tooling

  • Updated Makefile with targets for daily extraction (make extract, make run, make today, make yesterday).
  • Configured package dependencies and paths in pyproject.toml.

Verification

  • All extractor tests pass cleanly under pytest.
  • Activity extraction tested against both mock fixtures and recorded snapshots.

Remove all legacy source code under src/ in preparation for v2 architecture.

Deleted components:
- cli (commands and CLI entrypoint)
- collection (collector logic)
- config (loader and validator)
- models (data structures)
- presentation (report formatting)
- processing (AI enhancer)
- shared (demo data and shared utilities)
…d ReportService

- Implement ReportSchedule with wall time timezone conversions and overtime boundary detection
- Add immutable domain models: DailyReport, ReportChunk, ReportEntry, and ManualTask
- Implement ReportService to orchestrate developer activity aggregation and task mapping
- Add config loader for JSON configuration, shift rules, and manual tasks
- Add comprehensive test coverage for schedule verification, config loader, and report package
… test suite

- Refine commit, comment, and issue extraction pipelines with schema compliance
- Modernize daily activity extractor command and serialization logic
- Remove obsolete legacy tests in favor of isolated extractor unit tests
- Add extractor test fixtures and assertions for GitHub activities
- Implement format_office_status enforcing strict office reporting conventions
- Add clean ticket parsing, bullet sanitization, and overtime breakdown rendering
- Provide alias module utils.formate and PR JSONL chunk renderer
- Add extensive historical regression tests across 24 distinct daily status reports
…rification

- Implement StrictFormatValidator enforcing mandatory sections, bullet style, and banned buzzwords
- Implement FactualValidator computing claim-to-evidence support percentage against raw activity
- Provide structured validation dataclasses with serializable compliance results
- Add automated test suite for validator package exports and validation invariants
…omain constants

- Unify project constants (headings, prohibited phrases, free-tier models) in constants.py
- Implement GeminiSummarizer with automatic fallback across active free-tier Gemini models
- Implement live model probing and PR prompt generation in utils/
- Provide application.py pipeline coordinator with optional AI enrichment
- Add automated test suites for AI, constants, and utilities packages
…ripts

- Expose worked-task and status-report console entrypoints routing to cli.commands:main
- Standardize src/__main__.py as the unified standalone execution module
- Update pyproject.toml package discovery for modularized v3 source layout
- Update Makefile targets and documentation for office reporting and validation workflows
- Add architectural tests prohibiting direct network leaks outside ghToolkit
@Volcann Volcann added the enhancement New feature or request label Oct 24, 2026
@Volcann Volcann self-assigned this Oct 24, 2026
Volcann and others added 16 commits October 25, 2026 04:13
feat(v3): modular architecture, strict office status formatting, validation, and AI enrichment
…l evidence verification

- Update ReportSchedule.is_extra_time to treat shift start as inclusive and shift end as exclusive (half-open interval)
- Introduce is_out_of_report_shift in format.py to drive office status and overtime formatting from configured shift parameters
- Refactor FactualValidator to map rendered lines to source activity chunks, disambiguate multi-repository PRs, and isolate overtime claims
- Expose source_consistency_percent on FactualValidationResult as preferred metric name while retaining legacy fact_support_percent compatibility
- Update documentation and regression test assertions to verify shift boundaries and source consistency semantics
… and format utilities

- Add test_main_entrypoint.py covering __main__ CLI execution, return code propagation, and import guard safety
- Add test_application_comprehensive.py testing generate_report project normalization, input validation, snapshot fallback, and manual task wiring
- Add test_cli_comprehensive.py testing atomic file writing, temporary file error cleanup, CLI flag parsing, and exception mapping
- Add test_format_comprehensive.py verifying parse_ticket_and_title regex branches, merge commit heuristics, finding truncation, and formate re-exports
…bing, and fallbacks

- Add test_models_comprehensive.py covering .env search paths, active model action filtering, flash-tier prioritization, and HTTP status code mapping (429, 504, 404, 503)
- Add test_summarizer_comprehensive.py covering GeminiSummarizer model resolution, client ownership lifecycle, close() invocations, and transient retry escalation
…le, config, service, validators, and extractor

- Add test_schedule_comprehensive.py testing wall_time nonexistent DST validation, offset rejection in shift clocks, and local timestamp formatting
- Add test_config_comprehensive.py testing WORKED_TASK_CONFIG env loading, JSON schema validation, and manual task parsing
- Add test_report_service_comprehensive.py testing ReportService default GitHubHub instantiation, ai_failure mode validation, and manual task window boundaries
- Add test_strict_format_validator_comprehensive.py testing all 8 office format rules and individual violation modes
- Add test_factual_validator_comprehensive.py testing unmatched lines, PR mismatches, review/implementation segregation, and commit uniqueness
- Add test_extractor_comprehensive.py testing DailyActivityExtractor path resolution, date normalization, commit deduplication, and runner error handling
…portService

- Introduce status_reporter_auth package with github_token() resolver supporting GITHUB_TOKEN, GH_TOKEN, and gh auth token CLI fallback without leaking token output
- Update ReportService default initialization to authenticate GitHubHub using resolved github_token() while allowing injected sources to bypass credential lookup
- Expose status_reporter_auth in pyproject.toml setuptools package discovery
- Add comprehensive test coverage in test_status_reporter_auth.py and update test_report_service_comprehensive.py to verify default token passing and injected source behavior
…ge and actor provenance

- Add merged_at, merged_by, merge_commit_sha, and merge_status_verified fields to ReportChunk domain model
- Add actor_login attribute to ReportEntry to preserve author and reviewer identity
- Add "Merged PRs:" section to ALLOWED_HEADINGS in constants.py
- Update DailyActivityExtractor to safely handle null comment IDs and issue numbers
- Update test_extractor_comprehensive.py CLI invocation tests to mock GitHubClient dependencies cleanly
…nforce factual validation

- Add _local_event_time, _pr_status_lines, and _review_action_lines in utils/format.py to display repository PR links, merge outcomes, and distinct review actions
- Introduce dedicated "Merged PRs:" category in format_office_status and format_overtime_breakdown_only
- Enhance FactualValidator to verify "Merged PRs:" claims, merge metadata, review states, and prevent forged merger attributions or unverified merge claims
- Ensure overtime formatting accurately isolates after-hours merge events and claims
- Add test_pr_provenance.py verifying approval/merge separation, merger attribution, aliases across snapshot replays, and validation rules
- Update test_office_format_regression.py bullet line filtering to accommodate PR link and merge status lines
…, and test fixtures

- Expand GitHub Actions CI matrix to include Python 3.10, 3.11, and 3.12
- Add sed patch step in CI workflow for dynamic sibling ghToolkit dependency path resolution
- Update README.md with live reporting credential resolution details, PR provenance documentation, and review state guidelines
- Update test_application_comprehensive.py snapshot test fixtures with schema-compliant JSON structures
- Update test_cli_comprehensive.py commands.py invocation test with full required CLI arguments
…ormat output, fix CI uv.lock patching

AI / Summarizer
- Add summarize_review() to GeminiSummarizer that uses a dedicated
  build_review_prompt(); both methods share a new _generate() helper
  so model-fallback logic (Aevora pattern) is applied consistently.

ReportService
- After the work summary loop, call summarize_review() when the chunk
  contains non-empty review_comment / issue_comment entries.
- Store review AI outputs under a namespaced key review:<chunk_id> so
  they are kept strictly separate from the work summary store.
- Guard with the same ai_failure sentinel (raise vs. warn).

format.py
- Add _review_summary_lines() to extract concrete review findings from
  entries, stripping code fences, markdown links, HTML, and @-mentions.
- format_office_status() now emits a 'Review impact: ...' line when an
  AI review summary is present, and surfaces inline finding bullets
  otherwise; marker-only self-review entries are rendered as-is without
  inventing findings.
- Reviewed PR sections include conversation findings alongside commit
  implementation lines.

CI workflow fix
- Introduce GH_TOOLKIT_ABS variable for the absolute ghToolkit path.
- Replace broken uv.lock sed (which escaped quotes incorrectly and never
  actually patched the file) with two correct patterns covering both
  editable and path source forms.
- Switch 'uv pip install -e .[dev]' → 'uv sync --extra dev --frozen'
  so the patched lock file is honoured and ghtoolkit is resolved from
  the checked-out sibling directory rather than PyPI.

Tests
- test_ai.py: verify summarize() and summarize_review() call _generate()
  with the correct prompt builder.
- test_office_format_regression.py: four new cases covering multi-finding
  review output, marker-only self-review guard, AI review impact line
  with preserved discussion links, and mixed PR/review chunk grouping.
- test_report.py: assert review AI summary is stored under review: key
  and kept separate from the work summary.
- Remove all docstrings added to summarizer.py, prompt.py, and
  report_service.py per project style preference (no docstrings).
- Fix SIM117: collapse nested with-statements into single with across
  test_cli_comprehensive.py, test_models_comprehensive.py, and
  test_summarizer_comprehensive.py.
- Run ruff format to reformat test_application_comprehensive.py,
  test_cli_comprehensive.py, test_models_comprehensive.py, and
  test_pr_provenance.py.
- All 68 files now pass ruff check and ruff format --check.
…duplicate overtime marker, and update README

- Format overtime headers with ticket numbers:
  - Add extract_ticket_for_chunk() to extract ticket identifiers from title, entries, branches, or description.
  - Add format_overtime_header() to ensure overtime entries are prefixed with ticket ID when available.
  - Re-export helpers from src/utils/formate.py.
- Deduplicate overtime note:
  - Move EXTRA_TIME_NOTE outside chunk loop in format_office_status() and format_overtime_breakdown_only() so it appears only once per overtime block.
- Formatting & parsing improvements:
  - Replace hyphens and underscores with spaces in kebab-case/snake_case titles without spaces.
  - Fall back to capitalized raw message in clean_commit_message() when clean_line is empty.
  - Safely catch KeyError, ValueError, and TypeError in is_out_of_report_shift(), falling back to is_out_of_shift().
- Validator enhancements:
  - Track current_ticket from overtime ticket headers in FactualValidator to maintain source consistency evidence matching.
- Documentation & branding:
  - Add icon.png and include brand banner in README.md.
  - Rewrite README.md with comprehensive guides on architecture, activity categories, shift policies, AI summaries, and validation.
- Tests:
  - Add test_24_overtime_always_mentions_ticket_number and test_25_overtime_marker_appears_once_at_section_end in test_office_format_regression.py.
@Volcann

Volcann commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

-> The last full workedTask test run had 294 passed, 6 failed, and 3 skipped. The latest GitHub workflow ran lint only; it did not run tests.

@Volcann
Volcann merged commit 2568e9c into main Oct 25, 2026
2 checks passed
Volcann added a commit that referenced this pull request Oct 25, 2026
feat(v2): implement daily activity extractor and migrate legacy test suite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant