Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/ci_node16.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
macos-ci:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -29,9 +29,10 @@ jobs:
with:
go-version: 1.18
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: install s
run: |
npm i @serverless-devs/s -g
Expand All @@ -58,8 +59,8 @@ jobs:
windows-ci:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -71,9 +72,10 @@ jobs:
with:
go-version: 1.18
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: install s
run: |
npm i @serverless-devs/s -g
Expand Down Expand Up @@ -102,8 +104,8 @@ jobs:
linux-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -112,9 +114,10 @@ jobs:
with:
go-version: 1.18
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: install s
run: |
npm i @serverless-devs/s -g
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/ci_with_docker_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
docker-ci-standard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Upgrade docker/setup-buildx-action@v2 to @v4 — actionlint reports it as too old.

Actionlint flags this action version as incompatible with the current GitHub Actions runner. The latest version is docker/setup-buildx-action@v4, and this should be applied at both Line 16 (docker-ci-standard) and Line 73 (docker-ci-custom). This PR already upgraded the other action versions — docker/setup-buildx-action should follow suit.

🔧 Proposed fix (apply to both Line 16 and Line 73)
-      - uses: docker/setup-buildx-action@v2
+      - uses: docker/setup-buildx-action@v4
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v4
🧰 Tools
🪛 actionlint (1.7.12)

[error] 16-16: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci_with_docker_linux.yaml at line 16, The workflow uses an
outdated action version docker/setup-buildx-action@v2 (referenced in the
docker-ci-standard and docker-ci-custom jobs); update both occurrences to
docker/setup-buildx-action@v4 so actionlint no longer flags the runner
incompatibility and the workflow matches the other upgraded Docker actions.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

What is the latest stable version of docker/setup-buildx-action GitHub Action?

💡 Result:

The latest stable version of the GitHub Action docker/setup-buildx-action is v4.0.0 (published 2026-03-05). [1][2] This is reflected by the repository’s “Latest release” being v4.0.0 and the dedicated release tag for v4.0.0. [1][2] Practical usage (stable pin): uses: docker/setup-buildx-action@v4.0.0 (or @v4 to track the v4 major). [1][2]

Citations:


🏁 Script executed:

cat -n .github/workflows/ci_with_docker_linux.yaml | sed -n '14,18p; 71,75p'

Repository: devsapp/fc3

Length of output: 403


docker/setup-buildx-action@v2 is outdated and should be upgraded to v4.

Actionlint flags this action version as incompatible with the current GitHub Actions runner. The latest stable version is v4.0.0. Update both occurrences at line 16 and line 73 in the docker-ci workflow jobs.

🔧 Proposed fix
-      - uses: docker/setup-buildx-action@v2
+      - uses: docker/setup-buildx-action@v4

Apply the same change at line 73.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: docker/setup-buildx-action@v2
- uses: docker/setup-buildx-action@v4
🧰 Tools
🪛 actionlint (1.7.12)

[error] 16-16: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci_with_docker_linux.yaml at line 16, The workflow uses an
outdated action tag "docker/setup-buildx-action@v2"; replace both occurrences of
this action string in the CI workflow with the current stable tag
"docker/setup-buildx-action@v4" (or "v4.0.0") so the job definitions that
reference setup-buildx-action use the v4 release; locate the two occurrences of
"docker/setup-buildx-action@v2" in the file and update them to
"docker/setup-buildx-action@v4".

- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -23,9 +23,10 @@ jobs:
with:
go-version: 1.18
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: Install dependencies
run: |
sudo apt-get update
Expand Down Expand Up @@ -68,9 +69,9 @@ jobs:
docker-ci-custom:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 16
registry-url: https://registry.npmjs.org/
Expand All @@ -79,9 +80,10 @@ jobs:
with:
go-version: 1.18
- name: Set up Java
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 8
distribution: zulu
- name: Install dependencies
run: |
sudo apt-get update
Expand Down
79 changes: 79 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Claude Code Configuration

This file contains configuration information for Claude Code, an AI programming assistant.

## Project Overview

FC3 is the Serverless Devs component for Alibaba Cloud Function Compute 3.0, providing full lifecycle management for serverless functions. Written in TypeScript with modular architecture supporting create, develop, debug, deploy, and operate workflows.

**Tech Stack**: TypeScript 4.4, Jest, Vercel ncc, f2elint, Prettier

## Available Scripts

| Script | Description |
| ------------------------- | -------------------------- |
| `npm run build` | Production bundle with ncc |
| `npm run watch` | TypeScript watch mode |
| `npm test` | Jest tests with coverage |
| `npm run format` | Prettier formatting |
| `npm run lint` | f2elint scanning |
| `npm run fix` | Auto-fix lint issues |
| `npm run publish` | Build and registry publish |
| `npm run generate-schema` | Generate JSON schema |

## Key Directories

| Directory | Purpose |
| ------------------ | -------------------------------------------- |
| `src/` | Source code |
| `src/subCommands/` | CLI subcommands (deploy, build, local, etc.) |
| `src/resources/` | Cloud resources (FC, RAM, SLS, OSS, ACR) |
| `src/interface/` | TypeScript interfaces |
| `src/utils/` | Utility functions |
| `__tests__/ut/` | Unit tests |
| `__tests__/it/` | Integration tests |
| `docs/` | Documentation |

## Testing

**Current Status**: 986 tests total, 986 passing, 2 skipped (integration tests require cloud credentials)

**Run tests**: `npm test`
**Coverage**: Run with `--coverage` flag

## Architecture

Modular architecture with:

