Skip to content

fix(ci): harden release builds, promotion, and terminal coverage - #745

Merged
mergify[bot] merged 2 commits into
matrixorigin:mainfrom
loveRhythm1990:fix/release-apt-source-isolation
Sep 10, 2026
Merged

mergify[bot] merged 2 commits into
matrixorigin:mainfrom
loveRhythm1990:fix/release-apt-source-isolation

Conversation

@loveRhythm1990

Copy link
Copy Markdown
Collaborator

Summary

Fix the related CI/release issues in one branch:

  • Make patched path dependencies available throughout the root Docker build. Add a shared dependency-inputs stage that both CI and the real builder use: hydrate the cargo-chef skeleton, then run full locked dependency resolution. Planner-only/no-deps checks did not catch missing builder inputs.
  • Run Docker validation and lint in parallel while preserving the existing required check as their fail-closed aggregate.
  • Include seven previously omitted workspace packages in the offline test shards. Add locked standalone crossterm unit tests and separate real Astra CLI PTY tests for default and use-dev-tty readers on Linux/macOS. Commit the vendor test lockfile and explicitly route vendor changes to Rust scopes.
  • Prevent recovery of older stable releases from moving GitHub latest or rolling Docker aliases backward. Unknown published tags warn and freeze both mutable aliases, without blocking verified fixed-version publication; inventory transport/schema failures remain fatal.
  • Isolate release musl installation to Ubuntu package sources, matching the existing mold setup, without suppressing Ubuntu update or installation failures.

Related issue

No separate issue linked. This follows the CI/release review and the failed release build investigation in this Actions run.

Change type

  • Feature
  • Bug fix
  • Documentation
  • Refactor or performance improvement
  • Test
  • Build, CI, or maintenance

User and compatibility impact

No application API, database schema, model behavior, or authentication changes.
Release recovery can publish an older fixed version without downgrading newer aliases. An unrecognized published stable tag disables GitHub latest and both Docker rolling aliases until the inventory is corrected, but no longer strands an otherwise verified fixed-version release in draft.
PRs changing Rust inputs now have a Docker dependency-resolution gate; lint does not wait for that build. Terminal reader regressions are exercised on both Unix backends, and the standalone vendor test dependencies are locked.

Architecture and complexity delta

N/A for runtime architecture; only build/test/publication owners change.

  • Canonical owner changed or extended: root Dockerfile, existing unified release workflow, and existing CI scope classifier/test workflow.
  • Existing implementations and callers searched: release/IDC Docker consumers, cargo-chef prepare/cook behavior, release publication/promotion steps, shared Rust setup, workspace shard assignments, and the vendored terminal's documented PTY commands.
  • Superseded code, states, tables, shims, or self-only tests removed: unconditional stable alias promotion and reliance on planner-only dependency validation. Vendor unit tests are explicitly distinguished from real-reader PTY coverage.
  • If parallel implementations remain, their boundary and retirement condition: none added for application behavior. CI validates the same Docker input stage inherited by the production builder.

Verification

Commands and results (local macOS ARM):

  • python3 -m unittest discover -s scripts/ci -p 'test_*.py': 76 passed.
  • python3 scripts/ci/validate_repository.py: passed.
  • actionlint: passed.
  • git diff --check: passed.
  • cargo test --locked -p astra-cli --lib tui::terminal_startup -- --test-threads=2: 14 passed.
  • cargo test --locked -p astra-cli --lib --features crossterm/use-dev-tty tui::terminal_startup -- --test-threads=2: 14 passed.
  • cargo test --locked --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream: 105 passed, 7 ignored.
  • cargo test --locked --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream,use-dev-tty: 105 passed, 7 ignored.
  • docker build --target dependency-inputs --progress plain .: passed, including a repeat build with cache hits. This is the native ARM dependency stage, not a full server-image build.
  • In an isolated container from that stage, full offline locked metadata succeeded with vendor present and failed as expected after moving crossterm out of its declared path. No host files were removed.

Public entrypoints exercised: actual Docker dependency-stage build, actual workflow shell steps under deterministic command stubs, and real CLI terminal startup through PTYs.

Unhappy paths: arbitrary missing patched dependencies both inside and outside vendor; aggregate gate failure/cancellation/skips; paginated/unknown/malformed release inventories; older and same-version release recovery; Ubuntu source fallback, missing sources, update failures, and installation failures.

Database verification: not applicable; no database changes.

Validation limits: full Rust suites, Linux PTY execution, full AMD64/ARM64 application-image compilation, hosted-runner apt behavior, and live release publication were not run locally. Linux/macOS PTY lanes are configured in this PR; full image build/smoke checks remain release/IDC gates. Both local CLI builds emitted the macOS linker __eh_frame size warning but all selected tests passed. No production services or release tags were modified during validation.

