Skip to content

fix(update-system): include all language modes and current system scripts#366

Open
FReptar0 wants to merge 1 commit intosantifer:mainfrom
FReptar0:fix/system-paths-missing-modes-scripts
Open

fix(update-system): include all language modes and current system scripts#366
FReptar0 wants to merge 1 commit intosantifer:mainfrom
FReptar0:fix/system-paths-missing-modes-scripts

Conversation

@FReptar0
Copy link
Copy Markdown
Contributor

@FReptar0 FReptar0 commented Apr 18, 2026

Summary

Fixes #337.

`update-system.mjs` hardcodes the set of paths it refreshes from upstream. The list had drifted from the actual repo:

Missing language-mode directories:

  • `modes/fr/`, `modes/ja/`, `modes/pt/`, `modes/ru/` (only `modes/de/` was listed)

Missing system-layer scripts:

  • `scan.mjs`, `doctor.mjs`, `check-liveness.mjs`, `liveness-core.mjs`, `analyze-patterns.mjs`, `followup-cadence.mjs`, `test-all.mjs`

As a result, users running `/career-ops update` (or `node update-system.mjs apply`) saw a "✅ Updated" confirmation while large parts of the system layer silently drifted behind upstream.

Fix

Add every missing language-mode directory and system script to `SYSTEM_PATHS`. Minimum-scope fix that matches the issue description ("at minimum, it should include..."). No refactor to a generated manifest in this PR — that would be a separate discussion.

1 file changed, 11 insertions.

Safety

None of the 11 new entries overlap with `USER_PATHS`:

```js
const USER_PATHS = [
'cv.md', 'config/profile.yml', 'modes/_profile.md',
'portals.yml', 'article-digest.md',
'interview-prep/story-bank.md',
'data/', 'reports/', 'output/', 'jds/',
];
```

The existing safety-violation check in `apply()` is therefore unaffected.

Test plan

  • `node test-all.mjs --quick` passes (61/0 locally)
  • `node update-system.mjs check` still returns a valid JSON status
  • On the next release, users on older installs see `modes/{fr,ja,pt,ru}/` and the 7 added scripts actually update

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Expanded system update and rollback scope to include additional localized mode resources, a new Gemini-specific command area, supplementary system utilities and scripts, and an added root system document—providing broader coverage for checkout, staging, and restoration to improve maintenance and recovery reliability.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

📝 Walkthrough

Walkthrough

Expanded the SYSTEM_PATHS whitelist in update-system.mjs to include additional language mode directories, new root-level utility scripts, a Gemini-specific commands directory, and a couple of new mode/root docs so they are eligible for apply()/rollback() staging and restoration.

Changes

Cohort / File(s) Summary
System Paths update
update-system.mjs
Added new system-path entries for: localized modes modes/fr/, modes/ja/, modes/pt/, modes/ru/; modes/latex.md; root utility scripts scan.mjs, doctor.mjs, check-liveness.mjs, liveness-core.mjs, analyze-patterns.mjs, followup-cadence.mjs, test-all.mjs, generate-latex.mjs, gemini-eval.mjs; root doc GEMINI.md; and Gemini commands directory .gemini/commands/. No other control flow or validation logic changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating SYSTEM_PATHS to include language modes and system scripts.
Linked Issues check ✅ Passed The PR fully addresses issue #337 by adding all missing language-mode directories (modes/fr/, modes/ja/, modes/pt/, modes/ru/) and system scripts (scan.mjs, doctor.mjs, check-liveness.mjs, liveness-core.mjs, analyze-patterns.mjs, followup-cadence.mjs, test-all.mjs) to SYSTEM_PATHS.
Out of Scope Changes check ✅ Passed All changes are limited to expanding the SYSTEM_PATHS whitelist in update-system.mjs, directly addressing the incomplete SYSTEM_PATHS issue without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
update-system.mjs (1)

48-67: ⚠️ Potential issue | 🟠 Major

Make rollback delete paths that did not exist in the backup branch.

These newly tracked modes/scripts can be introduced by apply() on older installs, but rollback() currently swallows checkout failures when a path was absent from the backup branch. That leaves update-added files/directories behind instead of restoring the backup state.

🐛 Proposed rollback fix
     // Checkout system files from backup branch
