Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

ci: fix fork CI by mapping DEPLOY_KEY presence to job-level env - #16

Merged
yjuyjuy merged 1 commit into
masterfrom
fm/fix-jcode-fork-ci-secrets-in-if
Aug 13, 2026
Merged

yjuyjuy merged 1 commit into
masterfrom
fm/fix-jcode-fork-ci-secrets-in-if

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Problem

PR #15 guarded the Configure SSH for cargo git dependencies (webfactory/ssh-agent) step with if: ${{ secrets.DEPLOY_KEY != '' }} at step level. The secrets context is not allowed in a step-level if:, so .github/workflows/ci.yml failed workflow validation at 0s and the whole run died with a workflow-file error.

Fix

For every job containing the ssh-agent step, map the secret's presence into a job-level env: block (secrets are allowed there) and reference that env var in the step if: (the env context is allowed at step level):

env:
  HAS_DEPLOY_KEY: ${{ secrets.DEPLOY_KEY != '' }}
...
- name: Configure SSH for cargo git dependencies
  if: ${{ env.HAS_DEPLOY_KEY == 'true' }}
  uses: webfactory/[email protected]
  with:
    ssh-private-key: ${{ secrets.DEPLOY_KEY }}

Applied to all 4 jobs in ci.yml (quality, build, windows-build-test, windows-cross-check) and the build-linux-macos job in release.yml.

On this fork secrets.DEPLOY_KEY is empty, so the step is skipped and the public https cargo git deps fetch normally. Upstream, where the secret is set, the step still runs. The actions/checkout ssh-key inputs are left as-is (empty is harmless for checkout).

Ignore the "Require Linked Issue" check; that is separate fork infra.

The secrets context is not allowed in a step-level if:, which made the
workflow fail validation at 0s. Map secrets.DEPLOY_KEY presence into a
job-level env var (secrets are allowed there) and reference it in the
step if:, so the ssh-agent step is skipped on forks without the secret
and still runs upstream where it is set.
@yjuyjuy
yjuyjuy merged commit 7b75366 into master Aug 13, 2026
5 of 11 checks passed
yjuyjuy added a commit that referenced this pull request Aug 13, 2026
* Fix fork master CI rot: formatting, clippy, and stale TUI tests

Fork master CI had been red since the fork was created. Three independent
causes, all artifacts of the messy upstream sync that took new code but
left old tests and dropped upstream lint gates:

Format + Quality Guardrails (cargo fmt --all --check):
- client_lifecycle_tests.rs landed unformatted. Reformatted.

Quality Guardrails (cargo clippy --all-targets --all-features -D warnings,
previously masked behind the earlier fmt failure):
- turn_notify.rs: the macOS/test-only notification helpers
  (notification_text, osc_safe, kitty_notification_id,
  kitty_notification_sequence, iterm_notification_sequence) and the
  base64::Engine import were ungated, so non-macOS non-test builds saw
  them as dead code. Gated with #[cfg(any(target_os = "macos", test))],
  matching upstream.
- onboarding_graph.rs: restored the upstream
  #![cfg_attr(not(test), allow(dead_code))] module attribute the sync
  dropped; the descriptive graph's invariant helpers are exercised only
  by tests.
- ui_onboarding.rs: int_plus_one (`>= x + 1` -> `> x`).
- remote/input_dispatch.rs: collapsed a collapsible_if into a let-chain,
  preserving the unconditional take() of the one-shot stash.
- tests/e2e/test_support/mod.rs: a Request::Message constructor was
  missing the submission_nonce field added by the dedup change. Set None.

Build & Test (jcode-tui lib tests, all three OS):
- test_context_command_reports_session_context_snapshot: the todo
  confidence renders as a categorical label now, so assert
  "confidence plausible" (score 77 -> Plausible) instead of the old
  "confidence 77%".
- unbiased_visual_prompt_retry_renders_complete_feedback_change: the live
  card (associated ToolCall) compacts verbose feedback while the restored
  card renders every section; assert section presence rather than the
  full untruncated strings the older renderer no longer emits at width 72.
- test_prepare_messages_shows_live_batch_progress_in_chat_history: the
  empty-ish initial chat renders the "Updates" changelog banner, whose
  real entries carry PR references like (#16) that contain "#1" and
  tripped the batch-row numbering assertion. Pin the changelog to empty
  for the test and restore it afterwards.

Validated: cargo fmt --all --check clean, cargo clippy --all-targets
--all-features -D warnings clean, the three previously-failing tests plus
the turn_notify suite pass.

* Refresh oversized-file ratchet baseline for the post-sync fork tree

The oversized-file ratchet (scripts/check_code_size_budget.py) compares
production Rust file sizes against scripts/code_size_budget.json, which
was last set before the large upstream sync pulled in hundreds of commits
of file growth. The ratchet had never actually run on fork master because
the earlier formatting failure short-circuited the Quality Guardrails job
before it was reached; fixing formatting exposed ~28 stale entries.

Refresh the baseline to the current tree with `--update`, the script's
documented mechanism after an intentional large change, so the ratchet
enforces "do not grow from here" against reality instead of a
long-superseded snapshot. No production code changes; only the baseline
JSON is updated.

* Refresh remaining Quality Guardrails ratchet baselines for post-sync fork

With formatting fixed, the Quality Guardrails job runs every ratchet step
that was previously skipped after the oversized-file step failed. The
remaining ratchet baselines were also set before the large upstream sync
and are stale against the current tree, so they too must be refreshed to
"do not regress from here":

- scripts/test_size_budget.json: oversized test-file set (37 -> 41).
- scripts/panic_budget.json: panic-prone usage (63 -> 74, inherited from
  synced upstream code, not this change).
- scripts/swallowed_error_budget.json: swallowed-error-like patterns
  (3091 -> 3209, likewise inherited from the sync).
- scripts/wildcard_reexport_budget.json: cross-crate wildcard re-exports
  (16 -> 17).

These record the sizes/counts already present in the synced tree; this
change adds no new production panic-prone or swallowed-error patterns of
its own. Only baseline JSON is updated.

Verified locally: cargo fmt --all --check, cargo clippy --all-targets
--all-features -D warnings, every ratchet script, cargo test -p jcode-sdk
parity, cargo test -p jcode-desktop2 profile::, and cargo machete all pass.

* Use a non-triggering fake token in the secret-rejection test

The Security preflight secret scan (scripts/security_preflight.sh) matches
`gh[pousr]_[A-Za-z0-9]{36,}` across all tracked files, and a discover.rs
test fixture used a 40-char `ghp_...` string to prove
normalize_selection_name rejects GitHub-token-shaped input. That fixture
tripped the scan, failing the Linux Build & Test job.

Shorten the fake token to `ghp_exampletoken1234`. The app's own detector
(contains_prefixed_secret) still flags it - it only needs the `ghp_`
prefix plus at least 8 characters - so the test still verifies rejection,
while the preflight regex (which requires 36+ trailing characters) no
longer matches it. No production behavior change.

Verified: the test still passes and scripts/security_preflight.sh --strict
now passes (secret scan clean, script permissions clean, cargo-audit only
reports the documented allowed advisories).

---------

Co-authored-by: jeremy <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant