From 3d067303c77489e91fbe119b3f44b66edc9e5262 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 29 Jun 2025 12:12:21 +0100 Subject: [PATCH 01/11] split our contribution guidelines in their own file this is mostly @bunnybeam's work! see !838 * reset `CONTRIBUTING.md` to Misskey's version * add a link at the top of that file, pointing to ours * create `CONTRIBUTING.Sharkey.md` with all Sharkey-specific details (plus some clearer bits on dev / testing that are a bit messy in upstream's docs) --- CONTRIBUTING.Sharkey.md | 437 ++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 177 +++------------- 2 files changed, 470 insertions(+), 144 deletions(-) create mode 100644 CONTRIBUTING.Sharkey.md diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md new file mode 100644 index 0000000000..6b79dbb080 --- /dev/null +++ b/CONTRIBUTING.Sharkey.md @@ -0,0 +1,437 @@ +# Contribution guide + +We're glad you're interested in contributing to Sharkey! In this +document you will find the information you need to contribute to the +project. We assume you've *also* read Misskey's contribution guide, +[CONTRIBUTING.md](CONTRIBUTING.md). + +## Issues + +Before creating an issue, please check the following: + +- To avoid duplication, please search for similar issues before + creating a new issue. + +- Do not use Issues to ask questions or troubleshooting. + + - Issues should only be used to feature requests, suggestions, and + bug tracking. + - Please ask questions or troubleshooting in + [Discord](https://discord.gg/6VgKmEqHNk). + +> [!WARNING] +> Do not close issues that are about to be resolved. It +> should remain open until a commit that actually resolves it is +> merged. + +## Well-known branches + +- **`stable`** branch is tracking the latest release and used for + production purposes. +- **`develop`** branch is where we work for the next release. + + - When you create an MR, basically target it to this branch. + +## Creating an MR + +Thank you for your MR! Before creating an MR, please check the +following: + +- If possible, prefix the title with a keyword that identifies the + type of this MR, like `fix` / `refactor` / `feat` / `enhance` / + `perf` / `chore` etc + +- Also, make sure that the granularity of this MR is + appropriate. Please do not include more than one type of change or + interest in a single MR. + +- If there is an Issue which will be resolved by this MR, please + include a reference to the Issue in the text. + +- Check if there are any documents that need to be created or updated + due to this change. + +- If you have added a feature or fixed a bug, please add a test case + if possible. + +- Please make sure that tests and Lint are passed in advance. You can + run it with `pnpm test` and `pnpm lint`. [See more info](#testing) + +- If this MR includes UI changes, please attach a screenshot in the + text. + +## Release process + +(see also [the +wiki](https://activitypub.software/TransFem-org/Sharkey/-/wikis/release-process)) + +Prerequisites: + +* `develop` contains exactly the code we want to release + + * it can be useful to mark MRs we want to release with the + [`for-next-release` + label](https://activitypub.software/TransFem-org/Sharkey/-/merge_requests?label_name[]=for-next-release) + +* we have tested it enough to be confident we can release it to the + world + +* the CI pipeline (build, test, lint) passes + +* the backend end-to-end tests (`pnpm --filter=backend test:e2e`) pass + on your machine + +* `package.json` and `packages/misskey-js/package.json` on `develop` + have a `"version": "2027.12.0-dev"` or something similarly + non-prod-looking + +* the + [changelogs](https://activitypub.software/TransFem-org/Sharkey/-/wikis/changelogs) + contain all the changes we want to announce + +To release: + +* create a new Branch based on `develop` to change the version to a + prod-looking one(e.g. `2027.12.1`) + + * try to avoid using the same version as Misskey, both to reduce + confusion, and because (unlike branches) tags are not scoped by + remote and will confuse multi-remote clones + +* create a MR to merge the new Branch into `stable` + +* once _that_ is merged, go to + https://activitypub.software/TransFem-org/Sharkey/-/releases and + create a new release + + * for the tag, use the same version you just set on `stable` + (e.g. `2027.12.1`) + + * make sure the tag will be created on `stable` + + * for the release name, again use the version (e.g. `2027.12.1`) + + * for the release notes, copy the [changelogs](changelogs) + +* wait for all the pipelines to complete + + * in the [container + regirstry](https://activitypub.software/TransFem-org/Sharkey/container_registry/2?orderBy=NAME&sort=desc&search[]=) + you should get (of course with the right version): + + * `latest` + * `2027.12.1-amd64` + * `2027.12.1-arm64` + +* announce the release on the official account! + +Post release: + +* branch off `develop`, merge `stable` into that, change the version + to the _next_ number (e.g. `2028.1.0-dev`), create a MR for this + branch, get it merged + +### Hotfixes / security releases + +Sometimes we need to release changes to the latest stable release, *without* whatever has been merged into `develop`. For example, a security fix. + +In these cases: + +* create a branch off `stable`, let's call it `hotfix/2027.12.2`, and + change the version number on this branch + +* create branches off `stable`, one per fix (like normal feature / + bugfix branches, but starting from the released code), and send MRs + targeting `hotfix/2027.12.2` + +* once all the fixes have been merged into `hotfix/2027.12.2`, create + a MR targeting `stable` + +* now carry on through the normal release process (third step, the one + starting "once that is merged…") + +## Icon Font (Shark Font) + +Sharkey has its own Icon Font called Shark Font which can be found at +https://activitypub.software/TransFem-org/shark-font + +Build instructions can all be found over there in the `README`. + +If you have an icon suggestion or want to add an Icon please open an +issue/merge request over at that repo. + +When updating the font make sure to copy **all generated files** from +the `dest` folder into `packages/backend/assets/fonts/sharkey-icons` + +For the CSS, copy the file content and replace the old content in +`style.css` and for the WOFF, TTF and SVG simply replace them. + +## Development + +### Accessing source code + +In order to submit code changes, you will need to create a fork of the +main repository. This can be done via the GitLab UI, by pressing the +"Fork" button while signed into an activitypub.software GitLab +account. + +Once you have created a fork, you should clone it locally and update +submodules using Git. For example, to clone using SSH, use the +following commands, replacing "" with your GitLab +username: + +```bash +git clone git@activitypub.software:/Sharkey.git +git submodule update --init +``` + +### Environment setup + +Before developing, you should set up a testing environment. You can do +this using Docker via the Docker Compose plugin. You will also need to +have `pnpm` installed. + +(You may wish to perform this setup using system-wide software +installed separately, e.g. via a package manager, or using +Devcontainer. Both are possible, but they will require manual setup +that will not be covered in this document.) + +First, you will need to copy +[`.config/docker_example.env`](.config/docker_example.env) to +`.config/docker.env`. This file will contain configurations for the +PostgreSQL database, such as username and password. You may set these +as you wish. You will also need to copy +[`.config/example.yml`](.config/example.yml) to +`.config/default.yml`. This file will contain configurations for +Sharkey. Ensure that the username and password in the `db:` section +match the ones set in `docker.env`. + +Now, use the following command to start a local database container: + +```bash +docker compose -f compose.local-db.yml up -d +``` + +This will run a local PostgreSQL database server in the +background. (To stop the database, run `docker compose -f +compose.local-db.yml down`.) + +Once the database is active, run the following commands: + +```bash +pnpm build +pnpm migrate +``` + +This will build Sharkey and perform database migrations. After +finishing the migration, the database will be ready for use. + +### Start developing + +After making code changes, you can run Sharkey using the following +command: + +```bash +pnpm dev +``` + +- Checks server-side source files and automatically builds them if + they are modified. Automatically starts the server process(es). + +- Vite HMR (just the `vite` command) is available. The behavior may be + different from production. + +- Service Worker is watched by esbuild. + +- The frontend can be viewed by accessing `http://localhost:5173`. + +- The backend listens on the port configured with `port` in + `.config/default.yml`. If you have not changed it from the default, + it will be `http://localhost:3000`. + +### Testing + +(see also [Misskey's docs about testing](./CONTRIBUTING.md#testing)) + +To run many of the tests, you need a dedicated database. + +* start PostgreSQL and Redis + +* create the test configuration file: + + ```bassh + cp .config/test-example.yml .config/test.yml + ``` + +* start the database container: + + ```bash + docker compose -f packages/backend/test/compose.yml up + ``` + +Now you can run `pnpm test` and `pnpm --filter=backend test:e2e` + +### Environment Variables + +- `MISSKEY_CONFIG_DIR` changes the directory where config files are + searched, defaults to [`.config/`](.config/) at the top of the repository +- `MISSKEY_CONFIG_YML` changes the configuration file name, defaults + to `default.yml` (e.g. you can set `MISSKEY_CONFIG_YML=2nd.yml` to + load `.config/2nd.yml`) +- `MISSKEY_WEBFINGER_USE_HTTP` if set to `true`, WebFinger requests + will be http instead of https, useful for testing federation between + servers in localhost. NEVER USE IN PRODUCTION. + +## Continuous integration + +Sharkey uses GitLab CI for executing automated tests. + +Configuration files are located in [`.gitlab-ci.yml`](.gitlab-ci.yml). + +### Merging from Misskey into Sharkey + +Make sure you have both remotes in the same clone (`git remote add +misskey https://github.com/misskey-dev/misskey.git`), then: + + git remote update + git checkout develop # this is Sharkey's develop + git checkout -m merge/$(date +%Y-%m-%d) # or whatever + git merge --no-ff misskey/develop + +fix conflicts and *commit*! (conflicts in `pnpm-lock.yaml` can usually +be fixed by running `pnpm install`, it detects conflict markers and +seems to do a decent job) + +*after that commit*, do all the extra work, on the same branch: + +* copy all changes (commit after each step): + * in `packages/backend/src/core/activitypub/models/ApNoteService.ts`, from `createNote` to `updateNote` + * from `packages/backend/src/core/NoteCreateService.ts` to `packages/backend/src/core/NoteEditService.ts` + * from `packages/backend/src/server/api/endpoints/notes/create.ts` to `packages/backend/src/server/api/endpoints/notes/edit.ts` + * from MK note components to SK note components (if sensible) + * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/SkNote.vue` + * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/SkNoteDetailed.vue` + * from `packages/frontend/src/components/MkNoteHeader.vue` to `packages/frontend/src/components/SkNoteHeader.vue` + * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/SkNoteSimple.vue` + * from `packages/frontend/src/components/MkNoteSub.vue` to `packages/frontend/src/components/SkNoteSub.vue` + * from MK note components to Dynamic note components (if the public signature changed) + * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/DynamicNote.vue` + * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/DynamicNoteDetailed.vue` + * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/DynamicNoteSimple.vue` + * from the global timeline to the bubble timeline + * `packages/backend/src/server/api/stream/channels/global-timeline.ts` + * `packages/backend/src/server/api/stream/channels/bubble-timeline.ts` + * `packages/frontend/src/timelines.ts` + * `packages/frontend/src/components/MkTimeline.vue` + * `packages/frontend/src/pages/timeline.vue` + * `packages/frontend/src/ui/deck/tl-column.vue` + * `packages/frontend/src/widgets/WidgetTimeline.vue` + * from `packages/backend/src/queue/processors/InboxProcessorService.ts` to `packages/backend/src/core/UpdateInstanceQueue.ts`, where `updateInstanceQueue` is impacted + * from `.config/example.yml` to `.config/ci.yml` and `chart/files/default.yml` + * in `packages/backend/src/core/MfmService.ts`, from `toHtml` to `toMastoApiHtml` + * from `verifyLink` in `packages/backend/src/core/activitypub/models/ApPersonService.ts` to `verifyFieldLinks` in `packages/backend/src/misc/verify-field-link.ts` (if sensible) + +* if there have been any changes to the federated user data (the + `renderPerson` function in + `packages/backend/src/core/activitypub/ApRendererService.ts`), make + sure that the set of fields in `userNeedsPublishing` and + `profileNeedsPublishing` in + `packages/backend/src/server/api/endpoints/i/update.ts` are still + correct. + +* check the changes against our `develop` (`git diff develop`) and + against Misskey (`git diff misskey/develop`) + +* re-generate `misskey-js` (`pnpm build-misskey-js-with-types`) and + commit + +* re-generate locales (`pnpm run build-assets`) and commit + +* build the frontend: `rm -rf built/; NODE_ENV=development pnpm + --filter=frontend --filter=frontend-embed --filter=frontend-shared + build` (the `development` tells it to keep some of the original + filenames in the built files) + +* make sure there aren't any new `ti-*` classes (Tabler Icons), and + replace them with appropriate `ph-*` ones (Phosphor Icons) in + [`vite.replaceicons.ts`](packages/frontend/vite.replaceIcons.ts). + + * This command should show you want to change: `grep -ohrP + '(?<=["'\''](ti )?)(ti-(?!fw)[\w\-]+)' --exclude \*.map -- + built/ | sort -u`. + + * NOTE: `ti-fw` is a special class that's defined by Misskey, + leave it alone. + + * After every change, re-build the frontend and check again, until + there are no more `ti-*` classes in the built files. + + * Commit! + +* double-check the new migration, that they won't conflict with our db + changes: `git diff develop -- packages/backend/migration/` + +* `pnpm clean; pnpm build` + +* run tests `pnpm test; pnpm --filter backend test:e2e` (requires a + test database, [see above](#testing)) and fix them all (the e2e + tests randomly fail with weird errors like `relation "users" does + not exist`, run them again if that happens) + +* run lint `pnpm --filter=backend --filter=frontend-shared lint` + + `pnpm --filter=frontend --filter=frontend-embed eslint` and fix all + the problems + +Then push and open a Merge Request. + +### Memory Caches + +Sharkey offers multiple memory cache implementations, each meant for a +different use case. The following table compares the available +options: + +| Cache | Type | Consistency | Persistence | Data Source | Cardinality | Eviction | Description | +|---------------------|-----------|-------------|-------------|-------------|-------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `MemoryKVCache` | Key-Value | None | None | Caller | Single | Lifetime | Implements a basic in-memory Key-Value store. The implementation is entirely synchronous, except for user-provided data sources. | +| `MemorySingleCache` | Single | None | None | Caller | Single | Lifetime | Implements a basic in-memory Single Value store. The implementation is entirely synchronous, except for user-provided data sources. | +| `RedisKVCache` | Key-Value | Eventual | Redis | Callback | Single | Lifetime | Extends `MemoryKVCache` with Redis-backed persistence and a pre-defined callback data source. This provides eventual consistency guarantees based on the memory cache lifetime. | +| `RedisSingleCache` | Single | Eventual | Redis | Callback | Single | Lifetime | Extends `MemorySingleCache` with Redis-backed persistence and a pre-defined callback data source. This provides eventual consistency guarantees based on the memory cache lifetime. | +| `QuantumKVCache` | Key-Value | Immediate | None | Callback | Multiple | Lifetime | Combines `MemoryKVCache` with a pre-defined callback data source and immediate consistency via Redis sync events. The implementation offers multi-item batch overloads for efficient bulk operations. **This is the recommended cache implementation for most use cases.** | + +Key-Value caches store multiple entries per cache, while Single caches +store a single value that can be accessed directly. Consistency +refers to the consistency of cached data between different processes +in the instance cluster: "None" means no consistency guarantees, +"Eventual" caches will gradually become consistent after some unknown +time, and "Immediate" consistency ensures accurate data ASAP after the +update. Caches with persistence can retain their data after a reboot +through an external service such as Redis. If a data source is +supported, then this allows the cache to directly load missing data in +response to a fetch. "Caller" data sources are passed into the fetch +method(s) directly, while "Callback" sources are passed in as a +function when the cache is first initialized. The cardinality of a +cache refers to the number of items that can be updated in a single +operation, and eviction, finally, is the method that the cache uses to +evict stale data. + +#### Selecting a cache implementation + +For most cache uses, `QuantumKVCache` should be considered first. It +offers strong consistency guarantees, multiple cardinality, and a +cleaner API surface than the older caches. + +An alternate cache implementation should be considered if any of the +following apply: + +* The data is particularly slow to calculate or difficult to + access. In these cases, either `RedisKVCache` or `RedisSingleCache` + should be considered. + +* If stale data is acceptable, then consider `MemoryKVCache` or + `MemorySingleCache`. These synchronous implementations have much + less overhead than the other options. + +* There is only one data item, or all data items must be fetched + together. Using `MemorySingleCache` or `RedisSingleCache` could + provide a cleaner implementation without resorting to hacks like a + fixed key. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ba2d2eacfb..db461f7063 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,15 +1,26 @@ +This file is a copy of [Misskey's +CONTRIBUTING.md](https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md), +kept for compatibility. For Sharkey's contribution guide, see +[CONTRIBUTING.Sharkey.md](CONTRIBUTING.Sharkey.md). + # Contribution guide -We're glad you're interested in contributing to Sharkey! In this document you will find the information you need to contribute to the project. +We're glad you're interested in contributing Misskey! In this document you will find the information you need to contribute to the project. + +> [!NOTE] +> This project uses Japanese as its major language, **but you do not need to translate and write the Issues/PRs in Japanese.** +> Also, you might receive comments on your Issue/PR in Japanese, but you do not need to reply to them in Japanese as well.\ +> The accuracy of machine translation into Japanese is not high, so it will be easier for us to understand if you write it in the original language. +> It will also allow the reader to use the translation tool of their preference if necessary. ## Roadmap -See [ROADMAP.md](./ROADMAP.md) for the upstream Misskey roadmap. +See [ROADMAP.md](./ROADMAP.md) ## Issues Before creating an issue, please check the following: - To avoid duplication, please search for similar issues before creating a new issue. - Do not use Issues to ask questions or troubleshooting. - Issues should only be used to feature requests, suggestions, and bug tracking. - - Please ask questions or troubleshooting in [Discord](https://discord.gg/6VgKmEqHNk). + - Please ask questions or troubleshooting in [GitHub Discussions](https://github.com/misskey-dev/misskey/discussions) or [Discord](https://discord.gg/Wp8gVStHW3). > [!WARNING] > Do not close issues that are about to be resolved. It should remain open until a commit that actually resolves it is merged. @@ -17,15 +28,10 @@ Before creating an issue, please check the following: ### Recommended discussing before implementation We welcome your proposal. -When you want to add a feature or fix a bug, *please open an issue*, -don't just start writing code. We may suggest different approaches, or -show that the "bug" is actually intended behaviour (and offer -work-arounds), or maybe we won't be able to merge your new feature -because it would make it too hard to incorporate future changes from -Misskey. Each of these examples have actually happened! +When you want to add a feature or fix a bug, **first have the design and policy reviewed in an Issue** (if it is not there, please make one). Without this step, there is a high possibility that the PR will not be merged even if it is implemented. -On the other hand, it's very likely that we'll tell you "go -ahead!". We try our best to incorporate improvements from our users! +At this point, you also need to clarify the goals of the PR you will create, and make sure that the other members of the team are aware of them. +PRs that do not have a clear set of do's and don'ts tend to be bloated and difficult to review. Also, when you start implementation, assign yourself to the Issue (if you cannot do it yourself, ask Committer to assign you). By expressing your intention to work on the Issue, you can prevent conflicts in the work. @@ -43,9 +49,10 @@ The Committers may: @syuilo reserves the Final Decision rights including whether the project will implement feature and how to implement, these rights are not always exercised. ## Well-known branches -- **`stable`** branch is tracking the latest release and used for production purposes. +- **`master`** branch is tracking the latest release and used for production purposes. - **`develop`** branch is where we work for the next release. - When you create a PR, basically target it to this branch. +- **`l10n_develop`** branch is reserved for localization management. ## Creating a PR Thank you for your PR! Before creating a PR, please check the following: @@ -53,7 +60,7 @@ Thank you for your PR! Before creating a PR, please check the following: - `fix` / `refactor` / `feat` / `enhance` / `perf` / `chore` etc - Also, make sure that the granularity of this PR is appropriate. Please do not include more than one type of change or interest in a single PR. - If there is an Issue which will be resolved by this PR, please include a reference to the Issue in the text. -- Please add the summary of the changes to [`CHANGELOG.md`](CHANGELOG.md). However, this is not necessary for changes that do not affect the users, such as refactoring. +- Please add the summary of the changes to [`CHANGELOG.md`](/CHANGELOG.md). However, this is not necessary for changes that do not affect the users, such as refactoring. - Check if there are any documents that need to be created or updated due to this change. - If you have added a feature or fixed a bug, please add a test case if possible. - Please make sure that tests and Lint are passed in advance. @@ -128,13 +135,13 @@ An actual domain will be assigned so you can test the federation. ### Release Instructions 1. Commit version changes in the `develop` branch ([package.json](package.json)) 2. Create a release PR. - - Into `stable` from `develop` branch. + - Into `master` from `develop` branch. - The title must be in the format `Release: x.y.z`. - `x.y.z` is the new version you are trying to release. 3. Deploy and perform a simple QA check. Also verify that the tests passed. 4. Merge it. (Do not squash commit) -5. Create a [release](https://activitypub.software/TransFem-org/Sharkey/-/releases) - - The target branch must be `stable` +5. Create a [release of GitHub](https://github.com/misskey-dev/misskey/releases) + - The target branch must be `master` - The tag name must be the version > [!NOTE] @@ -155,15 +162,6 @@ For newly added languages, once the translation progress per language exceeds 70 ![Crowdin](https://d322cqt584bo4o.cloudfront.net/misskey/localized.svg) -## Icon Font (Shark Font) -Sharkey has its own Icon Font called Shark Font which can be found at https://activitypub.software/TransFem-org/shark-font -Build Instructions can all be found over there in the `README`. - -If you have an Icon Suggestion or want to add an Icon please open an issue/merge request over at that repo. - -When Updating the Font make sure to copy **all generated files** from the `dest` folder into `packages/backend/assets/fonts/sharkey-icons` -For the CSS simply copy the file content and replace the old content in `style.css` and for the WOFF, TTF and SVG simply replace them. - ## Development ### Setup Before developing, you have to set up environment. Misskey requires Redis, PostgreSQL, and FFmpeg. @@ -210,7 +208,6 @@ command. - You can see Misskey by accessing `http://localhost:3000` (Replace `3000` with the port configured with `port` in .config/default.yml). ## Testing - You can run non-backend tests by executing following commands: ```sh pnpm --filter frontend test @@ -228,7 +225,7 @@ There are three types of test codes for the backend: #### Running Unit Tests or Single-server E2E Tests 1. Create a config file: ```sh -cp .config/test-example.yml .config/test.yml +cp .github/misskey/test.yml .config/ ``` 2. Start DB and Redis servers for testing: @@ -257,8 +254,8 @@ See [`/packages/backend/test-federation/README.md`](/packages/backend/test-feder - `MISSKEY_WEBFINGER_USE_HTTP`: If it's set true, WebFinger requests will be http instead of https, useful for testing federation between servers in localhost. NEVER USE IN PRODUCTION. ## Continuous integration -Sharkey uses GitLab CI for executing automated tests. -Configuration files are located in [`/.gitlab-ci.yml`](.gitlab-ci.yml). +Misskey uses GitHub Actions for executing automated tests. +Configuration files are located in [`/.github/workflows`](/.github/workflows). ## Vue Misskey uses Vue(v3) as its front-end framework. @@ -266,6 +263,12 @@ Misskey uses Vue(v3) as its front-end framework. - **When creating a new component, please use the Composition API (with [setup sugar](https://v3.vuejs.org/api/sfc-script-setup.html) and [ref sugar](https://github.com/vuejs/rfcs/discussions/369)) instead of the Options API.** - Some of the existing components are implemented in the Options API, but it is an old implementation. Refactors that migrate those components to the Composition API are also welcome. +## Tabler Icons +アイコンは、Production Build時に使用されていないものが削除されるようになっています。 + +**アイコンを動的に設定する際には、 `ti-${someVal}` のような、アイコン名のみを動的に変化させる実装を行わないでください。** +必ず `ti-xxx` のような完全なクラス名を含めるようにしてください。 + ## nirax niraxは、Misskeyで使用しているオリジナルのフロントエンドルーティングシステムです。 **vue-routerから影響を多大に受けているので、まずはvue-routerについて学ぶことをお勧めします。** @@ -577,34 +580,12 @@ enumの列挙の内容の削除は、その値をもつレコードを全て削 ### Migration作成方法 packages/backendで: ```sh -pnpm run build -pnpm dlx typeorm migration:generate -d ormconfig.js -o migration/ +pnpm dlx typeorm migration:generate -d ormconfig.js -o ``` - 生成後、ファイルをmigration下に移してください - 作成されたスクリプトは不必要な変更を含むため除去してください -### JSON SchemaのobjectでanyOfを使うとき -JSON Schemaで、objectに対してanyOfを使う場合、anyOfの中でpropertiesを定義しないこと。 -バリデーションが効かないため。(SchemaTypeもそのように作られており、objectのanyOf内のpropertiesは捨てられます) -https://github.com/misskey-dev/misskey/pull/10082 - -テキストhogeおよびfugaについて、片方を必須としつつ両方の指定もありうる場合: - -```ts -export const paramDef = { - type: 'object', - properties: { - hoge: { type: 'string', minLength: 1 }, - fuga: { type: 'string', minLength: 1 }, - }, - anyOf: [ - { required: ['hoge'] }, - { required: ['fuga'] }, - ], -} as const; -``` - ### コネクションには`markRaw`せよ **Vueのコンポーネントのdataオプションとして**misskey.jsのコネクションを設定するとき、必ず`markRaw`でラップしてください。インスタンスが不必要にリアクティブ化されることで、misskey.js内の処理で不具合が発生するとともに、パフォーマンス上の問題にも繋がる。なお、Composition APIを使う場合はこの限りではない(リアクティブ化はマニュアルなため)。 @@ -622,35 +603,6 @@ marginはそのコンポーネントを使う側が設定する ### indexというファイル名を使うな ESMではディレクトリインポートは廃止されているのと、ディレクトリインポートせずともファイル名が index だと何故か一部のライブラリ?でディレクトリインポートだと見做されてエラーになる -### Memory Caches - -Sharkey offers multiple memory cache implementations, each meant for a different use case. -The following table compares the available options: - -| Cache | Type | Consistency | Persistence | Data Source | Cardinality | Eviction | Description | -|---------------------|-----------|-------------|-------------|-------------|-------------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `MemoryKVCache` | Key-Value | None | None | Caller | Single | Lifetime | Implements a basic in-memory Key-Value store. The implementation is entirely synchronous, except for user-provided data sources. | -| `MemorySingleCache` | Single | None | None | Caller | Single | Lifetime | Implements a basic in-memory Single Value store. The implementation is entirely synchronous, except for user-provided data sources. | -| `RedisKVCache` | Key-Value | Eventual | Redis | Callback | Single | Lifetime | Extends `MemoryKVCache` with Redis-backed persistence and a pre-defined callback data source. This provides eventual consistency guarantees based on the memory cache lifetime. | -| `RedisSingleCache` | Single | Eventual | Redis | Callback | Single | Lifetime | Extends `MemorySingleCache` with Redis-backed persistence and a pre-defined callback data source. This provides eventual consistency guarantees based on the memory cache lifetime. | -| `QuantumKVCache` | Key-Value | Immediate | None | Callback | Multiple | Lifetime | Combines `MemoryKVCache` with a pre-defined callback data source and immediate consistency via Redis sync events. The implementation offers multi-item batch overloads for efficient bulk operations. **This is the recommended cache implementation for most use cases.** | - -Key-Value caches store multiple entries per cache, while Single caches store a single value that can be accessed directly. -Consistency refers to the consistency of cached data between different processes in the instance cluster: "None" means no consistency guarantees, "Eventual" caches will gradually become consistent after some unknown time, and "Immediate" consistency ensures accurate data ASAP after the update. -Caches with persistence can retain their data after a reboot through an external service such as Redis. -If a data source is supported, then this allows the cache to directly load missing data in response to a fetch. -"Caller" data sources are passed into the fetch method(s) directly, while "Callback" sources are passed in as a function when the cache is first initialized. -The cardinality of a cache refers to the number of items that can be updated in a single operation, and eviction, finally, is the method that the cache uses to evict stale data. - -#### Selecting a cache implementation - -For most cache uses, `QuantumKVCache` should be considered first. -It offers strong consistency guarantees, multiple cardinality, and a cleaner API surface than the older caches. -An alternate cache implementation should be considered if any of the following apply: -* The data is particularly slow to calculate or difficult to access. In these cases, either `RedisKVCache` or `RedisSingleCache` should be considered. -* If stale data is acceptable, then consider `MemoryKVCache` or `MemorySingleCache`. These synchronous implementations have much less overhead than the other options. -* There is only one data item, or all data items must be fetched together. Using `MemorySingleCache` or `RedisSingleCache` could provide a cleaner implementation without resorting to hacks like a fixed key. - ## CSS Recipe ### Lighten CSS vars @@ -671,66 +623,3 @@ color: hsl(from var(--MI_THEME-accent) h s calc(l - 10)); color: color(from var(--MI_THEME-accent) srgb r g b / 0.5); ``` -## Merging from Misskey into Sharkey - -Make sure you have both remotes in the same clone (`git remote add misskey -https://github.com/misskey-dev/misskey.git`), then: - - git remote update - git checkout develop # this is Sharkey's develop - git checkout -m merge/$(date +%Y-%m-%d) # or whatever - git merge --no-ff misskey/develop - -fix conflicts and *commit*! (conflicts in `pnpm-lock.yaml` can usually -be fixed by running `pnpm install`, it detects conflict markers and -seems to do a decent job) - -*after that commit*, do all the extra work, on the same branch: - -* copy all changes (commit after each step): - * in `packages/backend/src/core/activitypub/models/ApNoteService.ts`, from `createNote` to `updateNote` - * from `packages/backend/src/core/NoteCreateService.ts` to `packages/backend/src/core/NoteEditService.ts` - * from `packages/backend/src/server/api/endpoints/notes/create.ts` to `packages/backend/src/server/api/endpoints/notes/edit.ts` - * from MK note components to SK note components (if sensible) - * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/SkNote.vue` - * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/SkNoteDetailed.vue` - * from `packages/frontend/src/components/MkNoteHeader.vue` to `packages/frontend/src/components/SkNoteHeader.vue` - * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/SkNoteSimple.vue` - * from `packages/frontend/src/components/MkNoteSub.vue` to `packages/frontend/src/components/SkNoteSub.vue` - * from MK note components to Dynamic note components (if the public signature changed) - * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/DynamicNote.vue` - * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/DynamicNoteDetailed.vue` - * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/DynamicNoteSimple.vue` - * from the global timeline to the bubble timeline - * `packages/backend/src/server/api/stream/channels/global-timeline.ts` - * `packages/backend/src/server/api/stream/channels/bubble-timeline.ts` - * `packages/frontend/src/timelines.ts` - * `packages/frontend/src/components/MkTimeline.vue` - * `packages/frontend/src/pages/timeline.vue` - * `packages/frontend/src/ui/deck/tl-column.vue` - * `packages/frontend/src/widgets/WidgetTimeline.vue` - * from `packages/backend/src/queue/processors/InboxProcessorService.ts` to `packages/backend/src/core/UpdateInstanceQueue.ts`, where `updateInstanceQueue` is impacted - * from `.config/example.yml` to `.config/ci.yml` and `chart/files/default.yml` - * in `packages/backend/src/core/MfmService.ts`, from `toHtml` to `toMastoApiHtml` - * from `verifyLink` in `packages/backend/src/core/activitypub/models/ApPersonService.ts` to `verifyFieldLinks` in `packages/backend/src/misc/verify-field-link.ts` (if sensible) -* if there have been any changes to the federated user data (the `renderPerson` function in `packages/backend/src/core/activitypub/ApRendererService.ts`), make sure that the set of fields in `userNeedsPublishing` and `profileNeedsPublishing` in `packages/backend/src/server/api/endpoints/i/update.ts` are still correct. -* check the changes against our `develop` (`git diff develop`) and against Misskey (`git diff misskey/develop`) -* re-generate `misskey-js` (`pnpm build-misskey-js-with-types`) and commit -* re-generate locales (`pnpm run build-assets`) and commit -* build the frontend: `rm -rf built/; NODE_ENV=development pnpm --filter=frontend --filter=frontend-embed --filter=frontend-shared build` (the `development` tells it to keep some of the original filenames in the built files) -* make sure there aren't any new `ti-*` classes (Tabler Icons), and replace them with appropriate `ph-*` ones (Phosphor Icons) in [`vite.replaceicons.ts`](packages/frontend/vite.replaceIcons.ts). - * This command should show you want to change: `grep -ohrP '(?<=["'\''](ti )?)(ti-(?!fw)[\w\-]+)' --exclude \*.map -- built/ | sort -u`. - * NOTE: `ti-fw` is a special class that's defined by Misskey, leave it alone. - * After every change, re-build the frontend and check again, until there are no more `ti-*` classes in the built files. - * Commit! -* double-check the new migration, that they won't conflict with our db changes: `git diff develop -- packages/backend/migration/` -* `pnpm clean; pnpm build` -* run tests `pnpm test; pnpm --filter backend test:e2e` (requires a - test database, [see above](#testing)) and fix them all (the e2e - tests randomly fail with weird errors like `relation "users" does - not exist`, run them again if that happens) -* run lint `pnpm --filter=backend --filter=frontend-shared lint` + - `pnpm --filter=frontend --filter=frontend-embed eslint` and fix all - the problems - -Then push and open a Merge Request. From aa1eaac4e8ca0226e6b3b0155cf3de8acb060b5b Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 29 Jun 2025 12:14:27 +0100 Subject: [PATCH 02/11] link the issue/mr templates to our contribution guidelines --- .gitlab/issue_templates/bug.md | 2 +- .gitlab/issue_templates/feature.md | 2 +- .gitlab/merge_request_templates/default.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab/issue_templates/bug.md b/.gitlab/issue_templates/bug.md index a909067269..32631619bc 100644 --- a/.gitlab/issue_templates/bug.md +++ b/.gitlab/issue_templates/bug.md @@ -30,6 +30,6 @@ # **Contribution Guidelines** -By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md) +By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.Sharkey.md) - [ ] I agree to follow this project's Contribution Guidelines - [ ] I have searched the issue tracker for similar issues, and this is not a duplicate. diff --git a/.gitlab/issue_templates/feature.md b/.gitlab/issue_templates/feature.md index a77f9335fe..989ba23ba7 100644 --- a/.gitlab/issue_templates/feature.md +++ b/.gitlab/issue_templates/feature.md @@ -16,6 +16,6 @@ # **Contribution Guidelines** -By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md) +By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.Sharkey.md) - [ ] I agree to follow this project's Contribution Guidelines - [ ] I have searched the issue tracker for similar requests, and this is not a duplicate. diff --git a/.gitlab/merge_request_templates/default.md b/.gitlab/merge_request_templates/default.md index 389b2c8cbe..a2ef2dc235 100644 --- a/.gitlab/merge_request_templates/default.md +++ b/.gitlab/merge_request_templates/default.md @@ -6,7 +6,7 @@ %{all_commits} # **Contribution Guidelines** -By submitting this merge request, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md) +By submitting this merge request, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.Sharkey.md) - [ ] I agree to follow this project's Contribution Guidelines - [ ] I have made sure to test this merge request From d704409f85be80a07867addc617bac28d35f4402 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 29 Jun 2025 12:14:44 +0100 Subject: [PATCH 03/11] tweak the test compose file to match our test config file `.config/test-example.yml` uses default ports, so this one should do the same --- packages/backend/test/compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/test/compose.yml b/packages/backend/test/compose.yml index 6593fc33dd..c39a346d82 100644 --- a/packages/backend/test/compose.yml +++ b/packages/backend/test/compose.yml @@ -2,12 +2,12 @@ services: redistest: image: redis:7 ports: - - "127.0.0.1:56312:6379" + - "127.0.0.1:6379:6379" dbtest: - image: postgres:15 + image: postgres:17 ports: - - "127.0.0.1:54312:5432" + - "127.0.0.1:5432:5432" environment: POSTGRES_DB: "test-misskey" POSTGRES_HOST_AUTH_METHOD: trust From 497d9830323b183d120c5ffe99191012f4ee5f6d Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 6 Jul 2025 10:10:24 +0000 Subject: [PATCH 04/11] improvements from @bunnybeam --- CONTRIBUTING.Sharkey.md | 288 +++++++++++++++++++++------------------- 1 file changed, 155 insertions(+), 133 deletions(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 6b79dbb080..cbeada4cd6 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -12,12 +12,12 @@ Before creating an issue, please check the following: - To avoid duplication, please search for similar issues before creating a new issue. -- Do not use Issues to ask questions or troubleshooting. +- Do not use Issues to ask questions or for troubleshooting. - - Issues should only be used to feature requests, suggestions, and + - Issues should only be used for feature requests, suggestions, and bug tracking. - - Please ask questions or troubleshooting in - [Discord](https://discord.gg/6VgKmEqHNk). + - For questions and troubleshooting, join + [our Discord server](https://discord.gg/6VgKmEqHNk). > [!WARNING] > Do not close issues that are about to be resolved. It @@ -30,18 +30,18 @@ Before creating an issue, please check the following: production purposes. - **`develop`** branch is where we work for the next release. - - When you create an MR, basically target it to this branch. + - When you create a merge request, target it to this branch. -## Creating an MR +## Creating a Merge Request -Thank you for your MR! Before creating an MR, please check the +Thank you for your merge request! Before creating an MR, please check the following: - If possible, prefix the title with a keyword that identifies the type of this MR, like `fix` / `refactor` / `feat` / `enhance` / `perf` / `chore` etc -- Also, make sure that the granularity of this MR is +- Make sure that the granularity of this MR is appropriate. Please do not include more than one type of change or interest in a single MR. @@ -55,81 +55,85 @@ following: if possible. - Please make sure that tests and Lint are passed in advance. You can - run it with `pnpm test` and `pnpm lint`. [See more info](#testing) + run it with `pnpm test` and `pnpm lint`. See the [testing + section](#testing) for more info. - If this MR includes UI changes, please attach a screenshot in the text. ## Release process -(see also [the +(See also [the wiki](https://activitypub.software/TransFem-org/Sharkey/-/wikis/release-process)) -Prerequisites: +### Creating a release +#### Prerequisites +Before creating a release, we must ensure that: +- `develop` contains exactly the code we want to release. -* `develop` contains exactly the code we want to release - - * it can be useful to mark MRs we want to release with the + - It can be useful to mark MRs we want to release with the [`for-next-release` - label](https://activitypub.software/TransFem-org/Sharkey/-/merge_requests?label_name[]=for-next-release) + label](https://activitypub.software/TransFem-org/Sharkey/-/merge_requests?label_name[]=for-next-release). -* we have tested it enough to be confident we can release it to the - world +- We have tested it enough to be confident we can release it to the + world. -* the CI pipeline (build, test, lint) passes +- The CI pipeline (build, test, lint) passes. -* the backend end-to-end tests (`pnpm --filter=backend test:e2e`) pass - on your machine +- The backend end-to-end tests (`pnpm --filter=backend test:e2e`) pass + on your machine. -* `package.json` and `packages/misskey-js/package.json` on `develop` +- `package.json` and `packages/misskey-js/package.json` on `develop` have a `"version": "2027.12.0-dev"` or something similarly - non-prod-looking + non-prod-looking. -* the +- The [changelogs](https://activitypub.software/TransFem-org/Sharkey/-/wikis/changelogs) - contain all the changes we want to announce + contain all the changes we want to announce. -To release: +#### To release +To create a release, we must: -* create a new Branch based on `develop` to change the version to a - prod-looking one(e.g. `2027.12.1`) +1. Create a new Branch based on `develop` to change the version to a + prod-looking one (e.g. `2027.12.1`). - * try to avoid using the same version as Misskey, both to reduce + - Try to avoid using the same version as Misskey, both to reduce confusion, and because (unlike branches) tags are not scoped by - remote and will confuse multi-remote clones + remote and will confuse multi-remote clones. -* create a MR to merge the new Branch into `stable` +2. Create an MR to merge the new branch into `stable`. -* once _that_ is merged, go to +3. Once that MR is merged, go to https://activitypub.software/TransFem-org/Sharkey/-/releases and - create a new release + create a new release. - * for the tag, use the same version you just set on `stable` - (e.g. `2027.12.1`) + - For the tag, use the same version you just set on `stable` + (e.g. `2027.12.1`). - * make sure the tag will be created on `stable` + - Make sure the tag will be created on `stable`. - * for the release name, again use the version (e.g. `2027.12.1`) + - For the release name, again use the version (e.g. `2027.12.1`). - * for the release notes, copy the [changelogs](changelogs) + - For the release notes, copy the [changelogs](changelogs). -* wait for all the pipelines to complete +4. Wait for all the pipelines to complete. - * in the [container - regirstry](https://activitypub.software/TransFem-org/Sharkey/container_registry/2?orderBy=NAME&sort=desc&search[]=) + - In the [container + registry](https://activitypub.software/TransFem-org/Sharkey/container_registry/2?orderBy=NAME&sort=desc&search[]=) you should get (of course with the right version): - * `latest` - * `2027.12.1-amd64` - * `2027.12.1-arm64` + - `latest` + - `2027.12.1-amd64` + - `2027.12.1-arm64` -* announce the release on the official account! +5. Announce the release on the official account! -Post release: +#### Post release +After creating a release, we must: -* branch off `develop`, merge `stable` into that, change the version - to the _next_ number (e.g. `2028.1.0-dev`), create a MR for this - branch, get it merged +- Branch off `develop`, merge `stable` into that new branch, change the version + to the *next* number (e.g. `2028.1.0-dev`), create a MR for this + branch, and get it merged. ### Hotfixes / security releases @@ -137,18 +141,18 @@ Sometimes we need to release changes to the latest stable release, *without* wha In these cases: -* create a branch off `stable`, let's call it `hotfix/2027.12.2`, and - change the version number on this branch +1. Create a branch off `stable` - let's call it `hotfix/2027.12.2`, for + example - and change the version number on this branch. -* create branches off `stable`, one per fix (like normal feature / - bugfix branches, but starting from the released code), and send MRs - targeting `hotfix/2027.12.2` +2. Create branches off `stable`, one per fix (like normal feature / + bugfix branches, but starting from the released code), and send MRs + targeting `hotfix/2027.12.2`. -* once all the fixes have been merged into `hotfix/2027.12.2`, create - a MR targeting `stable` +3. Once all the fixes have been merged into `hotfix/2027.12.2`, create + a MR targeting `stable`. -* now carry on through the normal release process (third step, the one - starting "once that is merged…") +4. Now carry on through the normal release process (from step 3 of the + "[To release](#To%20Release)" section). ## Icon Font (Shark Font) @@ -160,8 +164,8 @@ Build instructions can all be found over there in the `README`. If you have an icon suggestion or want to add an Icon please open an issue/merge request over at that repo. -When updating the font make sure to copy **all generated files** from -the `dest` folder into `packages/backend/assets/fonts/sharkey-icons` +When updating the font, make sure to copy **all generated files** from +the `dest` folder into `packages/backend/assets/fonts/sharkey-icons`. For the CSS, copy the file content and replace the old content in `style.css` and for the WOFF, TTF and SVG simply replace them. @@ -200,7 +204,7 @@ First, you will need to copy [`.config/docker_example.env`](.config/docker_example.env) to `.config/docker.env`. This file will contain configurations for the PostgreSQL database, such as username and password. You may set these -as you wish. You will also need to copy +as you wish. You will also need to copy [`.config/example.yml`](.config/example.yml) to `.config/default.yml`. This file will contain configurations for Sharkey. Ensure that the username and password in the `db:` section @@ -251,36 +255,44 @@ pnpm dev ### Testing -(see also [Misskey's docs about testing](./CONTRIBUTING.md#testing)) +(See also [Misskey's docs about testing](./CONTRIBUTING.md#testing)). -To run many of the tests, you need a dedicated database. +To run many of the tests, you need a dedicated database. To set this up: -* start PostgreSQL and Redis +1. Start PostgreSQL and Redis -* create the test configuration file: + - This is covered in the [environment setup](#Environment%20setup) section. - ```bassh +2. Create the test configuration file, by copying + `.config/test-example.yml` to `.config/test.yml`. + + ```bash cp .config/test-example.yml .config/test.yml ``` -* start the database container: +3. Start the database container: ```bash docker compose -f packages/backend/test/compose.yml up ``` -Now you can run `pnpm test` and `pnpm --filter=backend test:e2e` +Now you can run `pnpm test` and `pnpm --filter=backend test:e2e` to +run the tests. ### Environment Variables - `MISSKEY_CONFIG_DIR` changes the directory where config files are - searched, defaults to [`.config/`](.config/) at the top of the repository -- `MISSKEY_CONFIG_YML` changes the configuration file name, defaults + searched. Defaults to [`.config/`](.config/) at the top of the repository. +- `MISSKEY_CONFIG_YML` changes the configuration file name. Defaults to `default.yml` (e.g. you can set `MISSKEY_CONFIG_YML=2nd.yml` to - load `.config/2nd.yml`) + load `.config/2nd.yml`). - `MISSKEY_WEBFINGER_USE_HTTP` if set to `true`, WebFinger requests will be http instead of https, useful for testing federation between - servers in localhost. NEVER USE IN PRODUCTION. + servers in localhost. + +> [!WARNING] +> Never use `MISSKEY_WEBFINGER_USE_HTTP` for a real instance in production, +> as it will expose user information to the network. ## Continuous integration @@ -290,48 +302,56 @@ Configuration files are located in [`.gitlab-ci.yml`](.gitlab-ci.yml). ### Merging from Misskey into Sharkey -Make sure you have both remotes in the same clone (`git remote add -misskey https://github.com/misskey-dev/misskey.git`), then: +Make sure you have both remotes in the same clone. To do this, run +the following command to add Misskey's remote to your local clone: - git remote update - git checkout develop # this is Sharkey's develop - git checkout -m merge/$(date +%Y-%m-%d) # or whatever - git merge --no-ff misskey/develop +```bash + git remote add misskey https://github.com/misskey-dev/misskey.git +``` -fix conflicts and *commit*! (conflicts in `pnpm-lock.yaml` can usually -be fixed by running `pnpm install`, it detects conflict markers and -seems to do a decent job) +Then, to perform the merge: -*after that commit*, do all the extra work, on the same branch: +```bash +git remote update # Update branches to track the new remote. +git checkout develop # Checkout Sharkey's develop branch. +git checkout -m merge/$(date +%Y-%m-%d) # Create/switch to a merge branch for the current date. +git merge --no-ff misskey/develop # Merge from Misskey's develop branch, forcing a merge commit. +``` -* copy all changes (commit after each step): - * in `packages/backend/src/core/activitypub/models/ApNoteService.ts`, from `createNote` to `updateNote` - * from `packages/backend/src/core/NoteCreateService.ts` to `packages/backend/src/core/NoteEditService.ts` - * from `packages/backend/src/server/api/endpoints/notes/create.ts` to `packages/backend/src/server/api/endpoints/notes/edit.ts` - * from MK note components to SK note components (if sensible) - * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/SkNote.vue` - * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/SkNoteDetailed.vue` - * from `packages/frontend/src/components/MkNoteHeader.vue` to `packages/frontend/src/components/SkNoteHeader.vue` - * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/SkNoteSimple.vue` - * from `packages/frontend/src/components/MkNoteSub.vue` to `packages/frontend/src/components/SkNoteSub.vue` - * from MK note components to Dynamic note components (if the public signature changed) - * from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/DynamicNote.vue` - * from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/DynamicNoteDetailed.vue` - * from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/DynamicNoteSimple.vue` - * from the global timeline to the bubble timeline - * `packages/backend/src/server/api/stream/channels/global-timeline.ts` - * `packages/backend/src/server/api/stream/channels/bubble-timeline.ts` - * `packages/frontend/src/timelines.ts` - * `packages/frontend/src/components/MkTimeline.vue` - * `packages/frontend/src/pages/timeline.vue` - * `packages/frontend/src/ui/deck/tl-column.vue` - * `packages/frontend/src/widgets/WidgetTimeline.vue` - * from `packages/backend/src/queue/processors/InboxProcessorService.ts` to `packages/backend/src/core/UpdateInstanceQueue.ts`, where `updateInstanceQueue` is impacted - * from `.config/example.yml` to `.config/ci.yml` and `chart/files/default.yml` - * in `packages/backend/src/core/MfmService.ts`, from `toHtml` to `toMastoApiHtml` - * from `verifyLink` in `packages/backend/src/core/activitypub/models/ApPersonService.ts` to `verifyFieldLinks` in `packages/backend/src/misc/verify-field-link.ts` (if sensible) +Fix conflicts and *commit!* Conflicts in `pnpm-lock.yaml` can usually +be fixed by running `pnpm install` - it detects conflict markers and +seems to do a decent job. -* if there have been any changes to the federated user data (the +*After that commit,* do all the extra work, on the same branch: + +- Copy all changes (commit after each step): + - in `packages/backend/src/core/activitypub/models/ApNoteService.ts`, from `createNote` to `updateNote` + - from `packages/backend/src/core/NoteCreateService.ts` to `packages/backend/src/core/NoteEditService.ts` + - from `packages/backend/src/server/api/endpoints/notes/create.ts` to `packages/backend/src/server/api/endpoints/notes/edit.ts` + - from MK note components to SK note components (if sensible) + - from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/SkNote.vue` + - from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/SkNoteDetailed.vue` + - from `packages/frontend/src/components/MkNoteHeader.vue` to `packages/frontend/src/components/SkNoteHeader.vue` + - from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/SkNoteSimple.vue` + - from `packages/frontend/src/components/MkNoteSub.vue` to `packages/frontend/src/components/SkNoteSub.vue` + - from MK note components to Dynamic note components (if the public signature changed) + - from `packages/frontend/src/components/MkNote.vue` to `packages/frontend/src/components/DynamicNote.vue` + - from `packages/frontend/src/components/MkNoteDetailed.vue` to `packages/frontend/src/components/DynamicNoteDetailed.vue` + - from `packages/frontend/src/components/MkNoteSimple.vue` to `packages/frontend/src/components/DynamicNoteSimple.vue` + - from the global timeline to the bubble timeline + - `packages/backend/src/server/api/stream/channels/global-timeline.ts` + - `packages/backend/src/server/api/stream/channels/bubble-timeline.ts` + - `packages/frontend/src/timelines.ts` + - `packages/frontend/src/components/MkTimeline.vue` + - `packages/frontend/src/pages/timeline.vue` + - `packages/frontend/src/ui/deck/tl-column.vue` + - `packages/frontend/src/widgets/WidgetTimeline.vue` + - from `packages/backend/src/queue/processors/InboxProcessorService.ts` to `packages/backend/src/core/UpdateInstanceQueue.ts`, where `updateInstanceQueue` is impacted + - from `.config/example.yml` to `.config/ci.yml` and `chart/files/default.yml` + - in `packages/backend/src/core/MfmService.ts`, from `toHtml` to `toMastoApiHtml` + - from `verifyLink` in `packages/backend/src/core/activitypub/models/ApPersonService.ts` to `verifyFieldLinks` in `packages/backend/src/misc/verify-field-link.ts` (if sensible) + +- If there have been any changes to the federated user data (the `renderPerson` function in `packages/backend/src/core/activitypub/ApRendererService.ts`), make sure that the set of fields in `userNeedsPublishing` and @@ -339,55 +359,57 @@ seems to do a decent job) `packages/backend/src/server/api/endpoints/i/update.ts` are still correct. -* check the changes against our `develop` (`git diff develop`) and - against Misskey (`git diff misskey/develop`) +- Check the changes against our `develop` branch (`git diff develop`) + and against Misskey's `develop` branch (`git diff misskey/develop`). -* re-generate `misskey-js` (`pnpm build-misskey-js-with-types`) and - commit +- Re-generate `misskey-js` (`pnpm build-misskey-js-with-types`) and + commit. -* re-generate locales (`pnpm run build-assets`) and commit +- Re-generate locales (`pnpm run build-assets`) and commit. -* build the frontend: `rm -rf built/; NODE_ENV=development pnpm - --filter=frontend --filter=frontend-embed --filter=frontend-shared - build` (the `development` tells it to keep some of the original - filenames in the built files) +- Build the frontend with this command: -* make sure there aren't any new `ti-*` classes (Tabler Icons), and + ```bash + rm -rf built/ + NODE_ENV=development pnpm --filter=frontend --filter=frontend-embed --filter=frontend-shared build + ``` + +- Make sure there aren't any new `ti-*` classes (Tabler Icons), and replace them with appropriate `ph-*` ones (Phosphor Icons) in [`vite.replaceicons.ts`](packages/frontend/vite.replaceIcons.ts). - * This command should show you want to change: `grep -ohrP + - This command should show you want to change: `grep -ohrP '(?<=["'\''](ti )?)(ti-(?!fw)[\w\-]+)' --exclude \*.map -- built/ | sort -u`. - * NOTE: `ti-fw` is a special class that's defined by Misskey, + - NOTE: `ti-fw` is a special class that's defined by Misskey, leave it alone. - * After every change, re-build the frontend and check again, until + - After every change, re-build the frontend and check again, until there are no more `ti-*` classes in the built files. - * Commit! + - Commit! -* double-check the new migration, that they won't conflict with our db +- Double-check the new migration, that they won't conflict with our db changes: `git diff develop -- packages/backend/migration/` -* `pnpm clean; pnpm build` +- Run `pnpm clean; pnpm build`. -* run tests `pnpm test; pnpm --filter backend test:e2e` (requires a +- Run tests `pnpm test; pnpm --filter backend test:e2e` (requires a test database, [see above](#testing)) and fix them all (the e2e tests randomly fail with weird errors like `relation "users" does - not exist`, run them again if that happens) + not exist`, run them again if that happens). -* run lint `pnpm --filter=backend --filter=frontend-shared lint` + +- Run lint `pnpm --filter=backend --filter=frontend-shared lint` + `pnpm --filter=frontend --filter=frontend-embed eslint` and fix all - the problems + the problems. Then push and open a Merge Request. ### Memory Caches Sharkey offers multiple memory cache implementations, each meant for a -different use case. The following table compares the available +different use case. The following table compares the available options: | Cache | Type | Consistency | Persistence | Data Source | Cardinality | Eviction | Description | @@ -416,22 +438,22 @@ evict stale data. #### Selecting a cache implementation -For most cache uses, `QuantumKVCache` should be considered first. It +For most cache uses, `QuantumKVCache` should be considered first. It offers strong consistency guarantees, multiple cardinality, and a cleaner API surface than the older caches. An alternate cache implementation should be considered if any of the following apply: -* The data is particularly slow to calculate or difficult to +- The data is particularly slow to calculate or difficult to access. In these cases, either `RedisKVCache` or `RedisSingleCache` should be considered. -* If stale data is acceptable, then consider `MemoryKVCache` or +- If stale data is acceptable, then consider `MemoryKVCache` or `MemorySingleCache`. These synchronous implementations have much less overhead than the other options. -* There is only one data item, or all data items must be fetched +- There is only one data item, or all data items must be fetched together. Using `MemorySingleCache` or `RedisSingleCache` could provide a cleaner implementation without resorting to hacks like a fixed key. From 32b70e653b9448e2a8fb3ece09a21ba28c1bd37d Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 6 Jul 2025 11:12:39 +0100 Subject: [PATCH 05/11] fix description of dev mode --- CONTRIBUTING.Sharkey.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index cbeada4cd6..83e28b441f 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -247,11 +247,9 @@ pnpm dev - Service Worker is watched by esbuild. -- The frontend can be viewed by accessing `http://localhost:5173`. - -- The backend listens on the port configured with `port` in +- Sharkey is served on the port configured with `port` in `.config/default.yml`. If you have not changed it from the default, - it will be `http://localhost:3000`. + you can access it at `http://localhost:3000`. ### Testing From ab50c2b144e718f97d5e9f5710dc7c226935c0d0 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 6 Jul 2025 11:13:14 +0100 Subject: [PATCH 06/11] nicer intro, thanks Hazel --- CONTRIBUTING.Sharkey.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 83e28b441f..383ee06513 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -2,7 +2,7 @@ We're glad you're interested in contributing to Sharkey! In this document you will find the information you need to contribute to the -project. We assume you've *also* read Misskey's contribution guide, +project. Please *also* read Misskey's contribution guide, [CONTRIBUTING.md](CONTRIBUTING.md). ## Issues From 6ba69c62fd5f214d06c7767cb634942ead255524 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 6 Jul 2025 11:15:01 +0100 Subject: [PATCH 07/11] mention our fedi account, thanks Hazel --- CONTRIBUTING.Sharkey.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 383ee06513..14a2f1f00d 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -16,8 +16,10 @@ Before creating an issue, please check the following: - Issues should only be used for feature requests, suggestions, and bug tracking. - - For questions and troubleshooting, join - [our Discord server](https://discord.gg/6VgKmEqHNk). + - For questions and troubleshooting, join [our Discord + server](https://discord.gg/6VgKmEqHNk) or tag the official Sharkey + fedi account, + [@sharkey@sharkey.team](https://sharkey.team/@sharkey). > [!WARNING] > Do not close issues that are about to be resolved. It From 5b21dd208e915402ead78547d924a2cb078a0f41 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 10 Jul 2025 14:25:47 +0000 Subject: [PATCH 08/11] fix whitespace --- CONTRIBUTING.Sharkey.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 14a2f1f00d..000fd95194 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -306,7 +306,7 @@ Make sure you have both remotes in the same clone. To do this, run the following command to add Misskey's remote to your local clone: ```bash - git remote add misskey https://github.com/misskey-dev/misskey.git +git remote add misskey https://github.com/misskey-dev/misskey.git ``` Then, to perform the merge: From 8e58d356db86b7ac4d193907a6268af4eb157044 Mon Sep 17 00:00:00 2001 From: dakkar Date: Thu, 10 Jul 2025 15:43:57 +0100 Subject: [PATCH 09/11] better handling of the test database container --- CONTRIBUTING.Sharkey.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 000fd95194..04aab2062c 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -273,12 +273,15 @@ To run many of the tests, you need a dedicated database. To set this up: 3. Start the database container: ```bash - docker compose -f packages/backend/test/compose.yml up + docker compose -f packages/backend/test/compose.yml up -d ``` Now you can run `pnpm test` and `pnpm --filter=backend test:e2e` to run the tests. +To stop the database container, run `docker compose -f +packages/backend/test/compose.yml up -d down` + ### Environment Variables - `MISSKEY_CONFIG_DIR` changes the directory where config files are From b3d27b5b1b150b3472d6e2ae0b76ab86466f8d1e Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 13 Jul 2025 12:52:31 +0100 Subject: [PATCH 10/11] mention where to put new/updated translations --- CONTRIBUTING.Sharkey.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTING.Sharkey.md b/CONTRIBUTING.Sharkey.md index 04aab2062c..b4e6a90270 100644 --- a/CONTRIBUTING.Sharkey.md +++ b/CONTRIBUTING.Sharkey.md @@ -60,6 +60,11 @@ following: run it with `pnpm test` and `pnpm lint`. See the [testing section](#testing) for more info. +- If this MR includes new translated strings, or changes to existing + translations, make sure you have edited `sharkey-locales/en-US.yml` + and *not* any of the files under `locales/` (the files under + `locales/` must stay identical to Misskey) + - If this MR includes UI changes, please attach a screenshot in the text. From ab8d58ee5ac5c179e453ed66949543fe7a8f0419 Mon Sep 17 00:00:00 2001 From: dakkar Date: Wed, 23 Jul 2025 09:29:31 +0100 Subject: [PATCH 11/11] link from README to the new contribution guidelines --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f1a851b68..3f4acee1cd 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ create an instance - + become a contributor