Skip to content

Add M-Team own torrent lists and publish releases on merge (v0.4.0-alpha.1) - #32

Merged
tonycoder-hub merged 3 commits into
mainfrom
feat/mteam-account-torrents
Oct 16, 2026
Merged

tonycoder-hub merged 3 commits into
mainfrom
feat/mteam-account-torrents

Conversation

@tonycoder-hub

@tonycoder-hub tonycoder-hub commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds a generic account.torrents.read capability and a site torrents command, implemented for M-Team, that reads one page of the account's own seeding, leeching, completed, incomplete, or uploaded list.

  • Port: site.AccountTorrentLister with ValidateAccountTorrentQuery (runs before any credential is read) and AccountTorrents. TJUPT can implement it later without CLI changes.

  • M-Team: POST member/profile for the account ID, then POST member/getUserTorrentList ({"userid","type","pageNumber","pageSize":50}) on one client, three seconds apart. The account ID is never printed.

  • Traffic scope: each row's traffic comes from exactly one source, named by traffic_scope:

    • account_total: the snatch record (uploadedReal/downloadedReal), the account's whole history;
    • current_session: the running peer's report.

    A live check showed the seeding list carries only the peer, while the completed list carries the snatch record. Mixing them in one field would have misled scripts, so the two are never combined in one row. Seed time comes only from the snatch record, in seconds.

  • Privacy: the peer's IP/IPv6, peer ID, and client name are in the API answer but are never decoded (the fixture marks them PEER-SECRET and the test asserts they cannot reach JSON).

  • Fail closed: a missing list or any unrecognized row fails the whole page. A repeated torrent is kept once.

Deliberate output changes

  • New capability account.torrents.read: M-Team now declares 9 capabilities, so site list and site capabilities mteam (table and JSON) gain one entry. Goldens are updated.
  • New command site torrents [--cookie-stdin | --api-key-stdin] [--state …] [--page N] [--output table|json] SITE, with a new usage line in help.
  • New JSON kind site.account.torrent.list.
  • sitetest gains a cancellation check for the new port and an account.torrents.read/query validation subtest.

No existing command's output, stop reasons, error text, or exit codes change.

Not supported, documented

  • Messages: msg/search answers code 401 ("Full authentication is required") to an API key. Only two counter endpoints answer, and their meaning cannot be checked against readable messages.
  • RSS: links carry a rotating signed secret that ptctl does not create, print, or store.

Release process: publish on merge (first release v0.4.0-alpha.1)

The tag-pushed, draft-only release workflow becomes a merge-triggered one. Merging this PR publishes v0.4.0-alpha.1, the first GitHub Release.

  • Trigger: release runs on every push to main (and on manual runs on main). Its plan step reads VERSION at the commit:

    • a VERSION already tagged on an earlier commit → skip (ordinary merges build nothing);
    • an untagged VERSION → must be SemVer-newer than every v* tag and have a non-empty ## <VERSION> section in CHANGELOG.md, else the run fails;
    • a tag on this very commit → a rerun that finishes the release.
  • Publish order (release.py publish), stopping at the first failure:

    1. local checks of main history, workflows, assets, manifest, and checksums;
    2. refuse an existing release, including a draft;
    3. create the annotated tag, or require an existing one to name this commit;
    4. create a draft with the CHANGELOG section plus GitHub's generated notes, then upload and verify each asset digest;
    5. recheck the tag;
    6. only then make it public: prerelease for a - version, latest otherwise.

    A failure leaves at most the tag and an unpublished draft, never a public release with missing assets.

  • PR CI: identity now fails when VERSION has no CHANGELOG.md section.

  • Permissions: unchanged: contents: read, with contents: write only on the final job, using GITHUB_TOKEN.

  • Files:

    • VERSION → v0.4.0-alpha.1;
    • new CHANGELOG.md;
    • scripts/release.py: check-tag/create-draft → plan/publish;
    • .github/workflows/release.yml;
    • docs/RELEASING.md rewritten, plus README install (Releases, @v0.4.0-alpha.1), docs index, quickstart, and CONTRIBUTING.

Test plan

  • gofmt, go vet ./..., go test -race ./..., go build -trimpath ./cmd/ptctl

  • python -m unittest discover -s scripts/tests, 18 tests:

    • SemVer order;
    • CHANGELOG sections;
    • plan in a real temporary git repo: new, already-tagged, rerun, older, off-main, changed workflows;
    • publish against a stateful fake GitHub: tag then draft then upload then publish last, tag reuse, tag on another commit, existing release, partial upload, tag moved during upload.
  • plan on this branch in a clone with the real tags (v0.1.0-alpha.1, v0.2.0-alpha.1): release=true, v0.4.0-alpha.1

  • Unit tests: request bodies, every state and page, query validation, fail-closed parsing, traffic-scope precedence, foreign credentials, CLI table/JSON goldens, empty list, public-error redaction

  • Live (throwaway HOME, saved key via site login --api-key-stdin), 2026-10-16 and 2026-10-17:

    • seeding: five session rows, later empty;
    • completed: five account_total rows with seed time.

    Exit 0 every time, and no output held the key or a peer address.

🤖 Generated with Claude Code

jinzheng.architect and others added 3 commits October 17, 2026 01:05
Add a generic account.torrents.read capability with an AccountTorrentLister
port and a `site torrents` command that reads one page of the account's
seeding, leeching, completed, incomplete, or uploaded list.

The M-Team adapter reads the account ID from member/profile and then one page
of member/getUserTorrentList on one client. Each row reports bytes actually
transferred from exactly one source, named by traffic_scope: the snatch
record (account_total) or the running peer (current_session). The peer's
addresses, peer ID, and client name are never decoded. A missing list or an
unrecognized row fails the whole page.

The sitetest suite checks the new port's cancellation and query validation.
Docs record why messages (the API refuses an API key) and RSS (rotating
signed links) stay unsupported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents dispatch on kind and treat an unlisted one as unsupported, so the
automation contract must name every kind jsonKind returns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release workflow now runs on every push to main. A plan step skips
any commit whose VERSION is already tagged on an earlier commit; a new
VERSION must be newer than every v* tag and have a CHANGELOG.md section.
The publish step creates the annotated tag, uploads the tested assets
to a draft, rechecks the tag, and only then makes the release public,
so a failure leaves at most the tag and an unpublished draft. PR CI
fails when VERSION has no CHANGELOG.md section.

VERSION becomes v0.4.0-alpha.1, the first published release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tonycoder-hub tonycoder-hub changed the title Add M-Team own torrent lists (site torrents) Add M-Team own torrent lists and publish releases on merge (v0.4.0-alpha.1) Oct 16, 2026
@tonycoder-hub
tonycoder-hub merged commit fe03360 into main Oct 16, 2026
5 checks passed
tonycoder-hub added a commit that referenced this pull request Oct 23, 2026
Add M-Team own torrent lists and publish releases on merge (v0.4.0-alpha.1)
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.

1 participant