ework-web 0.10.97 → 0.10.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-web",
3
- "version": "0.10.97",
3
+ "version": "0.10.99",
4
4
  "type": "module",
5
5
  "description": "ework-web — standalone multi-project issue tracker. Local SQLite-backed, no external API dependency. Bun + TypeScript + SSR HTML.",
6
6
  "license": "MIT",
@@ -6,6 +6,7 @@ import {
6
6
  getIssueByUpstreamNumber,
7
7
  getCommentByUpstreamId,
8
8
  createIssue,
9
+ ensureUser,
9
10
  postComment,
10
11
  editIssue,
11
12
  updateUpstreamSyncState,
@@ -43,6 +44,12 @@ export interface UpstreamSyncPollResult {
43
44
 
44
45
  const GITEA_COMMENT_ISSUE_RE = /\/issues\/(\d+)$/;
45
46
 
47
+ // GitHub CI/actions identities end in [bot]; their comments must not wake
48
+ // the engine, so they are imported as bot-kind users.
49
+ function fromGithubBot(login: string | undefined): boolean {
50
+ return typeof login === "string" && /\[bot\]$/i.test(login.trim());
51
+ }
52
+
46
53
  function upstreamIssueNumberFromComment(gc: GiteaComment): number | null {
47
54
  const m = (gc.issue_url ?? "").match(GITEA_COMMENT_ISSUE_RE);
48
55
  return m ? Number(m[1]) : null;
@@ -103,6 +110,7 @@ export class UpstreamSync {
103
110
  }
104
111
 
105
112
  private async importIssue(gi: GiteaIssue, emit: boolean): Promise<void> {
113
+ await ensureUser(gi.user?.login ?? "upstream", fromGithubBot(gi.user?.login) ? "bot" : "human");
106
114
  await createIssue(
107
115
  this.project.id,
108
116
  (gi.pull_request ? "[PR] " : "") + (gi.title || `#${gi.number}`),
@@ -143,7 +151,13 @@ export class UpstreamSync {
143
151
  if (await getCommentByUpstreamId(gc.id)) continue;
144
152
  // write-back comments carry this marker; importing them would duplicate locally
145
153
  if ((gc.body ?? "").includes("<!-- ework-mirror -->")) continue;
146
- const row = await postComment(local.id, gc.body ?? "", gc.user?.login ?? "upstream", {
154
+ const gcAuthor = gc.user?.login ?? "upstream";
155
+ // ensure the kind before postComment's internal user creation runs
156
+ await ensureUser(gcAuthor, fromGithubBot(gcAuthor) ? "bot" : "human");
157
+ // invisible provenance marker: ework-mirror skips events carrying it, so
158
+ // synced-in comments never echo back to the upstream thread
159
+ const body = (gc.body ?? "") + "\n\n<!-- upstream-sync -->";
160
+ const row = await postComment(local.id, body, gcAuthor, {
147
161
  createdAt: gc.created_at,
148
162
  updatedAt: gc.updated_at,
149
163
  upstreamCommentId: gc.id,
@@ -221,7 +235,9 @@ export class UpstreamSync {
221
235
  if (!upstreamNumber) continue;
222
236
  const local = await getIssueByUpstreamNumber(this.project.id, upstreamNumber);
223
237
  if (!local) continue;
224
- const row = await postComment(local.id, gc.body ?? "", gc.user?.login ?? "upstream", {
238
+ const gcAuthor = gc.user?.login ?? "upstream";
239
+ await ensureUser(gcAuthor, fromGithubBot(gcAuthor) ? "bot" : "human");
240
+ const row = await postComment(local.id, gc.body ?? "", gcAuthor, {
225
241
  createdAt: gc.created_at,
226
242
  updatedAt: gc.updated_at,
227
243
  upstreamCommentId: gc.id,