Final checklist

  • I added or updated tests at the layer that owns the behavior, or explained why no test is needed.
  • I updated public or design documentation for contract changes, or the change needs no documentation update.
  • I checked the diff for credentials, private URLs, customer data, generated files, and other sensitive information. The standalone vendor Cargo.lock is intentionally included; build outputs are excluded.
  • The PR title follows the repository's Conventional Commit format.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed commit 276f18c. No blocking defects found in the changed implementation.

The Docker check validates the dependency-inputs stage inherited by the production builder, including full locked dependency resolution rather than only planner metadata. The existing required check aggregates applicable lint and Docker results fail-closed. Workspace shard coverage and explicit vendor scoping address the omitted build inputs without adding a separate production build definition.

For publication, I traced normal publication, draft recovery, and already-published recovery through the existing globally serialized workflow. Numeric version comparison independently protects latest and the minor line; pagination/schema/transport failures produce no promotion outputs, while unknown stable tags freeze both mutable aliases. GitHub publication precedes Docker promotion, preserving the release inventory as the workflow's high-water mark.

The test additions exercise actual workflow shell bodies for alias selection, aggregate failures/cancellations/skips, and apt source/update/install failures. The separate terminal invocations select both readers, and the existing PTY entrypoints cover malformed/late responses, input preservation, timeout fallback, and interrupt/terminal restoration rather than only parser units.

Validation: I ran all 77 Python CI tests: 76 passed; one test's three dependency-resolution subcases could not execute because Cargo is absent in this environment. git diff --check passed. Independently observed on this head in GitHub Actions: Docker dependency validation, repository validation, actionlint, CI contracts, and both Linux/macOS vendored-terminal jobs passed. The PTY jobs, main Rust suites, and remaining static checks were still running at the last check. I did not locally execute Rust/PTY tests, full application-image builds, hosted apt installation, or live release publication. This approval does not imply those pending gates have passed.

Rechecked the PR head and review history immediately before submitting; the reviewed SHA is unchanged.

@mergify mergify Bot added the queued label Sep 10, 2026
@mergify

mergify Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-10 03:21 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-10 03:22 UTC · at e86f9bb3140fde1c208b0101e1506bee9be8a36b · squash

This pull request spent 25 seconds in the queue, including 3 seconds running CI.

Required conditions to merge
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = Check PR title
    • check-neutral = Check PR title
    • check-skipped = Check PR title
  • any of [🛡 GitHub branch protection]:
    • check-success = check
    • check-neutral = check
    • check-skipped = check
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: core crates + bridge hooks
    • check-neutral = Test: core crates + bridge hooks
    • check-skipped = Test: core crates + bridge hooks
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-runtime
    • check-neutral = Test: astra-runtime
    • check-skipped = Test: astra-runtime
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-cli (edge-fs-tools)
    • check-neutral = Test: astra-cli (edge-fs-tools)
    • check-skipped = Test: astra-cli (edge-fs-tools)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-cli (edge-git-gix)
    • check-neutral = Test: astra-cli (edge-git-gix)
    • check-skipped = Test: astra-cli (edge-git-gix)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-cli (edge-rest)
    • check-neutral = Test: astra-cli (edge-rest)
    • check-skipped = Test: astra-cli (edge-rest)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-cli (edge-shell)
    • check-neutral = Test: astra-cli (edge-shell)
    • check-skipped = Test: astra-cli (edge-shell)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: astra-cli (non-edge)
    • check-neutral = Test: astra-cli (non-edge)
    • check-skipped = Test: astra-cli (non-edge)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: online (core)
    • check-neutral = Test: online (core)
    • check-skipped = Test: online (core)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: online (integration)
    • check-neutral = Test: online (integration)
    • check-skipped = Test: online (integration)
  • any of [🛡 GitHub branch protection]:
    • check-success = Test: turn-core + services + plan
    • check-neutral = Test: turn-core + services + plan
    • check-skipped = Test: turn-core + services + plan
  • any of [🛡 GitHub branch protection]:
    • check-success = web (typecheck, test, build)
    • check-neutral = web (typecheck, test, build)
    • check-skipped = web (typecheck, test, build)
  • any of [🛡 GitHub branch protection]:
    • check-success = Astra SDK (typecheck, test+coverage, build)
    • check-neutral = Astra SDK (typecheck, test+coverage, build)
    • check-skipped = Astra SDK (typecheck, test+coverage, build)

@mergify
mergify Bot merged commit e86f9bb into matrixorigin:main Sep 10, 2026
25 of 27 checks passed
@mergify mergify Bot removed the queued label Sep 10, 2026
mergify Bot pushed a commit that referenced this pull request Sep 10, 2026
#746)

## Summary

