Skip to content

fix(tags): report a tags.yaml that cannot be read instead of a missing one - #2061

Merged
jeff-r2026 merged 1 commit into
Tencent:mainfrom
Kiko0301:fix/tags-list-unreadable
Nov 27, 2026
Merged

jeff-r2026 merged 1 commit into
Tencent:mainfrom
Kiko0301:fix/tags-list-unreadable

Conversation

@Kiko0301

Copy link
Copy Markdown
Contributor

Summary

Fixes #2056 (the tags list half of #2046).

tagsList saw a null from loadTagsConfig and printed No tags.yaml found in team repo. Tags are not configured yet. — but that function returns null both for a missing file and for one that does not parse. A team with a broken tags.yaml was therefore told it had no tags, after the loader had printed the parse error, and the command exited 0. It now names the file and exits 1; only a missing file keeps the "not configured yet" message.

Changes

  • src/tags.ts: tagsList checks pathExists(<repo>/tags.yaml) when the load returns null; an existing file that did not load is reported with log.error(...) and process.exitCode = 1.
  • src/__tests__/tags-cmd.test.ts: new case in the existing tags list describe block (malformed tags.yaml → error naming the file, no "No tags.yaml found" line, exit 1); the block now resets process.exitCode around each test.

Testing

Failing first on main (6911c22):

$ npx vitest run src/__tests__/tags-cmd.test.ts -t "cannot read"
AssertionError: expected "vi.fn()" to be called with arguments: StringContaining "could not be read"
 Tests  1 failed | 10 skipped (11)

After the fix:

$ npx vitest run src/__tests__/tags-cmd.test.ts src/__tests__/tags.test.ts
 Test Files  2 passed (2)
      Tests  25 passed (25)
$ npx tsc --noEmit        # exit 0
$ npx oxlint --type-aware --deny-warnings --report-unused-disable-directives src/tags.ts src/__tests__/tags-cmd.test.ts   # exit 0

Real CLI

npm run verify:world is not supported on this Windows host, so I ran the built dist/index.js from an empty temp project under an isolated HOME with env -i. Windows 11 build 26100, Node v22.19.0.

Before (built from 6911c22):

$ teamai tags list              # team/tags.yaml = 'skills: [unclosed'
⚠ Failed to parse tags.yaml: Flow sequence in block collection must be sufficiently indented and end with a ] at line 2, column 1:
...
ℹ No tags.yaml found in team repo. Tags are not configured yet.
exit=0

After:

$ teamai tags list
⚠ Failed to parse tags.yaml: ...
✖ tags.yaml in C:/.../team could not be read. Fix it in the team repo, then run the command again.
exit=1

A team repo with no tags.yaml still prints the old message and exits 0.

Surfaces

  • Scopes: tagsList resolves the scope before reading (resolveTagsScope), so user and project scope behave the same; the real-CLI record uses user scope.
  • Team repo modes: the check is on the local checkout's tags.yaml in every mode; no provider path is involved.
  • Reverse states: a missing file and a readable file both keep their current output; only an existing unreadable file changes.
  • Entry points: the tags list command (and tags with no subcommand); no workflow step lists tags.
  • Docs and skill-data/: usage and flags are unchanged, so no doc edit.
  • OS: the new test is plain temp-file code and runs on Windows CI too; npm run lint and check-docs fail on this host only for pre-existing Windows defects (fix(lint): resolve the plugin's rule scopes with / on every platform #1967 CRLF, fix(lint): ignore CRLF in shipped driver comparisons #1942), so lint was run on the two changed files.

@jeff-r2026 jeff-r2026 self-assigned this Nov 25, 2026
@github-actions

Copy link
Copy Markdown

No confident findings in the specified diff.

The PR description includes failing-first evidence, passing unit tests, type checking, targeted lint, and a representative isolated real-CLI run showing exit 1 for malformed tags.yaml and unchanged behavior for a missing file. The testing record is sufficient; the unsupported Windows verify-world tooling is explicitly disclosed.

Review was read-only; no PR code was run, built, or installed.

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Blocked for now, with a precise reason: #2047 just merged, and it adds the same two imports to src/tags.ts that this branch adds (import path from 'node:path' and import { pathExists } from './utils/fs.js'). On top of the new main, merging this PR as-is duplicates them and tsc fails with TS2300 (duplicate identifier pathExists, src/tags.ts:11/:14) — verified on a stacked tree of latest main + both PRs.

A rebase that drops this branch's duplicate import lines resolves it. The tagsList change itself verified clean alongside #2047: on the stacked tree the tags-cmd suite passed and only the duplicate imports failed typecheck. After the rebase this should be a quick merge.

…g one

tags list read a null load as a missing file, so a tags.yaml that does
not parse was reported as 'not configured yet' with exit 0, after the
loader had printed the parse error. It now names the file and exits 1;
only a missing file keeps the 'not configured yet' message.

Refs Tencent#2046
@Kiko0301
Kiko0301 force-pushed the fix/tags-list-unreadable branch from 823e39c to 79a5284 Compare November 26, 2026 02:35
@Kiko0301

Copy link
Copy Markdown
Contributor Author

Rebased onto main (da482cb) and dropped the duplicate path / pathExists imports this branch carried, which #2047 now provides.

Verified on the rebased tree:

$ npx tsc --noEmit        # exit 0
$ npx vitest run src/__tests__/tags-cmd.test.ts
 Test Files  1 passed (1)
      Tests  18 passed (18)

The tagsList change is unchanged: a tags.yaml that exists but does not parse is reported as unreadable with exit 1, while a missing file still says tags are not configured.

@github-actions

Copy link
Copy Markdown

No confident findings in the specified diff.

The PR description documents failing-first evidence, passing unit tests, type checking, targeted lint, and a representative isolated real-CLI run confirming malformed tags.yaml exits 1 while a missing file retains the existing behavior. The testing record is sufficient; the Windows verify-world limitation is explicitly disclosed.

The earlier review reported no findings, so none require resolution.

Review was read-only; no PR code was run, built, or installed.

@jeff-r2026 jeff-r2026 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.

Verified on Linux (Node 20), stacked on main da482cb together with the other PRs merged in this pass: typecheck, build, lint, the targeted unit suites and the affected E2E files pass. The only failing CI jobs are the two fork-safe E2E jobs that fail on main itself (fixed in #2114).

@jeff-r2026
jeff-r2026 merged commit 504289e into Tencent:main Nov 27, 2026
18 of 20 checks passed
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.

[bug] tags list reports an unreadable tags.yaml as a missing one and exits 0

2 participants