- worker maintenance job (hourly, batch of 3 tasks/tick): terminal-only
(accepted/rejected) tasks keep the newest K=2 materialized generations,
older generation directories are reclaimed from disk
- ownership filter by artifact ID marker prevents cross-task deletion;
path traversal rejected at identifier level (Join-cleaning-proof) plus
reconstructed-path prefix containment
- source video artifacts, rework baselines (embedded data), and formal
records are never touched; artifact records stay as tombstones per
spec §7 graceful-degradation semantics; rescans are idempotent no-ops
- tests: K=2 retention + source/other-task isolation, non-terminal and
shallow-history skips, traversal rejection - all green
Add a PART_INDEX_DELIVERY mode to the package operator (default off): a part
delivers a single part.json carrying both split levels, the task-level slice
boundaries and the action-level segments, plus a classification for every
reviewed interval. Kept intervals land in slices[], discarded intervals in
discardedSlices[] with their discard evidence, which deliberately makes the
discard reason part of the customer deliverable. Media, PTS, IMU, pose and
calibration bytes are no longer published; downstream packaging resolves them
from the pinned materialization revision.
The worker publishes the index through the same frozen-destination path as the
directory form. Extract prepareDeliveryTarget so single-file and directory
publication share one owner marker, overlap guards, delegated-scope check,
conditional create, sha256 verification, idempotent retry and the refusal to
overwrite another delivery. A part index also refuses to adopt a destination
that holds files without an owner marker, so additive migration cannot claim a
legacy directory by accident.
The API and download control plane recognise the new schema, project the split
classification for the browser, and treat a part index as a first-class final
delivery. Cross-language contract tests read the operator's own schema and
field literals so a one-sided rename fails a test.
Verification: 10 operator tests, 8 worker tests and 3 API tests for the new
behaviour pass. Failure sets match the HEAD baseline name-for-name for
internal/api (75), internal/worker (4), tests/backend and the frontend suite;
no regression. The end-to-end local replica stack was not exercised: it needs
image builds and the opt-in Go materialization fixture, so the Go to operator
handoff is covered by the contract tests instead.
An organization's run history grows unbounded and nothing ever shrinks
it — completed/failed/cancelled runs stay in the runs collection
forever, only removed if their whole project is later deleted. That
made every org-wide scan (most notably validateDeletionReferences'
deletion-safety check, and any other query through
ListRunArtifactsByOrganization) get proportionally slower over time as
an org's run count kept climbing, independent of the size of whatever
was actually being operated on. Live on Fanyu this showed up as project
deletion getting slower every day, driven entirely by an unrelated
capture-processing backlog continuously adding new runs to the same
organization.
Adds RunRecord.ArchivedAt and a periodic worker sweep
(archiveTerminalRuns, mirroring the existing orphan-runtime
reconciliation's throttle pattern) that marks completed/failed/cancelled
runs whose EndedAt is older than WORKER_RUN_ARCHIVE_MIN_AGE_SECONDS
(default 30 days) as archived, checking at most every
WORKER_RUN_ARCHIVE_CHECK_INTERVAL_SECONDS (default 1 hour). Archiving
never deletes anything — ListRunArtifactsByOrganization now excludes
archived runs so the hot-path org-wide scans stay bounded, but
ListRunArtifactsForProject (used when a project is actually being
deleted) still includes them, since a project's own deletion must still
clean up every run it ever had regardless of archive state. A run's
data is only actually removed when its project is deleted, unchanged
from today.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contract step of the account-phone-login expand-migrate-contract rollout.
Phone is now the sole account identifier end to end:
- domain.UserRecord/CreateUserInput: delete Email, drop Phone's omitempty
(required going forward).
- store: delete email_unique Mongo index; phone_unique is now non-sparse
(unique, not sparse) since every account creation path requires a phone.
Delete FindUserByEmail, ensureUserEmailAvailableLocked, and
ErrDuplicateUserEmail (confirmed dead via grep - all real call sites were
already migrated to the *Phone equivalents by tickets 01-03). Mongo
duplicate-key fallback and the account-mutation-guard's stale-write
snapshot/filter now key off Phone instead of Email.
- api: drop the now-impossible ErrDuplicateUserEmail branch in
renderUserMutationError. The account-hierarchy audit endpoint and the
supplier-deletion receipt struct both switch their identifying field from
Email to Phone, since both are populated fresh from current account state
(not frozen historical snapshots) - continuing to read a "email" key would
silently go blank for every account created after this change.
- frontend: src/types.ts User.phone is now required (email removed);
AccountHierarchyIssue.email -> .phone in services/api/users.ts and
pages/Users.tsx to match the backend audit endpoint's renamed field.
- Rewrote the wide blast radius of Go test fixtures that constructed users
by email across internal/api/*_test.go and internal/store/*_test.go,
including the two dedicated memory-store uniqueness tests (merged into
phone-only equivalents) and several opt-in "live" acceptance-fixture
tests gated behind env vars for real Fanyu deployments.
Repo-wide grep of Go and TS/TSX for Email/email/邮箱 turned up no remaining
account-identifier references outside of a few harmless test-only cosmetic
labels (e.g. "Email Tenant" as an org display name in a seed helper) and
assertions that explicitly check "邮箱" text is absent from API responses.
go build/vet clean. go test ./internal/api/... ./internal/store/...
./internal/domain/... : 75 failures, identical test names to the
pre-ticket-05 baseline (diffed against a throwaway worktree at the prior
tip). npm run lint:web (tsc --noEmit) clean. npm run test:frontend:
599/586/13, matching the stated baseline exactly.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>