+    const pathsToStage = [];
     for (const path of SYSTEM_PATHS) {
       try {
         git('checkout', latest, '--', path);
-      } catch {
-        // File may not have existed in backup
+        pathsToStage.push(path);
+      } catch (err) {
+        const pathspec = path.endsWith('/') ? path.slice(0, -1) : path;
+        let existedInBackup = true;
+        try {
+          git('cat-file', '-e', `${latest}:${pathspec}`);
+        } catch {
+          existedInBackup = false;
+        }
+
+        if (existedInBackup) throw err;
+
+        // Path did not exist in backup; remove the update-added path.
+        git('rm', '-r', '-f', '--ignore-unmatch', '--', pathspec);
       }
     }
 
-    addPaths(SYSTEM_PATHS);
+    addPaths(pathsToStage);

Also applies to: 302-310

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@update-system.mjs` around lines 48 - 67, rollback() currently swallows
failures when checking out paths from the backup branch, leaving files/dirs
introduced by apply() behind; update rollback() so that when the git checkout
(or equivalent checkoutPath) for a given path fails because the path does not
exist in the backup branch, you delete that local path instead (use
fs.promises.rm / recursive delete) and still treat other errors as real
failures; apply the same behavior to the block referenced around lines 302-310.
Locate the rollback() function and the path-checkout logic (and any variable
like paths, checkoutPath, or the loop that iterates over the file list) and add
explicit handling: on checkout error detect "path not found" and remove the
path, otherwise rethrow/log the error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@update-system.mjs`:
- Around line 48-67: rollback() currently swallows failures when checking out
paths from the backup branch, leaving files/dirs introduced by apply() behind;
update rollback() so that when the git checkout (or equivalent checkoutPath) for
a given path fails because the path does not exist in the backup branch, you
delete that local path instead (use fs.promises.rm / recursive delete) and still
treat other errors as real failures; apply the same behavior to the block
referenced around lines 302-310. Locate the rollback() function and the
path-checkout logic (and any variable like paths, checkoutPath, or the loop that
iterates over the file list) and add explicit handling: on checkout error detect
"path not found" and remove the path, otherwise rethrow/log the error.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 02f6e3a7-f19a-4201-bf82-8bf968a3007c

📥 Commits

Reviewing files that changed from the base of the PR and between 10c496c and 22fb9bb.

📒 Files selected for processing (1)
  • update-system.mjs

update-system.mjs hardcodes the set of paths it refreshes from
upstream. The list had fallen behind the repo in several ways:

Missing language-mode directories:
- Only `modes/de/` was listed. `modes/fr/`, `modes/ja/`, `modes/pt/`,
  `modes/ru/` existed in the tree but were silently skipped.

Missing system-layer scripts at repo root:
- scan.mjs, doctor.mjs, check-liveness.mjs, liveness-core.mjs,
  analyze-patterns.mjs, followup-cadence.mjs, test-all.mjs.