Stabilize the fragmented-response PTY fixture and add useful failure diagnostics after the macOS terminal PTY lane failed on main.

- Replace one write/sleep per byte with four deliberate chunks, splitting the opening ESC, ST terminator, and RGB payload. Pace them against absolute offsets instead of accumulating relative sleep overshoot.
- Keep the real 300 ms startup deadline, parser deadlines, expected light/dark result, input-preservation checks, and terminal-restoration checks unchanged. No retries or ignored tests are added.
- Include parent query-observation, response-write, DA1-write, and readiness timestamps in test failure output, alongside the child's startup duration and decoded colors/theme/events.
- Add a parser unit test that feeds foreground and background replies byte by byte without sleeps, complementing the existing every-split-boundary test. PTY writes can be coalesced by the OS, so exact bytewise parsing coverage belongs in the parser tests.
- Document the fixture and timing fields in the vendor patch notes.

## Related issue

Follow-up to #745 and [the failing macOS PTY job](https://github.com/matrixorigin/Astra/actions/runs/34433056760/job/102732449999).

That run passed every other job, including Linux PTY and the previously repaired Docker layout contract. The failure was `pty_detects_light_dark_and_fragmented_responses`: the `fragmented` case expected light mode but received dark mode. Accumulated sender scheduling delays are a plausible cause, not proven by the old logs, which did not include timing or the complete probe result. Thirty local repetitions of the old fixture did not reproduce the failure. This change removes the avoidable accumulated-sleep dependency and adds evidence for any remaining failures; it does not claim to have conclusively reproduced the runner's original timing.

## Change type

- [ ] Feature
- [x] Bug fix
- [x] Documentation
- [ ] Refactor or performance improvement
- [x] Test
- [x] Build, CI, or maintenance

## User and compatibility impact

None for application behavior, APIs, credentials, or database schemas. Only test fixtures, test diagnostics, a parser unit test, and patch documentation change. Product timeouts and terminal parsing behavior remain unchanged. Diagnostics contain synthetic test-terminal data, not user terminal content.

## Architecture and complexity delta

N/A for production architecture.

- Canonical owner changed or extended: existing CLI terminal-startup PTY harness and vendored Unix parser tests.
- Existing implementations and callers searched: `StartupTerminal::begin`, `query_startup_attributes`, parser escape/response deadlines, PTY sender and assertions, and both CI reader invocations.
- Superseded code, states, tables, shims, or self-only tests removed: per-byte relative sleeps in the end-to-end sender; no product implementation removed.
- If parallel implementations remain, their boundary and retirement condition: none. Unit tests force exact parser fragmentation; PTY tests exercise the real startup/reader/terminal lifecycle.

## Verification

Commands and results on local macOS ARM:

- `cargo test --locked -p astra-cli --lib tui::terminal_startup -- --test-threads=2`: **14 passed**.
- `cargo test --locked -p astra-cli --lib --features crossterm/use-dev-tty tui::terminal_startup -- --test-threads=2`: **14 passed**.
- Repeated `tui::terminal_startup::pty_tests::pty_detects_light_dark_and_fragmented_responses` directly from each freshly built test executable: **50 runs per reader**, two concurrent processes, **zero failures**, with no retries. Each run covers light, fragmented, background-only, and dark cases.
- `cargo test --locked --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream`: **106 passed, 7 ignored**.
- `cargo test --locked --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream,use-dev-tty`: **106 passed, 7 ignored**.
- `python3 -m unittest discover -s scripts/ci -p 'test_*.py'`: **77 passed**.
- `python3 scripts/ci/validate_repository.py`: **passed**.
- `cargo fmt --all --check`: **passed**.
- `rustfmt --check --edition 2021 vendor/crossterm/src/event/source/unix/parser.rs`: **passed**.
- `git diff --check`: **passed**.

Public entrypoint exercised: real CLI startup, terminal guard, event reader, and EventStream through isolated PTYs; no model or service required.

Unhappy paths exercised: existing unsupported/late/malformed responses, timeouts, interrupted startup/handoff, escape/input preservation, and terminal-mode restoration tests remain enabled and passed for both readers.

Database verification: not applicable.

Limits: the original GitHub macOS failure was not reproduced locally; hosted macOS/Linux verification remains for CI. Full workspace Rust suites and release images were not rebuilt for this test-only change. The local CLI links emitted the existing `__eh_frame` size warning; selected tests passed.

## Final checklist

- [x] I added or updated tests at the layer that owns the behavior, or explained why no test is needed.
- [x] I updated public or design documentation for contract changes, or the change needs no documentation update.
- [x] I checked the diff for credentials, private URLs, customer data, generated files, and other sensitive information.
- [x] The PR title follows the repository's Conventional Commit format.


Approved-by: XuPeng-SH <[email protected]>
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.

2 participants