Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Dec 9, 2025

🎯 Summary

This PR implements support for a single Python runtime version (Python 3.13, the latest stable) and adds a comprehensive release workflow similar to test-anywhere, adapted for Python packages with PyPI trusted publishing.

Fixes #3

πŸ“ Changes

1. Python Version Support

  • βœ… Updated pyproject.toml to require Python >=3.13
  • βœ… Updated classifiers to only list Python 3.13
  • βœ… Updated ruff target-version to py313
  • βœ… Updated mypy python_version to 3.13
  • βœ… Updated test.yml workflow to test only Python 3.13
  • βœ… Applied ruff auto-fixes for modern Python 3.13 syntax

2. Release Workflow Infrastructure

  • βœ… Created release.yml workflow supporting:
    • Automated changeset-based releases to PyPI
    • Manual instant releases (patch/minor/major)
    • Manual changeset PR creation
    • PyPI OIDC trusted publishing (no tokens needed)
    • Comprehensive lint, format, and test checks

3. Changeset System

  • βœ… Set up .changeset/ configuration for version management
  • βœ… Created root package.json with changeset dependencies and scripts
  • βœ… Downloaded all release scripts from test-anywhere repository

4. Python-Specific Scripts

Created adapted scripts for Python package management:

  • publish-to-pypi.mjs - PyPI publishing with OIDC trusted publishing
  • update-python-version.mjs - Version bumping from changesets
  • create-github-release-python.mjs - GitHub releases from CHANGELOG.md

5. Documentation

  • βœ… Added python/CHANGELOG.md for tracking releases
  • βœ… Added .changeset/README.md with usage instructions

πŸš€ How It Works

Automated Release Flow

  1. Developer creates a changeset: npm run changeset
  2. Changeset is committed with code changes
  3. PR is merged to main
  4. CI automatically:
    • Bumps version in pyproject.toml
    • Updates CHANGELOG.md
    • Publishes to PyPI via OIDC trusted publishing
    • Creates GitHub release

Manual Release Options

  • Instant Release: Trigger via GitHub Actions UI for immediate patch/minor/major release
  • Changeset PR: Create a PR with a changeset for review before release

πŸ”’ Security

  • Uses PyPI OIDC trusted publishing (no API tokens needed)
  • Requires only id-token: write permission
  • Single workflow file as trusted publisher (PyPI requirement)

βœ… Testing

  • All Python tests pass (12/12) βœ…
  • Ruff linting passes βœ…
  • Local CI checks verified βœ…

πŸ“š References

Fixes #10

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #10
@konard konard self-assigned this Dec 9, 2025
- Complete timeline of E422 and E404 errors
- Root cause analysis for both failure scenarios
- Comparison with test-anywhere workflows
- Authentication strategies comparison
- Recommendations for future improvements

References test-anywhere workflows for comparison.

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Trusted publishing does not work in our CI/CD βœ… Issue #10 Analysis: Trusted Publishing Resolution Dec 9, 2025
@konard konard marked this pull request as ready for review December 9, 2025 07:16
@konard
Copy link
Member Author

konard commented Dec 9, 2025

πŸ€– Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

πŸ’° Cost estimation:

  • Public pricing estimate: $1.700427 USD
  • Calculated by Anthropic: $1.179073 USD
  • Difference: $-0.521354 (-30.66%)
    πŸ“Ž Log file uploaded as GitHub Gist (433KB)
    πŸ”— View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 9, 2025

Run # Publish to npm using OIDC trusted publishing
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.

> lino-arguments@0.2.6 changeset:publish
> changeset publish

πŸ¦‹  info npm info lino-arguments
πŸ¦‹  info lino-arguments is being published because our local version (0.2.6) has not been published on npm
πŸ¦‹  info Publishing "lino-arguments" at "0.2.6"
πŸ¦‹  error an error occurred while publishing lino-arguments: E404 Not Found - PUT https://registry.npmjs.org/lino-arguments - Not found 
πŸ¦‹  error The requested resource 'lino-arguments@0.2.6' could not be found or you do not have permission to access it.
πŸ¦‹  error 
πŸ¦‹  error Note that you can also install from a
πŸ¦‹  error tarball, folder, http url, or git url.
πŸ¦‹  error npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
πŸ¦‹  error 
πŸ¦‹  error > lino-arguments@0.2.6 prepare
πŸ¦‹  error > husky || true
πŸ¦‹  error 
πŸ¦‹  error npm warn gitignore-fallback No .npmignore file found, using .gitignore for file exclusion. Consider creating a .npmignore file to explicitly control published files.
πŸ¦‹  error npm warn gitignore-fallback No .npmignore file found, using .gitignore for file exclusion. Consider creating a .npmignore file to explicitly control published files.
πŸ¦‹  error npm warn publish npm auto-corrected some errors in your package.json when publishing.  Please run "npm pkg fix" to address these errors.
πŸ¦‹  error npm warn publish errors corrected:
πŸ¦‹  error npm warn publish "repository.url" was normalized to "git+https://github.com/link-foundation/lino-arguments.git"
πŸ¦‹  error npm notice SECURITY NOTICE: Classic tokens expire December 9. Granular tokens now limited to 90 days with 2FA enforced by default. Update your CI/CD workflows to avoid disruption. Learn more: https://gh.io/npm-token-changes
πŸ¦‹  error npm notice Publishing to https://registry.npmjs.org/ with tag latest and public access
πŸ¦‹  error npm notice Access token expired or revoked. Please try logging in again.
πŸ¦‹  error npm error code E404
πŸ¦‹  error npm error 404 Not Found - PUT https://registry.npmjs.org/lino-arguments - Not found
πŸ¦‹  error npm error 404
πŸ¦‹  error npm error 404  The requested resource 'lino-arguments@0.2.6' could not be found or you do not have permission to access it.
πŸ¦‹  error npm error 404
πŸ¦‹  error npm error 404 Note that you can also install from a
πŸ¦‹  error npm error 404 tarball, folder, http url, or git url.
πŸ¦‹  error npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-12-09T07_03_41_998Z-debug-0.log
πŸ¦‹  error 
πŸ¦‹  error packages failed to publish:
πŸ¦‹  lino-arguments@0.2.6
Error: Process completed with exit code 1.