Missing recently-merged system files:
- modes/latex.md (santifer#362)
- generate-latex.mjs (santifer#362)
- gemini-eval.mjs (santifer#349)
- GEMINI.md (santifer#349)
- .gemini/commands/ (santifer#349)

As a result, users running `/career-ops update` (or `node
update-system.mjs apply`) would believe they were fully up to date
while large parts of the system layer drifted silently — especially
after the recent LaTeX and Gemini CLI additions.

Add every missing entry to SYSTEM_PATHS. None of the new entries
overlap with USER_PATHS, so the existing safety check is unaffected.

Fixes santifer#337
@FReptar0 FReptar0 force-pushed the fix/system-paths-missing-modes-scripts branch from 22fb9bb to 1b8cb81 Compare April 20, 2026 19:14
@FReptar0
Copy link
Copy Markdown
Contributor Author

Re: CodeRabbit's rollback finding — valid point, but intentionally out of scope for this PR.

The rollback() behavior of swallowing checkout failures is a pre-existing bug that dates to the original update-system.mjs design, not something introduced here. Adding more paths to SYSTEM_PATHS surfaces the bug more often (paths that didn't exist in a backup branch now accumulate), but the fix belongs in its own PR: it changes rollback semantics, touches an error path, and deserves its own test coverage.

Happy to open a follow-up PR addressing #337's sibling issue — let me know if you'd prefer it bundled here instead.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@update-system.mjs`:
- Around line 47-78: The PR adds many paths to the hard-coded SYSTEM_PATHS array
but the long-term fix is to derive SYSTEM_PATHS from a single source of truth to
avoid drift; update update-system.mjs to generate SYSTEM_PATHS at runtime (or at
build) by reading a committed manifest (e.g., system-manifest.json) or running a
filtered git ls-tree and excluding USER_PATHS, then have apply() and rollback()
consume that generated list instead of the hand-maintained array; ensure
functions that reference SYSTEM_PATHS (apply(), rollback(), any validation
logic) still receive the same shape (array of paths) and add fallback behavior
to preserve current hard-coded entries if the manifest/git scan fails.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a8d08c60-deca-46b1-998c-0108f8ef15ec

📥 Commits

Reviewing files that changed from the base of the PR and between 22fb9bb and 1b8cb81.

📒 Files selected for processing (1)
  • update-system.mjs

Comment thread update-system.mjs
Comment on lines +47 to +78
'modes/latex.md',
'modes/de/',
'modes/fr/',
'modes/ja/',
'modes/pt/',
'modes/ru/',
'CLAUDE.md',
'AGENTS.md',
'GEMINI.md',
'generate-pdf.mjs',
'generate-latex.mjs',
'merge-tracker.mjs',
'verify-pipeline.mjs',
'dedup-tracker.mjs',
'normalize-statuses.mjs',
'cv-sync-check.mjs',
'update-system.mjs',
'scan.mjs',
'doctor.mjs',
'check-liveness.mjs',
'liveness-core.mjs',
'analyze-patterns.mjs',
'followup-cadence.mjs',
'gemini-eval.mjs',
'test-all.mjs',
'batch/batch-prompt.md',
'batch/batch-runner.sh',
'dashboard/',
'templates/',
'fonts/',
'.claude/skills/',
'.gemini/commands/',
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -u
paths=(
  "modes/latex.md"
  "modes/fr" "modes/ja" "modes/pt" "modes/ru"
  "GEMINI.md"
  "generate-latex.mjs" "scan.mjs" "doctor.mjs"
  "check-liveness.mjs" "liveness-core.mjs"
  "analyze-patterns.mjs" "followup-cadence.mjs"
  "gemini-eval.mjs" "test-all.mjs"
  ".gemini/commands"
)
for p in "${paths[@]}"; do
  if [ -e "$p" ]; then
    echo "OK      $p"
  else
    echo "MISSING $p"
  fi
done

Repository: santifer/career-ops

Length of output: 415


Additions look correct; consider eliminating drift by deriving SYSTEM_PATHS from a manifest.

All newly added entries are system-layer paths with no overlap with USER_PATHS, so the safety check in apply() is unaffected and the additions are safe. All entries have been verified to exist on the repository. However, this PR only closes the current gap — the root cause called out in issue #337 (hand-maintained list drifts from what's actually checked in) remains. A follow-up that generates SYSTEM_PATHS from a single source of truth (e.g., a committed system-manifest.json, or a git ls-tree filtered by a USER_PATHS blocklist) would prevent the next round of missing files (e.g., future modes/<lang>/ directories or new root scripts) from silently being skipped by apply()/rollback().

Per the coding guidelines, script files like update-system.mjs are auto-updatable system files with no user-specific content — the added entries correctly belong in the system allowlist.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@update-system.mjs` around lines 47 - 78, The PR adds many paths to the
hard-coded SYSTEM_PATHS array but the long-term fix is to derive SYSTEM_PATHS
from a single source of truth to avoid drift; update update-system.mjs to
generate SYSTEM_PATHS at runtime (or at build) by reading a committed manifest
(e.g., system-manifest.json) or running a filtered git ls-tree and excluding
USER_PATHS, then have apply() and rollback() consume that generated list instead
of the hand-maintained array; ensure functions that reference SYSTEM_PATHS
(apply(), rollback(), any validation logic) still receive the same shape (array
of paths) and add fallback behavior to preserve current hard-coded entries if
the manifest/git scan fails.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-updater SYSTEM_PATHS is incomplete and skips language modes and newer scripts

1 participant