jpie 3.8.3 → 3.9.0
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.
- checksums.yaml +4 -4
- data/.claude/skills/root-cause-analysis/SKILL.md +10 -0
- data/.cursor/agents/systematic-debugging.md +1 -0
- data/Gemfile.lock +1 -1
- data/lib/json_api/serialization/concerns/relationship_processing.rb +8 -5
- data/lib/json_api/serialization/concerns/relationships_serialization.rb +11 -6
- data/lib/json_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4f3af561d7afa748d2a1095a6b3c83fe8ab42b12a6fb88655f67c023e72779ba
|
|
4
|
+
data.tar.gz: ea3c315885d7b2ae18f328bb6659c796e64e82b62b87ae479fd7d3faa0ef4f09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: edd52e432cec91efbd1487ebb8ad340fbe560879415ae6af400290b68e5c5bfa3db6f7afd967077bbf6a5509992329b412f865af88db19f80accadb8903f44e5
|
|
7
|
+
data.tar.gz: 1f9854c359c421410f19645ae03659137059e92f8bc88a1b52b3e79ac2906abe5747c859a46ed02a312ba8ab37e7f661fbce1c16e42a2a29e73e5446122889b1
|
|
@@ -42,6 +42,12 @@ Gather facts before concluding. Prefer:
|
|
|
42
42
|
|
|
43
43
|
Do not rely on assumptions. Evidence supports or refutes hypotheses.
|
|
44
44
|
|
|
45
|
+
**Bind the error to the incident by identity, not by proximity.** An error in the same account, the same minute, the same job class, or the same feature area is NOT evidence that it caused the reported failure. Busy systems fire several unrelated errors in one window. Prove the link with a record identity that both sides share — the job arguments, the record GID, the message id, the request id. Sentry event details carry `job_arguments` and `extra`; open them and read the ids. If no shared id ties the error to the records the user named, you have a co-occurring error, not the cause.
|
|
46
|
+
|
|
47
|
+
Search the failure's exact time window for EVERY error, not just the ones that match your first idea. Then pick the one whose arguments name the user's records. A narrow search that starts from a suspected culprit returns that culprit and hides the real one.
|
|
48
|
+
|
|
49
|
+
**When the user's evidence contradicts your diagnosis, re-run the search.** Do not restate the theory in better words. Their report of what actually happened outranks your reading of the code. Treat the contradiction as a failed hypothesis and go back to evidence gathering.
|
|
50
|
+
|
|
45
51
|
## Methodology and verification
|
|
46
52
|
|
|
47
53
|
- **5 Whys:** State the problem; ask "why?" repeatedly until you reach a cause you can fix. **Verify:** Would fixing this prevent the issue? If not, keep investigating.
|
|
@@ -55,6 +61,10 @@ Do not rely on assumptions. Evidence supports or refutes hypotheses.
|
|
|
55
61
|
| "Let me try this quick fix" | You do not understand the cause |
|
|
56
62
|
| "Maybe if I add a guard here" | Guessing, not debugging |
|
|
57
63
|
| "Let me try a few things" | Random changes waste time |
|
|
64
|
+
| "This error is in the same account and the same minute, so it is the one" | Co-occurrence is not causation; match a record id before you believe it |
|
|
65
|
+
| "The related error is in the same job class / feature, close enough" | Same area is not same incident; open the event's arguments and match the ids |
|
|
66
|
+
| "The user says it still fails, let me explain why my fix is right" | Their evidence beat your theory; re-run the search instead of defending |
|
|
67
|
+
| "I found an error that fits my theory, stop searching" | Search the whole time window; a narrow search only confirms what you assumed |
|
|
58
68
|
|
|
59
69
|
When you notice these, stop and run through problem definition, evidence, and one hypothesis at a time.
|
|
60
70
|
|
|
@@ -20,6 +20,7 @@ Do not recommend changing code just to pass specs, or changing specs just to mak
|
|
|
20
20
|
- Review recent changes (git log, options, caller expectations).
|
|
21
21
|
- Gather evidence (params, include, serializer path, input data).
|
|
22
22
|
- Trace backwards from the failure to where correct behaviour diverges.
|
|
23
|
+
- Bind each error you find to the reported incident by a shared record id (job arguments, record GID, message id, request id) — same account, same minute, or same feature is proximity, not proof. Search the whole failure window, not only what matches your first idea.
|
|
23
24
|
|
|
24
25
|
### Phase 2: Pattern analysis
|
|
25
26
|
|
data/Gemfile.lock
CHANGED
|
@@ -61,26 +61,29 @@ module JSONAPI
|
|
|
61
61
|
|
|
62
62
|
def process_to_many_relationship(attrs, association_name, param_name, data)
|
|
63
63
|
ids = data.map { |r| extract_id(r) }
|
|
64
|
-
types = data.map { |r| extract_type(r) }
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
# An attachment must take the attachment path whether or not the client sends a
|
|
66
|
+
# `type`. JSON:API requires a resource identifier to carry `type` and `id`, so
|
|
67
|
+
# routing on the association itself keeps the spec-compliant payload working
|
|
68
|
+
# instead of falling through to the `<rel>_ids=` setter, which an attachment lacks.
|
|
69
|
+
if active_storage_attachment?(association_name)
|
|
67
70
|
process_active_storage_attachment(attrs, association_name, ids, singular: false)
|
|
68
71
|
return
|
|
69
72
|
end
|
|
70
73
|
|
|
74
|
+
types = data.map { |r| extract_type(r) }
|
|
71
75
|
validate_relationship_type(association_name, types.first) unless polymorphic_association?(association_name)
|
|
72
76
|
attrs["#{param_name.singularize}_ids"] = ids
|
|
73
77
|
end
|
|
74
78
|
|
|
75
79
|
def process_to_one_relationship(attrs, association_name, param_name, data)
|
|
76
80
|
id = extract_id(data)
|
|
77
|
-
type = extract_type(data)
|
|
78
81
|
|
|
79
|
-
if
|
|
82
|
+
if active_storage_attachment?(association_name)
|
|
80
83
|
return process_active_storage_attachment(attrs, association_name, id, singular: true)
|
|
81
84
|
end
|
|
82
85
|
|
|
83
|
-
process_regular_to_one_relationship(attrs, association_name, param_name, id,
|
|
86
|
+
process_regular_to_one_relationship(attrs, association_name, param_name, id, extract_type(data))
|
|
84
87
|
end
|
|
85
88
|
|
|
86
89
|
def process_regular_to_one_relationship(attrs, association_name, param_name, id, type)
|
|
@@ -45,14 +45,19 @@ module JSONAPI
|
|
|
45
45
|
relationships[association_name] = result
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# Linkage carries a type and an id, so reading the association directly
|
|
49
|
+
# leaks the identity of a record the related endpoint denies — the same
|
|
50
|
+
# bypass the `included` section closes, with a narrower payload. Both
|
|
51
|
+
# sections resolve through one authorized read, so they always describe
|
|
52
|
+
# the same set, and the request-scoped filter cache means the second
|
|
53
|
+
# reader vets nothing the first already vetted.
|
|
48
54
|
def serialize_relationship_data(association)
|
|
49
|
-
related = record
|
|
55
|
+
related = get_association_records(record, association.name)
|
|
50
56
|
|
|
51
|
-
if association.collection?
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
57
|
+
return serialize_collection_relationship(related, association) if association.collection?
|
|
58
|
+
|
|
59
|
+
first = related.first
|
|
60
|
+
serialize_single_relationship(first, association) if first
|
|
56
61
|
end
|
|
57
62
|
|
|
58
63
|
def serialize_collection_relationship(related, association)
|
data/lib/json_api/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jpie
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Emil Kampp
|
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
222
222
|
- !ruby/object:Gem::Version
|
|
223
223
|
version: '0'
|
|
224
224
|
requirements: []
|
|
225
|
-
rubygems_version: 3.
|
|
225
|
+
rubygems_version: 3.7.2
|
|
226
226
|
specification_version: 4
|
|
227
227
|
summary: JSON:API compliant Rails gem for producing and consuming JSON:API resources
|
|
228
228
|
test_files: []
|