Manual instant release does not work also: https://github.com/link-foundation/lino-arguments/actions/runs/20054899930/job/57518072639

Double check we use common.yml and workflows similar to https://github.com/link-foundation/test-anywhere

We need to have release description and release creation itself be unified between all our workflows.

Please download all logs and data related about the issue to this repository, make sure we compile that data to ./docs/case-studies folder, and use it to do deep case study analysis (also make sure to search online for additional facts and data), in which we will reconstruct timeline/sequence of events, find root causes of the problem, and propose possible solutions.

@konard konard marked this pull request as draft December 9, 2025 07:24
@konard
Copy link
Member Author

konard commented Dec 9, 2025

πŸ€– AI Work Session Started

Starting automated work session at 2025-12-09T07:24:57.557Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

@konard
Copy link
Member Author

konard commented Dec 9, 2025

❌ Usage Limit Reached

The AI tool has reached its usage limit. The limit will reset at: 10:00 AM

This session has failed because --auto-continue-on-limit-reset was not enabled.

To automatically wait for the limit to reset and continue, use:

./solve.mjs "https://github.com/link-foundation/lino-arguments/issues/10" --resume c9d650ed-8120-40a7-ac73-2d666ba202da --auto-continue-on-limit-reset

@konard
Copy link
Member Author

konard commented Dec 9, 2025

πŸ€– AI Work Session Started

Starting automated work session at 2025-12-09T21:21:50.804Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

konard and others added 2 commits December 9, 2025 22:28
- Enhanced issue #10 analysis with detailed E404 error investigation
- Added evidence-based findings from online research about OIDC trusted publishing
- Documented workflow_dispatch authentication issues with npm
- Compared authentication strategies (NPM_TOKEN vs OIDC vs Hybrid)
- Added workflow comparison with test-anywhere reference repository
- Proposed multiple solutions with trade-off analysis
- Added changeset for documentation changes

Key findings:
- E422 error (missing repository field) is resolved
- E404 error for manual releases linked to OIDC/workflow_dispatch incompatibility
- test-anywhere uses NPM_TOKEN which works for all trigger types
- Multiple solution options documented with pros/cons

Related: Issue #10, PR #11

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Applied prettier formatting to comprehensive analysis document
- Formatted changeset file

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 9, 2025 21:37
@konard
Copy link
Member Author

konard commented Dec 9, 2025

πŸ€– Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

πŸ’° Cost estimation:

  • Public pricing estimate: $4.186465 USD
  • Calculated by Anthropic: $2.166715 USD
  • Difference: $-2.019751 (-48.24%)
    πŸ“Ž Log file uploaded as GitHub Gist (669KB)
    πŸ”— View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Dec 13, 2025

Please use latest version of workflow in http://github.com/link-foundation/test-anywhere as our main workflow in the repository.

Try to do it as close as possible to actual release.yml from test-anywhere.

Also make sure we use test-anywhere itself as testing framework.

@konard konard marked this pull request as draft December 13, 2025 12:38
@konard
Copy link
Member Author

konard commented Dec 13, 2025

πŸ€– AI Work Session Started

Starting automated work session at 2025-12-13T12:38:01.723Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait working session to finish, and provide your feedback.

konard and others added 3 commits December 13, 2025 13:42
- Replace main.yml and manual-release.yml with single release.yml workflow
- Adopt test-anywhere release workflow pattern for unified CI/CD
- Add missing scripts from test-anywhere: setup-npm, version-and-commit, publish-to-npm, create-github-release, format-github-release
- Migrate tests to use test-anywhere API (expect/assert)
- Support 3 runtimes (Node, Bun, Deno) x 3 OS (Ubuntu, macOS, Windows) test matrix
- Consolidate manual release and automated release into single workflow file
- This addresses npm trusted publishing requirements where only ONE workflow can be authorized

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add 'fetch' to ESLint globals (Node.js 18+ native API)
- Remove unused 'assert' import from tests
- Use catch block without error parameter (intentionally ignored)
- Install dependencies with npm before running Bun/Deno tests
- This ensures test-anywhere package is available in all runtime environments

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Deno requires explicit permission flags to access environment variables and write to filesystem. The tests need:
- --allow-env: for process.env access (used by yargs and test setup)
- --allow-write: for creating test files
- --allow-read: for reading test files (already present)

πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard marked this pull request as ready for review December 13, 2025 12:49
@konard
Copy link
Member Author

konard commented Dec 13, 2025

πŸ€– Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

πŸ’° Cost estimation:

  • Public pricing estimate: $4.325172 USD
  • Calculated by Anthropic: $1.909698 USD
  • Difference: $-2.415474 (-55.85%)
    πŸ“Ž Log file uploaded as GitHub Gist (796KB)
    πŸ”— View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trusted publishing does not work in our CI/CD

2 participants