@pome-sh/checks 0.1.7 → 0.1.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @pome-sh/checks
2
2
 
3
+ ## 0.1.8
4
+
5
+ **Grading-vocabulary change: twin-github's seed gained
6
+ `repositories[].files[].renamed_from`.** No check declaration moves, no criterion
7
+ moves and `checksDigest` is unaffected — this package's other half is the seed
8
+ schemas, and this is one of them.
9
+
10
+ `renamed_from` names the path a file was MOVED from on `branch`, and it is the
11
+ only way a seed can take a path away from a branch. A seeded branch is created
12
+ from the default branch and inherits every path, and a plain `files[]` entry can
13
+ add or overwrite but never remove — so `status: "renamed"`, which
14
+ `PullRequestFileRow` has always declared, was reachable from no seed at all, and
15
+ `GET /pulls/:n/files` could not be made to serve GitHub's `previous_filename` by
16
+ any world. Registering that as an allowance would have been accepting a gap in
17
+ the twin's core file model.
18
+
19
+ `content` is refused alongside `renamed_from` and read from the source path
20
+ instead. That is not ergonomics: the branch diff detects a move by pairing
21
+ identical blobs, so a seed naming both a source and different content would be
22
+ asking for a rename the diff would report as an add plus a remove — the same
23
+ unreachability one level up. A seed that sets `renamed_from` with no `branch`, or
24
+ whose source is not a file on the branch, or whose source is its own destination,
25
+ is refused with a message naming the field.
26
+
27
+ Every seed valid before this is valid now: `content` became optional in the
28
+ object and required by refine wherever `renamed_from` is absent.
29
+
3
30
  ## 0.1.7
4
31
 
5
32
  A section a check's verdict reads is now measured HERE, where the worlds are
@@ -23,8 +23,9 @@ export declare const seedSchema: z.ZodObject<{
23
23
  }, z.core.$strip>>>;
24
24
  files: z.ZodDefault<z.ZodArray<z.ZodObject<{
25
25
  path: z.ZodString;
26
- content: z.ZodString;
26
+ content: z.ZodOptional<z.ZodString>;
27
27
  branch: z.ZodOptional<z.ZodString>;
28
+ renamed_from: z.ZodOptional<z.ZodString>;
28
29
  }, z.core.$strip>>>;
29
30
  milestones: z.ZodDefault<z.ZodArray<z.ZodObject<{
30
31
  number: z.ZodOptional<z.ZodNumber>;
@@ -24,8 +24,9 @@ export type SeedRepository = {
24
24
  }>;
25
25
  files?: Array<{
26
26
  path: string;
27
- content: string;
27
+ content?: string;
28
28
  branch?: string;
29
+ renamed_from?: string;
29
30
  }>;
30
31
  milestones?: Array<{
31
32
  number?: number;
@@ -202,6 +203,7 @@ export type PullRequestFileRow = {
202
203
  raw_url: string;
203
204
  contents_url: string;
204
205
  patch: string;
206
+ previous_filename: string | null;
205
207
  };
206
208
  export type CommitStatusRow = {
207
209
  id: number;
@@ -862,7 +862,52 @@ var seedSchema = z.object({
862
862
  color: z.string().default("ededed"),
863
863
  description: z.string().default("")
864
864
  })).default([]),
865
- files: z.array(z.object({ path: z.string().min(1), content: z.string(), branch: z.string().optional() })).default([]),
865
+ // F-1500 `renamed_from` is how a seed expresses a MOVE, and with it the
866
+ // `status: "renamed"` the row type has always declared and no world could
867
+ // reach. A seeded branch is created from the default branch and inherits
868
+ // every path, and a plain `files[]` entry can only add or overwrite, so
869
+ // before this there was no way to make a path ABSENT from the head branch
870
+ // — and `previous_filename` was therefore unreachable from any seed, not
871
+ // merely unemitted.
872
+ //
873
+ // `content` is refused alongside `renamed_from` rather than merged with
874
+ // it: the diff detects a move by pairing identical blobs (see
875
+ // `calculatePullFiles`), so a seed naming a source AND different content
876
+ // would be asking for a rename the diff would report as an add plus a
877
+ // remove. Refusing it keeps "the seed asked for a rename" and "the twin
878
+ // serves a rename" the same statement. The content comes from the source
879
+ // path, which the domain resolves on the branch the move happens on.
880
+ files: z.array(z.object({
881
+ path: z.string().min(1),
882
+ content: z.string().optional(),
883
+ branch: z.string().optional(),
884
+ renamed_from: z.string().min(1).optional()
885
+ }).superRefine((file, ctx) => {
886
+ if (file.renamed_from === void 0) {
887
+ if (file.content === void 0) {
888
+ ctx.addIssue({
889
+ code: "custom",
890
+ path: ["content"],
891
+ message: "content is required on a file entry that declares no renamed_from"
892
+ });
893
+ }
894
+ return;
895
+ }
896
+ if (file.content !== void 0) {
897
+ ctx.addIssue({
898
+ code: "custom",
899
+ path: ["content"],
900
+ message: `renamed_from carries the source file's content, so content must be omitted (${file.path})`
901
+ });
902
+ }
903
+ if (file.renamed_from === file.path) {
904
+ ctx.addIssue({
905
+ code: "custom",
906
+ path: ["renamed_from"],
907
+ message: `renamed_from must name a different path than the file it moves to (${file.path})`
908
+ });
909
+ }
910
+ })).default([]),
866
911
  // F-1421 — milestones, tags and releases are repository-level entities the
867
912
  // twin already SERVES (`GET /milestones`, `/tags`, `/releases`,
868
913
  // `/releases/latest`, `/releases/tags/:tag`) and the seed could not
package/dist/github.js CHANGED
@@ -1,2 +1,2 @@
1
- export { GITHUB_CHECKS, defaultSeedState, parseSeed, seedSchema } from './chunk-JVCGWAZQ.js';
1
+ export { GITHUB_CHECKS, defaultSeedState, parseSeed, seedSchema } from './chunk-23CBSVIJ.js';
2
2
  import './chunk-W2JNYULF.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import './chunk-ZXE6LAM3.js';
2
- import { GITHUB_CHECKS } from './chunk-JVCGWAZQ.js';
3
- export { GITHUB_CHECKS, defaultSeedState as defaultGitHubSeed, seedSchema as githubSeedSchema, parseSeed as parseGitHubSeed } from './chunk-JVCGWAZQ.js';
2
+ import { GITHUB_CHECKS } from './chunk-23CBSVIJ.js';
3
+ export { GITHUB_CHECKS, defaultSeedState as defaultGitHubSeed, seedSchema as githubSeedSchema, parseSeed as parseGitHubSeed } from './chunk-23CBSVIJ.js';
4
4
  import { GMAIL_CHECKS } from './chunk-KTTJCEDH.js';
5
5
  export { GMAIL_CHECKS, defaultSeedState as defaultGmailSeed, gmailSeedSchema, parseSeed as parseGmailSeed } from './chunk-KTTJCEDH.js';
6
6
  import { LINEAR_CHECKS } from './chunk-THOSO63W.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pome-sh/checks",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Pome's grading vocabulary — the check declarations, seed schemas and default seeds of all five digital twins, plus the check DSL they are written in. Declarations only: no twin server, no database, no routes, no tools.",
5
5
  "private": false,
6
6
  "type": "module",