1. Main entry (`index.ts`) routing to subcommands
2. Base class (`base.ts`) with common preprocessing
3. Subcommand modules for operations
4. Resource modules for cloud service integration

See `docs/architecture.md` for detailed diagrams.

## Recent Features

- HTTP URL support for code/layer sources (v0.1.17)
- Layer publish HTTP bug fix (PR #147)
- FileManager remove operation upgrade support
- ProvisionConfig/ScalingConfig array handling
- LLM metrics in logConfig
- Logs command: multi-topic search (FCLogs + FCInstanceEvents) for --instance-id, SLS field-specific query syntax

## Development Workflow

1. Create branch from `master`
2. Run `npm run lint` and `npm run format`
3. Write/update tests
4. Build: `npm run build`
5. Test: `npm test`
6. Submit PR

## Documentation Index

| File | Purpose |
| ---------------------- | -------------------- |
| `docs/CONTRIB.md` | Development guide |
| `docs/RUNBOOK.md` | Operations runbook |
| `docs/architecture.md` | Architecture details |
81 changes: 80 additions & 1 deletion __tests__/ut/commands/logs_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,13 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
query: '',
search: '',
qualifier: '',
match: '',
requestId: '',
instanceId: '',
};
// Call the single iteration method
await this._realtimeOnce(params);
Expand Down Expand Up @@ -212,6 +215,8 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
functionName: 'test-function',
}),
);
});
Expand Down Expand Up @@ -244,8 +249,29 @@ describe('Logs', () => {
const props = await (logs as any).getInputs();

expect(props.topic).toBe('test-function');
expect(props.topicFilter).toBe('__topic__:"test-function"');
expect(props.query).toBe('LATEST');
});

it('should include FCInstanceEvents topic when instance-id is specified', async () => {
mockInputs.args = ['--instance-id', 'c-69f8a959-15f8e4fe-b867da209124'];
logs = new Logs(mockInputs);

const props = await (logs as any).getInputs();

expect(props.topicFilter).toBe(
'(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function")',
);
});

it('should not unset LATEST qualifier', async () => {
mockInputs.args = ['--qualifier', 'LATEST'];
logs = new Logs(mockInputs);

const props = await (logs as any).getInputs();

expect(props.qualifier).toBe('LATEST');
});
});

describe('getFunction', () => {
Expand Down Expand Up @@ -291,6 +317,7 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
query: '',
search: '',
type: '',
Expand All @@ -299,6 +326,7 @@ describe('Logs', () => {
qualifier: '',
startTime: '',
endTime: '',
functionName: 'test-function',
};

const result = await (logs as any).history(params);
Expand All @@ -318,6 +346,7 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
query: '',
search: '',
type: '',
Expand All @@ -326,6 +355,7 @@ describe('Logs', () => {
qualifier: '',
startTime: '2023-01-01T00:00:00Z',
endTime: '2023-01-01T01:00:00Z',
functionName: 'test-function',
};

const result = await (logs as any).history(params);
Expand All @@ -338,6 +368,7 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
query: '',
search: '',
type: '',
Expand All @@ -346,6 +377,7 @@ describe('Logs', () => {
qualifier: '',
startTime: 'invalid-date',
endTime: 'also-invalid',
functionName: 'test-function',
};

await expect((logs as any).history(params)).rejects.toThrow(
Expand All @@ -367,10 +399,13 @@ describe('Logs', () => {
projectName: 'test-project',
logStoreName: 'test-logstore',
topic: 'FCLogs:test-function',
topicFilter: '__topic__:"FCLogs:test-function"',
query: '',
search: '',
qualifier: '',
match: '',
requestId: '',
instanceId: '',
};

// We'll only run one iteration in the test
Expand Down Expand Up @@ -526,9 +561,12 @@ describe('Logs', () => {
'LATEST',
'req-123',
'inst-456',
'__topic__:"FCLogs:test-function"',
);

expect(result).toBe('baseQuery and searchTerm and LATEST and inst-456 and req-123');
expect(result).toBe(
'__topic__:"FCLogs:test-function" and baseQuery and searchTerm and qualifier: "LATEST" and instanceID: "inst-456" and requestId: "req-123"',
);
});

it('should generate SLS query with some parameters', () => {
Expand All @@ -542,6 +580,47 @@ describe('Logs', () => {

expect(result).toBe('');
});

it('should generate topicFilter with FCInstanceEvents when instanceId is specified', () => {
const result = (logs as any).getSlsQuery(
null,
null,
null,
null,
'inst-456',
'(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function")',
);

expect(result).toBe(
'(__topic__:"FCLogs:test-function" or __topic__:"FCInstanceEvents:/test-function") and instanceID: "inst-456"',
);
});

it('should generate query with topicFilter only', () => {
const result = (logs as any).getSlsQuery(
null,
null,
null,
null,
null,
'__topic__:"FCLogs:test-function"',
);

expect(result).toBe('__topic__:"FCLogs:test-function"');
});

it('should use field-specific syntax for qualifier', () => {
const result = (logs as any).getSlsQuery(
null,
null,
'LATEST',
null,
null,
'__topic__:"FCLogs:test-function"',
);

expect(result).toBe('__topic__:"FCLogs:test-function" and qualifier: "LATEST"');
});
});

describe('compareLogConfig', () => {
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ src/
- **核心功能**:
- 项目名称生成
- 日志存储名称生成
- SLS 查询语句生成(支持字段查询语法)
- 多 topic 搜索(FCLogs、FCInstanceEvents)

#### 4.4 VPC-NAS 网络存储 (vpc-nas/)

Expand Down
Loading
Loading